How to save the Spawn (Location) ? - 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 save the Spawn (Location) ? (
/showthread.php?tid=461301)
How to save the Spawn (Location) ? -
MAFIAWARS - 01.09.2013
Hello Friends!
i am new Here!
I want to set my Spawn at a particular place so after Clicking "Spawn" Button I spawn on that Place exactly.
How can I do this? Please HELP!
Re: How to save the Spawn (Location) ? -
park4bmx - 01.09.2013
pawn Код:
new Float:Pos[3];
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME],file[80];GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.txt",name);
INI_ParseFile(file, "LoadPos", false, true, playerid, true, false);
if(fexist(file)) SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
}
public OnPlayerDisconnect(playerid, reason)
{
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
//start saving with (Y_INI)
new name[MAX_PLAYER_NAME], file[30+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.txt",name);
if(fexist(file))
{
new INI:Acc = INI_Open(file);
INI_WriteFloat(Acc,"PosX",Pos[0]);
INI_WriteFloat(Acc,"PosY",Pos[1]);
INI_WriteFloat(Acc,"PosZ",Pos[2]);
INI_Close(Acc);
}
return 1;
}
forward LoadPos(playerid, name[], value[]);
public LoadPos(playerid, name[], value[])
{
if(!strcmp(name, "PosX")) Pos[0] = value;
if(!strcmp(name, "PosY")) Pos[1] = value;
if(!strcmp(name, "PosZ")) Pos[2] = value;
}
Re: How to save the Spawn (Location) ? -
MAFIAWARS - 01.09.2013
Didn't get!
Re: How to save the Spawn (Location) ? -
Rapgangsta - 01.09.2013
What do you want exactly? Explain
Re: How to save the Spawn (Location) ? -
MAFIAWARS - 01.09.2013
I want that When I click on "SPAWN" Button, I spawn near LS [Commerce 4]
How I can safe this location?
Re: How to save the Spawn (Location) ? -
park4bmx - 01.09.2013
Go to the location type /savepos LS
And it will be saved in your documents/SAMP/ And saved locations
Re: How to save the Spawn (Location) ? -
Yashas - 01.09.2013
Follow these steps:
- Start your server and join it.
- Go to your spawn location.
- Type '/save MySpawnPoint'
- Open Documents\GTA San Andreas User Files\SAMP.You will find a txt file named savedpositions
- Open it and find the line that has the comment "MySpawnPoint".Copy the line or copy the 2nd,3rd,4th,5th numbers and paste it in your code.
Done!!It should work!!
Re: How to save the Spawn (Location) ? -
MAFIAWARS - 01.09.2013
TYYYYYYYYYYYYYYYYYYYYY <3 <3