23.06.2015, 13:59
I followed this to make it https://sampforum.blast.hk/showthread.php?tid=505081
got the storing part but it won't load.
got the storing part but it won't load.
SELECT weaponid, ammo FROM player_weapons WHERE userid = %d;
stock OnLoadPlayerWeapons(playerid)
{
new
weaponid,
ammo,
mysqlquery[124];
mysql_format(g_SQL, mysqlquery, sizeof(mysqlquery), "select weaponid, ammo from weapons where name id = %d;", PlayerInfo[playerid][pID]);
print(mysqlquery);
mysql_pquery(g_SQL, mysqlquery);
for(new i, j = cache_get_row_count(g_SQL); i < j; i++) // loop through all the rows that were found
{
weaponid = cache_get_row_int(i, 0, g_SQL);
ammo = cache_get_row_int(i, 1, g_SQL);
printf("weaponid = %d , Ammo = %d",weaponid,ammo);
if(!(0 <= weaponid <= 46)) // check if weapon is valid (should be)
{
printf("[info] Warning: OnLoadPlayerWeapons - Unknown weaponid '%d'. Skipping.", weaponid);
continue;
}
GivePlayerWeaponEx(playerid, weaponid, ammo);
}
return;
}
select weaponid, ammo from weapons where name id = 1; //should be fine
Код:
select weaponid, ammo from weapons where name id = 1; //should be fine |
mysql_format(g_SQL, query, sizeof(query), "UPDATE players SET lastattacked=%s,speedoactive=%d,speedinkilometer=%d,skill=%d,vehiclesstolen=%d,gender=%d,fightstyle=%d WHERE id = %d LIMIT 1",
PlayerInfo[playerid][pLastAttacked],PlayerInfo[playerid][pSpeedoActive],PlayerInfo[playerid][pSpeedInKiloMeter],PlayerInfo[playerid][pSkill],PlayerInfo[playerid][pVehiclesStolen],PlayerInfo[playerid][pGender],PlayerInfo[playerid][pFightStyle],PlayerInfo[playerid][pID]);
mysql_tquery(g_SQL, query);