Posts: 78
Threads: 25
Joined: Apr 2012
Reputation:
0
Hello,
I'm using YIni for my saving/loading system and for some reason it doesn't show the dialog to log in!
Also,
How would I make it load a players last positions?
I already got everything saved in the .ini file, just making them load is the problem!
Posts: 368
Threads: 24
Joined: Feb 2012
After the first spawn, use a timer to change player position to the last known position that you take from .ini file.
Posts: 368
Threads: 24
Joined: Feb 2012
Make a variable like FirstSpawn[playerid], on connect its set to 0. When player spawn for the first time, do timer like this:
pawn Код:
if(FirstSpawn[playerid] == 0) SetTimerEx("RestorePos", 500, false, "i", playerid);
It will call for a public function called RestorePos:
pawn Код:
forward RestorePos(playerid);
public RestorePos(playerid)
{
SetPlayerPos(playerid, LAST X, LAST Y,LAST Z);
FirstSpawn[playerid] = 1; // setting this to 1 so it wont send player back on every spawn
GameTextForPlayer(playerid,"~y~Restored to last known pos",3000,1);
return 1;
}
Posts: 78
Threads: 25
Joined: Apr 2012
Reputation:
0
Ok, and the YIni problem?
Posts: 368
Threads: 24
Joined: Feb 2012
I dont know yini well since i never used it, but you should show the code where you have the login dialog.
Posts: 78
Threads: 25
Joined: Apr 2012
Reputation:
0
Ok, I sorted the dialog out which works fine, but I want to force spawn a player once they entered there password and load there last position, without using a timer!(if there is another way)
EDIT: I was wrong, if pRegged is set to 1 then it doesn't show the dialog for the player when they connect again!
Posts: 368
Threads: 24
Joined: Feb 2012
You could try putting RestorePos(playerid); inside OnPlayerSpawn, dont know how that will work out though.