[Help] Save armour
#1

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));
Reply
#2

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...
Reply
#3

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.
Reply
#4

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)