Код:
public SaveStats(playerid)
{
SaveLocation(playerid);
SaveWeapons(playerid);
if(!strlen(CharacterInfo[playerid][active_character[playerid]][cRadioAuth])) { format(CharacterInfo[playerid][active_character[playerid]][cRadioAuth],16,"none"); }
new str[1024];
new Float:hp, Float:armor;
new rankname[128];
new radioauth[128];
new crank[32];
new cname[128];
new cleanaccent[16];
mysql_real_escape_string(CharacterInfo[playerid][active_character[playerid]][cName],cname);
mysql_real_escape_string(CharacterInfo[playerid][active_character[playerid]][cCompanyRank],crank);
mysql_real_escape_string(CharacterInfo[playerid][active_character[playerid]][cRankName],rankname);
mysql_real_escape_string(CharacterInfo[playerid][active_character[playerid]][cRadioAuth],radioauth);
mysql_real_escape_string(accent[playerid],cleanaccent);
GetPlayerHealth(playerid,hp);
if(!duty[playerid]) { GetPlayerArmour(playerid,armor); } else { armor = CharacterInfo[playerid][active_character[playerid]][cArmor]; }
if(hp < 10.0) { hp = 10.0; }
format(str,sizeof(str),"UPDATE rp_characters SET name = '%s', money = '%d', spawn_x = '%f', spawn_y = '%f', spawn_z = '%f', spawn_r = '%f', spawn_i = '%d', skin = '%d', renting = '%d', faction = '%d', phone_number = '%d', weapons = '%s', bank = '%d', payday = '%d', faction_perm = '%d', rank_name = '%s', jail_time = '%d', car_lic = '%d', wep_lic = '%d', pay_time = '%d', level = '%d', exp = '%d',melee = '%d', wep1 = '%d', wep2 = '%d', ammo1 = '%d', ammo2 = '%d', spawn_world = '%d'",
CharacterInfo[playerid][active_character[playerid]][cName],
CharacterInfo[playerid][active_character[playerid]][cMoney],
CharacterInfo[playerid][active_character[playerid]][cSpawnX],
CharacterInfo[playerid][active_character[playerid]][cSpawnY],
CharacterInfo[playerid][active_character[playerid]][cSpawnZ],
CharacterInfo[playerid][active_character[playerid]][cSpawnR],
CharacterInfo[playerid][active_character[playerid]][cSpawnI],
CharacterInfo[playerid][active_character[playerid]][cSkin],
CharacterInfo[playerid][active_character[playerid]][cRenting],
CharacterInfo[playerid][active_character[playerid]][cFaction],
CharacterInfo[playerid][active_character[playerid]][cPhone],
CharacterInfo[playerid][active_character[playerid]][cWeapons],
CharacterInfo[playerid][active_character[playerid]][cBank],
CharacterInfo[playerid][active_character[playerid]][cPayday],
CharacterInfo[playerid][active_character[playerid]][cFactionPermissions],
rankname,
CharacterInfo[playerid][active_character[playerid]][cJailTime],
CharacterInfo[playerid][active_character[playerid]][cCarLic],
CharacterInfo[playerid][active_character[playerid]][cWepLic],
CharacterInfo[playerid][active_character[playerid]][cPayTime],
CharacterInfo[playerid][active_character[playerid]][cLevel],
CharacterInfo[playerid][active_character[playerid]][cExp],
CharacterInfo[playerid][active_character[playerid]][cMeleeWep],
GetPrimaryWeapon(playerid),
GetSecondaryWeapon(playerid),
GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm1]),
GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm2]),
CharacterInfo[playerid][active_character[playerid]][cSpawnWorld]);
new str2[1024];
format(str2,sizeof(str2),", rc = '%d', radio_auth = '%s', job = '%d', jcool = '%d', addict = '%d', alvl = '%d', savings = '%d', fly_lic = '%d', health = '%f', armor = '%f', duplicate = '%d', employed = '%d', hotel = '%d', lic_warns = '%d', badge = '%d', ccool = '%d', deaths = '%d', hins = '%d', fstyle = '%d', comp = '%d', comp_perms = '%d', comp_rank = '%s', acc = '%s', lang = '%d', skill = '%d', skill_lvl = '%d', pmodel = '%d', bail = '%d' WHERE id = '%d' LIMIT 1",
CharacterInfo[playerid][active_character[playerid]][cRadioChannel],
radioauth,
CharacterInfo[playerid][active_character[playerid]][cJob],
CharacterInfo[playerid][active_character[playerid]][cJobCooldown],
CharacterInfo[playerid][active_character[playerid]][cAddiction],
CharacterInfo[playerid][active_character[playerid]][cAddictionLevel],
CharacterInfo[playerid][active_character[playerid]][cSavings],
CharacterInfo[playerid][active_character[playerid]][cFlyLic],
hp,
armor,
CharacterInfo[playerid][active_character[playerid]][cDuplicate],
CharacterInfo[playerid][active_character[playerid]][cEmployed],
CharacterInfo[playerid][active_character[playerid]][cHotel],
CharacterInfo[playerid][active_character[playerid]][cCarLicWarnings],
CharacterInfo[playerid][active_character[playerid]][cBadge],
CharacterInfo[playerid][active_character[playerid]][cChopCooldown],
CharacterInfo[playerid][active_character[playerid]][cDeaths],
CharacterInfo[playerid][active_character[playerid]][cHealthInsurance],
CharacterInfo[playerid][active_character[playerid]][cFstyle],
CharacterInfo[playerid][active_character[playerid]][cCompany],
CharacterInfo[playerid][active_character[playerid]][cCompanyPerms],
crank,
cleanaccent,
CharacterInfo[playerid][active_character[playerid]][cLanguage],
CharacterInfo[playerid][active_character[playerid]][cSkill],
CharacterInfo[playerid][active_character[playerid]][cSkillLevel],
CharacterInfo[playerid][active_character[playerid]][cPhoneModel],
CharacterInfo[playerid][active_character[playerid]][cBail],
CharacterInfo[playerid][active_character[playerid]][cID]);
strcat(str,str2);
mysql_query(str,player_save_threads[playerid],QUERY_SAVE_PLAYER);
new str3[256];
format(str3, sizeof(str3), "UPDATE rp_characters SET cFishing = '%d', cDelivery = '%d', cPizza = '%d', cTrucker = '%d', cGarbage = '%d' WHERE ID = '%d' LIMIT 1",
CharacterInfo[playerid][active_character[playerid]][cFish],
CharacterInfo[playerid][active_character[playerid]][cDelivery],
CharacterInfo[playerid][active_character[playerid]][cPizza],
CharacterInfo[playerid][active_character[playerid]][cTrucker],
CharacterInfo[playerid][active_character[playerid]][cGarbage],
CharacterInfo[playerid][active_character[playerid]][cID]);
mysql_query(str3,player_save_threads[playerid],QUERY_SAVE_PLAYER);
format(str,sizeof(str),"UPDATE rp_users SET admin = '%d', jail_time = '%d', tutorial = '%d', assistant = '%d', last_online = NOW(), bikeperm = '%d' WHERE id = '%d'",
AccountInfo[playerid][aAdmin],
AccountInfo[playerid][aJailTime],
AccountInfo[playerid][aTutorial],
AccountInfo[playerid][aAssistant],
AccountInfo[playerid][aBikePerm],
AccountInfo[playerid][aID]);
mysql_query(str,player_threads_alt[playerid]);
}
I have SaveStats at onplayerdisconnect..
I have /refresh , /saveplayer or /savestuff for backup but don't work..
I give In Game 100k, i have 100k and in database at my account i have 5k..money from register...