23.03.2013, 19:50
Hi!
I have a small problem with my health and armour save system. The saved file looks like this:
Even if I don't wear a armour on the server. (Armour = 1)
My save code:
Load:
Disconnect:
Read:
What am I doing wrong?
I have a small problem with my health and armour save system. The saved file looks like this:
Код:
HealthSave = 1 ArmourSave = 1
My save code:
Код:
new HealthSave[ MAX_PLAYERS ], ArmourSave[ MAX_PLAYERS ] ;
Код:
public load_user_position( playerid, name[], value[] ) { INI_Float( "PositionX", PosX[ playerid ] ); INI_Float( "PositionY", PosY[ playerid ] ); INI_Float( "PositionZ", PosZ[ playerid ] ); INI_Float( "Angle", Angle[ playerid ] ); INI_Int( "Interior", Interior[ playerid ] ); INI_Int( "VirtualWorld", VirtualWorld[ playerid ] ); INI_Int( "Skin", Skin[ playerid ] ); INI_Int( "HealthSave", HealthSave[ playerid ] ); INI_Int( "ArmourSave", ArmourSave[ playerid ] ); return ( 1 ); }
Код:
GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); GetPlayerFacingAngle( playerid, Angle[ playerid ] ); GetPlayerHealth(playerid,hp); GetPlayerArmour(playerid,arm); new INI:File = INI_Open( user_ini_file( playerid ) ); INI_SetTag( File, "position" ); INI_WriteFloat( File, "PositionX", PosX[ playerid ] ); INI_WriteFloat( File, "PositionY", PosY[ playerid ] ); INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] ); INI_WriteFloat( File, "Angle", Angle[ playerid ] ); INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) ); INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) ); INI_WriteInt( File, "Skin", GetPlayerSkin( playerid ) ); INI_WriteInt( File, "HealthSave", GetPlayerHealth(playerid,hp) ); INI_WriteInt( File, "ArmourSave", GetPlayerArmour(playerid, arm) ); INI_Close( File );
Код:
if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 && Angle[ playerid ] != 0 ) { SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); SetPlayerFacingAngle( playerid, Angle[ playerid ] ); SetPlayerInterior( playerid, Interior[ playerid ] ); SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] ); SetPlayerSkin( playerid, Skin[ playerid ] ); if(HealthSave[ playerid ] > 5) { SetPlayerHealth( playerid, HealthSave[ playerid ] ); } else { SetPlayerHealth(playerid, 65); } SetPlayerArmour( playerid, ArmourSave[ playerid ] ); }