17.02.2012, 07:19
I have an error on weapon save script.
This is a save weapon on player disconnect
And this is a giveplayerweapon on spawn.
Where is a error ?
This is a save weapon on player disconnect
pawn Код:
GetPlayerWeaponData(playerid, 1, PlayerInfo[playerid][pWeapon1], PlayerInfo[playerid][pAmmo1]);
GetPlayerWeaponData(playerid, 2, PlayerInfo[playerid][pWeapon2], PlayerInfo[playerid][pAmmo2]);
GetPlayerWeaponData(playerid, 3, PlayerInfo[playerid][pWeapon3], PlayerInfo[playerid][pAmmo3]);
GetPlayerWeaponData(playerid, 4, PlayerInfo[playerid][pWeapon4], PlayerInfo[playerid][pAmmo4]);
GetPlayerWeaponData(playerid, 5, PlayerInfo[playerid][pWeapon5], PlayerInfo[playerid][pAmmo5]);
GetPlayerWeaponData(playerid, 6, PlayerInfo[playerid][pWeapon6], PlayerInfo[playerid][pAmmo6]);
GetPlayerWeaponData(playerid, 7, PlayerInfo[playerid][pWeapon7], PlayerInfo[playerid][pAmmo7]);
GetPlayerWeaponData(playerid, 8, PlayerInfo[playerid][pWeapon8], PlayerInfo[playerid][pAmmo8]);
GetPlayerWeaponData(playerid, 9, PlayerInfo[playerid][pWeapon9], PlayerInfo[playerid][pAmmo9]);
GetPlayerWeaponData(playerid, 10, PlayerInfo[playerid][pWeapon10], PlayerInfo[playerid][pAmmo10]);
GetPlayerWeaponData(playerid, 11, PlayerInfo[playerid][pWeapon11], PlayerInfo[playerid][pAmmo11]);
GetPlayerWeaponData(playerid, 12, PlayerInfo[playerid][pWeapon12], PlayerInfo[playerid][pAmmo12]);
format(query, 700, "UPDATE `players` SET `Weapon1` = '%d', `Ammo1` = '%d', `Weapon2` = '%d', `Ammo2` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon1], PlayerInfo[playerid][pAmmo1], PlayerInfo[playerid][pWeapon2], PlayerInfo[playerid][pAmmo2], ReturnName(playerid));
mysql_query(query);
format(query, 700, "UPDATE `players` SET `Weapon3` = '%d', `Ammo4` = '%d', `Weapon4 = '%d', `Ammo4` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon3], PlayerInfo[playerid][pAmmo3], PlayerInfo[playerid][pWeapon4], PlayerInfo[playerid][pAmmo4], ReturnName(playerid));
mysql_query(query);
format(query, 700, "UPDATE `players` SET `Weapon5` = '%d', `Ammo5` = '%d', `Weapon6 = '%d', `Ammo6` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon5], PlayerInfo[playerid][pAmmo5], PlayerInfo[playerid][pWeapon6], PlayerInfo[playerid][pAmmo6], ReturnName(playerid));
mysql_query(query);
format(query, 700, "UPDATE `players` SET `Weapon7` = '%d', `Ammo7` = '%d', `Weapon8` = '%d', `Ammo8` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon7], PlayerInfo[playerid][pAmmo7], PlayerInfo[playerid][pWeapon8], PlayerInfo[playerid][pAmmo8], ReturnName(playerid));
mysql_query(query);
format(query, 700, "UPDATE `players` SET `Weapon9` = '%d', `Ammo9` = '%d', `Weapon10 = '%d', `Ammo10` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon9], PlayerInfo[playerid][pAmmo9], PlayerInfo[playerid][pWeapon10], PlayerInfo[playerid][pAmmo10], ReturnName(playerid));
mysql_query(query);
format(query, 700, "UPDATE `players` SET `Weapon12` = '%d', `Ammo11` = '%d', `Weapon11` = '%d', `Ammo12` = '%d' WHERE `username` ='%s' ", PlayerInfo[playerid][pWeapon11], PlayerInfo[playerid][pAmmo11], PlayerInfo[playerid][pWeapon12], PlayerInfo[playerid][pAmmo12], ReturnName(playerid));
mysql_query(query);
pawn Код:
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon1],PlayerInfo[playerid][pAmmo1]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon2],PlayerInfo[playerid][pAmmo2]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon3],PlayerInfo[playerid][pAmmo3]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon4],PlayerInfo[playerid][pAmmo4]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon5],PlayerInfo[playerid][pAmmo5]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon6],PlayerInfo[playerid][pAmmo6]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon7],PlayerInfo[playerid][pAmmo7]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon8],PlayerInfo[playerid][pAmmo8]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon9],PlayerInfo[playerid][pAmmo9]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon10],PlayerInfo[playerid][pAmmo10]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon11],PlayerInfo[playerid][pAmmo11]);
GivePlayerWeapon(playerid,PlayerInfo[playerid][pWeapon12],PlayerInfo[playerid][pAmmo12]);