SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 07/02/2014, 04:42 PM   #21
Ramms
Little Clucker
 
Join Date: Nov 2011
Posts: 1
Reputation: 0
Post Re: Save, load and set player position - using y_ini

i have this working but when i restart the server the coords do not load it spawns me at 0,0,0
Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsPlayerLoggedIn[playerid] == 1)
	{
		new INI:iFile = INI_Open(PlayerPath(playerid));
		INI_SetTag(iFile,"data");
		GetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]);
    	GetPlayerFacingAngle( playerid, PlayerInfo[playerid][pAngle]);
        INI_SetTag(iFile, "position");
    	INI_WriteFloat(iFile,"PositionX",PlayerInfo[playerid][pPosX]);
    	INI_WriteFloat(iFile,"PositionY",PlayerInfo[playerid][pPosY]);
    	INI_WriteFloat(iFile,"PositionZ",PlayerInfo[playerid][pPosZ]);
    	INI_WriteFloat(iFile,"Angle",PlayerInfo[playerid][pAngle]);
    	INI_WriteInt(iFile,"Interior",GetPlayerInterior(playerid));
    	INI_WriteInt(iFile,"VirtualWorld",GetPlayerVirtualWorld(playerid));
		INI_Close(iFile);
	}
	return 1;
}

public UserDataLoad_data(playerid,name[],value[]) {
	INI_Int("Pass",PlayerInfo[playerid][pPass]);
	#if defined AUTOLOGIN
		INI_String("IP",pIP[playerid],16);
	#endif
	INI_Float("PositionX",PlayerInfo[playerid][pPosX]);
    INI_Float("PositionY",PlayerInfo[playerid][pPosY]);
    INI_Float("PositionZ",PlayerInfo[playerid][pPosZ]);
    INI_Float("Angle",PlayerInfo[playerid][pAngle]);
    INI_Int("Interior",PlayerInfo[playerid][pInterior]);
    INI_Int("VirtualWorld",PlayerInfo[playerid][pVirtualWorld]);
    
	return 1;
}

public SkipSpawn(playerid)
{
    if(PlayerInfo[playerid][pReg] == 1)
	{
        SetSpawnInfo( playerid, 0, 0, PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ],PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0 );
		SetPlayerInterior( playerid, PlayerInfo[playerid][pInterior]);
        SetPlayerVirtualWorld( playerid, PlayerInfo[playerid][pVirtualWorld]);
		SpawnPlayer(playerid);
        SendClientMessage( playerid, -1, "welcome to your last position" );
    }
  	else if(PlayerInfo[playerid][pReg] == 0)
  	{
  		SetSpawnInfo( playerid, 0, 0, -2764.9766,375.4572,6.3430,271.0806, 0, 0, 0, 0, 0, 0 );
  		SpawnPlayer(playerid);
	}
  	return 1;
}
Ramms is offline   Reply With Quote
Old 05/04/2014, 12:13 PM   #22
xPirate
Little Clucker
 
xPirate's Avatar
 
Join Date: Aug 2013
Posts: 39
Reputation: 0
Default Re: Save, load and set player position - using y_ini

BUMP Same problem !
__________________
New Extreme-Stunting v3.0 coming soon!
xPirate is offline   Reply With Quote
Old 05/04/2014, 01:18 PM   #23
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 804
Reputation: 56
Default Re: Save, load and set player position - using y_ini

I believe that It won't be saved when it's a server restart. (START/STOP). Try to quit the game and join again.
__________________
k
biker122 is offline   Reply With Quote
Old 05/04/2014, 02:26 PM   #24
xPirate
Little Clucker
 
xPirate's Avatar
 
Join Date: Aug 2013
Posts: 39
Reputation: 0
Default Re: Save, load and set player position - using y_ini

EDIT: Fixed & working with different code !
__________________
New Extreme-Stunting v3.0 coming soon!

Last edited by xPirate; 05/04/2014 at 04:04 PM.
xPirate is offline   Reply With Quote
Old 20/06/2017, 03:39 PM   #25
GrandTA
Little Clucker
 
GrandTA's Avatar
 
Join Date: Mar 2017
Posts: 3
Reputation: 0
Default Re: Save, load and set player position - using y_ini

Thanks Man Its Works +rep
GrandTA is offline   Reply With Quote
Old 16/07/2017, 03:46 PM   #26
2xRichard
Little Clucker
 
2xRichard's Avatar
 
Join Date: Jul 2017
Posts: 3
Reputation: 0
Question Re: Save, load and set player position - using y_ini

Hey i server restarting , it not work and not load players pos !
Spawn all players to x0 y0 z0 !
can you help ?

Last edited by 2xRichard; 16/07/2017 at 04:48 PM.
2xRichard is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Player Inventory System 0.2b (Menu + Save / Load) -zriptarusk Filterscripts 37 24/01/2014 07:08 PM
I need help! pls! /s and /r or /l script or fs save position and load position ProdrifterX Scripting Help 2 14/10/2011 04:02 PM
Save & Load position anumaz Help Archive 4 16/07/2011 03:26 AM
save player position ! dorperez Help Archive 2 19/01/2011 03:27 PM
[FilterScript] [FS] Position Saver (dynamic position save system) Nero_3D Filterscripts 13 20/08/2010 06:02 PM


All times are GMT. The time now is 11:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.