Salvamento de slots
#9

+rep Felipe Alves, vocк me deu a luz pra conseguir! Deixei assim:

Код:
SaveArmas(playerid){

	new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));


	new weaponid[13], ammo[13], query[999];
    for(new i; i < 13; i++){
        GetPlayerWeaponData(playerid, i, weaponid[i], ammo[i]);
        if(cache_num_rows() >= 0){
        	mysql_format(dbHandle, query, sizeof(query), "UPDATE characters SET weapon%d = '%d', ammo%d = '%d' WHERE char_name = '%s'", i, weaponid[i], i, ammo[i], PlayerInfo[playerid][pCharacterName]);
        	mysql_tquery(dbHandle, query);
        }
        else
        {
			mysql_format(dbHandle, query, sizeof(query), "INSERT INTO characters (weapon1, ammo1, weapon2, ammo2, weapon3, ammo3, weapon4, ammo4, weapon5, ammo5, weapon6, ammo6, weapon7, ammo7, weapon8, ammo8, weapon9, ammo9, weapon10, ammo10, weapon11, ammo11, weapon12, ammo12) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d') WHERE char_name = '%s'",
        	weaponid[1], ammo[1], weaponid[2], ammo[2], weaponid[3], ammo[3], weaponid[4], ammo[4], weaponid[5], ammo[5], weaponid[6], ammo[6], weaponid[7], ammo[7], weaponid[8], ammo[8], weaponid[9], ammo[9], weaponid[10], ammo[10], weaponid[11], ammo[11], weaponid[12], ammo[12], Nome);
        	mysql_tquery(dbHandle, query);
		}
    }
    return 1;
}
Reply


Messages In This Thread
Salvamento de slots - by Diggie - 14.08.2018, 01:32
Re: Salvamento de slots - by Felipealves - 14.08.2018, 11:13
Re: Salvamento de slots - by DelK - 14.08.2018, 18:07
Re: Salvamento de slots - by Felipealves - 14.08.2018, 18:44
Re: Salvamento de slots - by DelK - 14.08.2018, 19:34
Re: Salvamento de slots - by Felipealves - 14.08.2018, 19:47
Re: Salvamento de slots - by Diggie - 14.08.2018, 20:16
Re: Salvamento de slots - by Felipealves - 14.08.2018, 22:28
Re: Salvamento de slots - by Diggie - 14.08.2018, 23:25

Forum Jump:


Users browsing this thread: 3 Guest(s)