SA-MP Forums Archive
How to spawn player on position player was in this ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to spawn player on position player was in this ? (/showthread.php?tid=640719)



How to spawn player on position player was in this ? - Hiei - 06.09.2017

when leave game, how to get player pos and when player connect, player spawn with this position ?
help meeeee


Re: How to spawn player on position player was in this ? - iSpark - 06.09.2017

Get a saving system and save the coordinates of the player when it disconnects. And when the player rejoins then load the position from the file and set the position.

Some frequently used saving systems are:
1. MySQL
2. SQLite
3. Y_INI
4. DINI
etc.


Re: How to spawn player on position player was in this ? - JasonRiggs - 06.09.2017

Make Enums for the player for example

oldX,
oldY,
oldZ,

and put under OnPlayerDisconnect

Quote:

GetPlayerPos(PlayerInfo[playerid][oldX], PlayerInfo[playerid][oldY], PlayerInfo[playerid][oldZ]);

and make sure that you save these enums in the player's .ini if u are using DINI or YINI or save it in the player's table if you're using MySQL..

Then go ahead under OnPlayerConnect and put under it
Quote:

SetPlayerPos(PlayerInfo[playerid][oldX], PlayerInfo[playerid][oldY], PlayerInfo[playerid][oldZ]);

and we are done..


Re: How to spawn player on position player was in this ? - Hiei - 06.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
Make Enums for the player for example

oldX,
oldY,
oldZ,

and put under OnPlayerDisconnect



and make sure that you save these enums in the player's .ini if u are using DINI or YINI or save it in the player's table if you're using MySQL..

Then go ahead under OnPlayerConnect and put under it
and we are done..
C:\Users\Karato\Downloads\San Andreas File-X-Survival\filterscripts\Login.pwn(830) : warning 213: tag mismatch
C:\Users\Karato\Downloads\San Andreas File-X-Survival\filterscripts\Login.pwn(830) : warning 213: tag mismatch
C:\Users\Karato\Downloads\San Andreas File-X-Survival\filterscripts\Login.pwn(830) : warning 202: number of arguments does not match definition
C:\Users\Karato\Downloads\San Andreas File-X-Survival\filterscripts\Login.pwn(880) : warning 202: number of arguments does not match definition


Re: How to spawn player on position player was in this ? - JasonRiggs - 06.09.2017

and should I imagine what the error lines are? Show me the lines of these errors..


Re: How to spawn player on position player was in this ? - Hiei - 06.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
and should I imagine what the error lines are? Show me the lines of these errors..
like this


Re: How to spawn player on position player was in this ? - JasonRiggs - 06.09.2017

the lines itself which showed these errors, Lines : 830 and 880