SA-MP Forums Archive
[Help] Save armour - 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: [Help] Save armour (/showthread.php?tid=660168)



[Help] Save armour - Duartstrocci - 26.10.2018

Hi people, i have a small problem with save armour
Anyone can help me please?

ON OnPlayerSpawn:

if(dini_Isset("Armour.ini",PlayerName(playerid))) SetPlayerArmour(playerid,dini_Int("Armour.ini",Pla yerName(playerid)));

ON OnPlayerDisconnect:

dini_IntSet("Armour.ini",PlayerName(playerid),GetP layerArmour(playerid));

ON OnGameModeInit:

if(!fexist("Armour.ini")) dini_Create("Armour.ini");

The problem :
warning 202: number of arguments does not match definition
dini_IntSet("Armour.ini",PlayerName(playerid),GetP layerArmour(playerid));


Re: [Help] Save armour - KinderClans - 26.10.2018

Almost 2019 and still using Dini....

However, you should call just SetPlayerArmour when they login, not at every spawn.

Also on OnPlayerDisconnect you're saving player armour wrong.

Please, switch to MySQL. We're almost in 2019...


Re: [Help] Save armour - Mugala - 26.10.2018

You don't need to create Armour.ini separately to make this save-script, but listen to this guy, just throw Dini away, use SQL.


Re: [Help] Save armour - KinderClans - 26.10.2018

Just to make understand @op how it's easy to save things with MySQL. I'm gonna save health/armour.

Enum/New:

pawn Код:
enum E_PLAYERS
{
    Float:pHealth,
    Float:pArmour
}
new Player[MAX_PLAYERS][E_PLAYERS];
Loading and setting values (Should be used when player login):

pawn Код:
cache_get_value_float(0, "pHealth", Player[playerid][pHealth]);
cache_get_value_float(0, "pArmour", Player[playerid][pArmour]);
SetPlayerHealth(playerid, Player[playerid][pHealth]);
SetPlayerArmour(playerid, Player[playerid][pArmour]);
Saving:

pawn Код:
new Float:health, Float: armour;

GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);

new query[70];
format(query,sizeof(query),"UPDATE `your_players_table` SET `pHealth` = %f, `pArmour` = %f WHERE `ID`= %d", health, armour, Player[p][ID]);

mysql_query(g_SQL, query);