SA-MP Forums Archive
Save Player Point on Logoff - 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: Save Player Point on Logoff (/showthread.php?tid=300499)



Save Player Point on Logoff - Black Axe - 30.11.2011

Well , I Wanted that when the Player logoff his Location Saves - And i am using Y_ini - So i did the Following :


Under OnPlayerDisconnect

PHP код:
    INI_WriteInt(File,"Health",PlayerInfo[playerid][pHealth]);
    
INI_WriteInt(File,"Armor",PlayerInfo[playerid][pArmor]);
    
INI_WriteInt(File,"SPos_x",PlayerInfo[playerid][pSPos_x]);
    
INI_WriteInt(File,"SPos_y",PlayerInfo[playerid][pSPos_y]);
    
INI_WriteInt(File,"SPos_z",PlayerInfo[playerid][pSPos_z]);
    
INI_WriteInt(File,"SPos_r",PlayerInfo[playerid][pSPos_r]);
    
INI_WriteInt(File,"Int",PlayerInfo[playerid][pInt]); 
And under LoadUser_data :

PHP код:
        INI_Int("Health",PlayerInfo[playerid][pHealth]);
        
INI_Int("Armor",PlayerInfo[playerid][pArmor]);
        
INI_Int("Int",PlayerInfo[playerid][pInt]);
        
INI_Int("SPos_x",PlayerInfo[playerid][pSPos_x]);
        
INI_Int("SPos_y",PlayerInfo[playerid][pSPos_y]);
        
INI_Int("SPos_z",PlayerInfo[playerid][pSPos_z]);
        
INI_Int("SPos_r",PlayerInfo[playerid][pSPos_r]); 
And..

PHP код:
public SetPlayerSpawn(playerid)
{
    
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
    
SetPlayerArmour(playeridPlayerInfo[playerid][pArmor]);
    
SetPlayerInterior(playeridPlayerInfo[playerid][pInt]);
    
SetPlayerPos(playeridPlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
    
SetPlayerFacingAngle(playeridPlayerInfo[playerid][pSPos_r]);
    
SetCameraBehindPlayer(playerid);
    return 
1;

But it don't save - Any Solutions ?


Re: Save Player Point on Logoff - ElkaBlazer - 30.11.2011

I think you should use floatround to save floats
Or load as float not as int