SA-MP Forums Archive
Stupid Mistake i can't fix ! :B - 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: Stupid Mistake i can't fix ! :B (/showthread.php?tid=326912)



Stupid Mistake i can't fix ! :B - Mikeydoo - 19.03.2012

Here it is : I need to save players positions. So when they spawn , if they already registered they simply load their old position. But if they did not , they need to spawn to where i want them to go, which means, the default spawn point. For now on , the position save works but they cannot spawn normaly to where i want them to spawn as they spawn on Default spawn coordinates (0,0)

Heres my code : public OnPlayerSpawn(playerid)
{
PlayerInfo[playerid][gHP] = 100;
if(PlayerInfo[playerid][Logged] == 1)
PlayerInfo[playerid][Spawned] = 1;
{
SetPlayerPos(playerid, PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
SetPlayerInterior(playerid, dini_Int(NameToFile(playerid), "LastInt"));
}
else
{
SetPlayerPos(playerid, 1641.5160, -2239.5818, 13.4972);
}
return 1;
}


Thanks a lot ! :B
Mike


Re: Stupid Mistake i can't fix ! :B - -Prodigy- - 19.03.2012

Try this:
pawn Код:
public OnPlayerSpawn(playerid)
{
    PlayerInfo[playerid][gHP] = 100;

    if(PlayerInfo[playerid][Logged] == 1)
//PlayerInfo[playerid][Spawned] = 1;
    {
        SetPlayerPos(playerid, PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
        SetPlayerInterior(playerid, dini_Int(NameToFile(playerid), "LastInt"));
    }
    else
    {
        SetPlayerPos(playerid, 1641.5160, -2239.5818, 13.4972);
    }
    return 1;
}



Re : Stupid Mistake i can't fix ! :B - Mikeydoo - 19.03.2012

Oh god ! Thanks a lot buddy ! That was quick and exactly what i needed !

Mike