02.09.2015, 05:29
Quote:
As easy as it sounds:
Код:
SavePlayerWeaponData(playerid) // save the data on disconnect { new weaponid, ammo, string[10] ; for (new i = 0; i != 13; i++) { GetPlayerWeaponData(playerid, i, weaponid, ammo); if(!weaponid) continue; format(string, sizeof (string), "Gun%02i", i); INI_WriteInt(File, string, weaponid); format(string, sizeof (string), "Ammo%02i", i) INI_WriteInt(File, string, ammo); } } // Load the data on first spawn new weaponid, ammo, string[10] ; for (new i = 0; i != 13; i++) { format(string, sizeof (string), "Gun%02i", i); INI_Int(string, weaponid); format(string, sizeof (string), "Ammo%02i", i) INI_Int(string, ammo); GivePlayerWeapon(playerid, weaponid, ammo); } } |
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerInfo[playerid][Registered])
{
if(Spawned[playerid])
{
SaveUser(playerid);
}
}
new string[128];
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Lost Connection)", RemoveUnderScore(playerid));
case 1: format(string,sizeof string,"%s left the server.", RemoveUnderScore(playerid));
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)", RemoveUnderScore(playerid));
}
CloseMessage(playerid, GREY, string);
SendAdminMessage(GREY, string);
SavePlayerWeaponData(playerid);
ResetPlayerWeapons(playerid);
return 1;
}
pawn Код:
(1038) : error 017: undefined symbol "File"
(1041) : error 001: expected token: ";", but found "-identifier-"
(1041) : error 017: undefined symbol "File"
pawn Код:
format(string, sizeof (string), "Gun%02i", i);
INI_WriteInt(File, string, weaponid); // 1038
format(string, sizeof (string), "Ammo%02i", i)
INI_WriteInt(File, string, ammo); // 1041