29.04.2020, 14:01
Quote:
I have a problem compiling my code:
Code:
public OnPlayerSpawn(playerid) { new WQ[256]; mysql_format(Database, WQ, sizeof(WQ), "SELECT `WEAPONID`, `AMMO` FROM `WEAPONDATA` WHERE `ID` = '%d'", pInfo[playerid][ID]); mysql_tquery(Database, WQ, "OnLoadPlayerWeapons", "ii", playerid); return 1; } forward public OnLoadPlayerWeapons(playerid); public OnLoadPlayerWeapons(playerid) { for(new i, j = cache_get_row_count(WQ); i < j; i++) // loop through all the rows that were found { weaponid = cache_get_row_int(i, 0, WQ); ammo = cache_get_row_int(i, 1, WQ); if(!(0 <= weaponid <= 46)) // check if weapon is valid (should be) { printf("[info] Warning: OnLoadPlayerWeapons - Unknown weaponid '%d'. Skipping.", weaponid); continue; } GivePlayerWeapon(playerid, weaponid, ammo); } return; } PHP Code:
|
pawn Code:
// AssignPlayerWeapons
forward AssignPlayerWeapons(playerid);
public AssignPlayerWeapons(playerid)
{
if(!cache_num_rows()) return 0;
new
weaponid,
ammo;
for(new i; i < cache_num_rows(); i++)
{
cache_get_value_name_int(i, "weapon_colum", weaponid);
cache_get_value_name_int(i, "ammo_column", ammo);
if(!(0 <= weaponid <= 46))
{
printf("[info] Warning: OnLoadPlayerWeapons - Unknown weaponid '%d'. Skipping.", weaponid);
continue;
}
GivePlayerWeapon(playerid, weaponid, ammo);
}
return 1;
}