Saving and loading player positions -
Blademaster680 - 15.07.2013
Can someone please explain to me how I can save and load the positions of a player
for eg. John walks to pizza stack and logs off. He comes back later and logs back in and spawns at his last location, in this case pizza stack.
I am using this system -
https://sampforum.blast.hk/showthread.php?tid=273088
The script
http://pastebin.com/aV9sqeWn
Re: Saving player positions -
Deathstalker - 15.07.2013
GetPlayerPos and
SetPlayerPos and some basic scripting and Y_Ini knowledge is all you need.
Edit: Might need
GetPlayerFacingAngle and
SetPlayerFacingAngle too.
Re: Saving player positions -
Blademaster680 - 15.07.2013
How would I add those things into the script
(sorry im new to this, But learning fast)
Re: Saving player positions -
Blademaster680 - 16.07.2013
I found a tutorial on making the system save player positions but it wont load the position and spawn him.
What must I do?
Re: Saving player positions -
gtakillerIV - 16.07.2013
Show us the code of the loading.
Re: Saving player positions -
Blademaster680 - 16.07.2013
Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float( "PosX", PosX[playerid]);
INI_Float( "PosY", PosY[playerid]);
INI_Float( "PosZ", PosZ[playerid]);
INI_Float( "Angle", Angle[playerid]);
INI_Int( "Interior", Interior[playerid]);
INI_Int( "VirtualWorld", VirtualWorld[playerid]);
return 1;
}
Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
PosX[playerid] = 0;
PosY[playerid] = 0;
PosZ[playerid] = 0;
Angle[playerid] = 0;
Interior[playerid] = 0;
VirtualWorld[playerid] = 0;
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
return 1;
}
Re: Saving player positions -
Blademaster680 - 16.07.2013
Can anyone help please.
Really need this
Re: Saving player positions -
JimmyCh - 16.07.2013
You need to save his position to a file OnPlayerDisconnect, and load from that when he re-connects.
Simple.
Re: Saving player positions -
Blademaster680 - 16.07.2013
It does save the last position to a file with all the other data.
The problem is that its not loading the positions from the file
Re: Saving player positions -
JimmyCh - 16.07.2013
Can you show us your new codes with the position loading thingy?