18.11.2009, 03:10
Hi i need help with dini, again..
I've done this code practicing round with it
It does work getting the players armour on connect, but when leaving it doesnt set the new armour value...anyone know why?
Thanks
I've done this code practicing round with it
pawn Код:
#include <a_samp>
#include <zcmd>
public OnPlayerConnect(playerid)
{
new file[50], Float:Armour;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.ini", name);
if(!dini_Exists(file))
{
dini_Create(file);
dini_FloatSet(file, "Armour", 0);
printf("%s's file created", name);
}
else
{
Armour = dini_Float(file, "Armour");
SetPlayerArmour(playerid, Armour);
printf("%s's file loaded", name);
}
return 1;
}
COMMAND:atest(playerid, params[])
{
SetPlayerArmour(playerid, 100);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new Float:Armour, file[50];
GetPlayerArmour(playerid, Armour);
dini_FloatSet(file, "Armour", Armour);
return 1;
}
Thanks