Just RP problem
#1

Hello to all !

I have a problem with Just RP gamemode..All is good but Money and experience doesn't save on database..

All thing save but money and experience not..
Everything good in gamemode .. i think database have something..someone know ?
Reply
#2

Post the code that is supposed to save the data...
In addition check your server log if it shows any errors, if so, you should share those, too.
Reply
#3

Код:
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...
Reply
#4

are you sure it assigns the value to the CharacterInfo[playerid][active_character[playerid]][cMoney] variable at all?
If you are not a hundred percent sure, test it with some command and see what it returns...


btw you should use different queries to save all that data, way more overviewable


PS: you actually don't use the ' for numbers and float, only for strings....
so like
Код:
name='%s', money=%d
would be the correct useage
Reply
#5

Don't work...
But i don't know what can have...
When a player register a new account server give him 5k in hand and 8k in bank..
I make a new account, i have 5k hand and 8k in bank..I use /charity 2000 and in hand i have 3k..
i go to the database and there i have 5k and 8k..and in game i have 3k and 8k...
If i use /q and relog,when i enter i have again 5k and 8k..
Reply
#6

is the CharacterInfo[playerid][active_character[playerid]][cMoney] updated when money changes?
Reply
#7

I think yes..
forward GetCash(playerid);
public GetCash(playerid) return CharacterInfo[playerid][active_character[playerid]][cMoney];

I used this gamemode last year and work..now i don't know what can have..
Reply
#8

do you also have a
SetCash?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)