How would I create a mysql weapon system
#7

The code from the thread:

PHP код:
public OnLoadPlayerWeapons(playerid)
{
    new
        
weaponid,
        
ammo;
    
    for(new 
icache_get_row_count(userDB); ji++) // loop through all the rows that were found
    
{
        
weaponid     cache_get_row_int(i0userDB);
        
ammo        cache_get_row_int(i1userDB);
        
        if(!(
<= weaponid <= 46)) // check if weapon is valid (should be)
        
{
            
printf("[info] Warning: OnLoadPlayerWeapons - Unknown weaponid '%d'. Skipping."weaponid);
            continue;
        }
        
        
GivePlayerWeapon(playeridweaponidammo); 
    }
    return;

You have weaponid and ammo, so determine the slot from the weaponid and insert that into the array.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)