How to save the Spawn (Location) ?
#1

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!
Reply
#2

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;
}
Reply
#3

Didn't get!
Reply
#4

What do you want exactly? Explain
Reply
#5

I want that When I click on "SPAWN" Button, I spawn near LS [Commerce 4]
How I can safe this location?
Reply
#6

Go to the location type /savepos LS
And it will be saved in your documents/SAMP/ And saved locations
Reply
#7

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!!
Reply
#8

TYYYYYYYYYYYYYYYYYYYYY <3 <3
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)