SA-MP Forums Archive
Only for no admin duty saving health. - 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: Only for no admin duty saving health. (/showthread.php?tid=562254)



Only for no admin duty saving health. - TiXz0r - 07.02.2015

I have save system with health and armor, and when next time connect, player will be have old health and armor. but , when admin going on admin duty, server set him health and armor to 99999,i want make when is player on duty, server dont saving him health and armor to player .ini file, will be have old health and armor.

i make this, but, dont working.

Код:
public SavePlayer(playerid)
{
    if(IsLogged[playerid] == true){
	{
	new Float:health, Float:armour;
	GetPlayerHealth(playerid, health);
	GetPlayerArmour(playerid, armour);

	//
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    INI_WriteInt(File,"Level",GetPlayerScore(playerid));
    INI_WriteInt(File,"BankCash",PlayerInfo[playerid][pBankCash]);
    INI_WriteInt(File,"BankCard",PlayerInfo[playerid][pBankCard]);
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
   	{
   	if(gaDuty[playerid] != 0) {
    INI_WriteFloat(File, "Health", health);
    INI_WriteFloat(File, "Armour", armour);
    }
    }
    INI_WriteFloat(File, "SpawnX", PlayerInfo[playerid][pSpawnX]);
    INI_WriteFloat(File, "SpawnY", PlayerInfo[playerid][pSpawnY]);
    INI_WriteFloat(File, "SpawnZ", PlayerInfo[playerid][pSpawnZ]);
    INI_WriteFloat(File, "SpawnFacingAngle", PlayerInfo[playerid][pSpawnFacingAngle]);
    INI_Close(File);
	}
	}
	return 1;
}
sorry for my bad english. thanks


Re: Only for no admin duty saving health. - TiXz0r - 07.02.2015

bumb


Respuesta: Only for no admin duty saving health. - Zume - 07.02.2015

PHP код:
public SavePlayer(playerid)
{
    if(
IsLogged[playerid] != true)
        return 
0;
        
    new
        
Float:health,
        
Float:armour
        
;
    
GetPlayerHealth(playeridhealth);
    
GetPlayerArmour(playeridarmour);
    new
        
INI:File INI_Open(UserPath(playerid));
        
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    
INI_WriteInt(File,"Level",GetPlayerScore(playerid));
    
INI_WriteInt(File,"BankCash",PlayerInfo[playerid][pBankCash]);
    
INI_WriteInt(File,"BankCard",PlayerInfo[playerid][pBankCard]);
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
       if(
gaDuty[playerid] != true)// Yes
    
{
        
INI_WriteFloat(File"Health"health);
        
INI_WriteFloat(File"Armour"armour);
    }
    
INI_WriteFloat(File"SpawnX"PlayerInfo[playerid][pSpawnX]);
    
INI_WriteFloat(File"SpawnY"PlayerInfo[playerid][pSpawnY]);
    
INI_WriteFloat(File"SpawnZ"PlayerInfo[playerid][pSpawnZ]);
    
INI_WriteFloat(File"SpawnFacingAngle"PlayerInfo[playerid][pSpawnFacingAngle]);
    
INI_Close(File);
    return 
1;

and create a variable to storing the HP before are duty and other to ARMOUR.


Re: Respuesta: Only for no admin duty saving health. - TiXz0r - 07.02.2015

Quote:
Originally Posted by _Zume
Посмотреть сообщение
PHP код:
public SavePlayer(playerid)
{
    if(
IsLogged[playerid] != true)
        return 
0;
        
    new
        
Float:health,
        
Float:armour
        
;
    
GetPlayerHealth(playeridhealth);
    
GetPlayerArmour(playeridarmour);
    new
        
INI:File INI_Open(UserPath(playerid));
        
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    
INI_WriteInt(File,"Level",GetPlayerScore(playerid));
    
INI_WriteInt(File,"BankCash",PlayerInfo[playerid][pBankCash]);
    
INI_WriteInt(File,"BankCard",PlayerInfo[playerid][pBankCard]);
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
       if(
gaDuty[playerid] != true)// Yes
    
{
        
INI_WriteFloat(File"Health"health);
        
INI_WriteFloat(File"Armour"armour);
    }
    
INI_WriteFloat(File"SpawnX"PlayerInfo[playerid][pSpawnX]);
    
INI_WriteFloat(File"SpawnY"PlayerInfo[playerid][pSpawnY]);
    
INI_WriteFloat(File"SpawnZ"PlayerInfo[playerid][pSpawnZ]);
    
INI_WriteFloat(File"SpawnFacingAngle"PlayerInfo[playerid][pSpawnFacingAngle]);
    
INI_Close(File);
    return 
1;

and create a variable to storing the HP before are duty and other to ARMOUR.
thanks , but error,

warning 213: tag mismatch

on

if(gaDuty[playerid] != true)