[Tutorial] Saving weapon data (MySQL)
#54

Quote:
Originally Posted by Nawickaz
View Post
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;
}
Geting this error:
PHP Code:
E:\Projektai\SAMP\Win servas prog\gamemodes\naujas.pwn(550) : error 017undefined symbol "WQ"
E:\Projektai\SAMP\Win servas prog\gamemodes\naujas.pwn(552) : error 017undefined symbol "cache_get_row_int"
E:\Projektai\SAMP\Win servas prog\gamemodes\naujas.pwn(553) : error 017undefined symbol "cache_get_row_int"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
3 Errors


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;
}
Reply


Messages In This Thread
Saving weapon data (MySQL) - by Vince - 06.04.2014, 20:23
Re: Saving weapon data (MySQL) - by vassilis - 06.04.2014, 20:27
Re: Saving weapon data (MySQL) - by Luis- - 06.04.2014, 21:31
Re: Saving weapon data (MySQL) - by Binx - 06.04.2014, 23:38
Re: Saving weapon data (MySQL) - by iZN - 06.04.2014, 23:40
Re: Saving weapon data (MySQL) - by Luis- - 07.04.2014, 18:03
Re: Saving weapon data (MySQL) - by Vince - 07.04.2014, 18:15
Re: Saving weapon data (MySQL) - by Luis- - 07.04.2014, 20:26
Re: Saving weapon data (MySQL) - by Niko_boy - 08.04.2014, 04:14
Re: Saving weapon data (MySQL) - by dusk - 08.04.2014, 07:05
Re: Saving weapon data (MySQL) - by iRaiDeN - 08.04.2014, 12:25
Re: Saving weapon data (MySQL) - by Type-R - 08.08.2014, 17:20
Re: Saving weapon data (MySQL) - by iFarbod - 14.08.2014, 12:17
Re: Saving weapon data (MySQL) - by Type-R - 15.08.2014, 01:03
Re: Saving weapon data (MySQL) - by Sime30 - 08.02.2015, 21:34
Re: Saving weapon data (MySQL) - by AndySedeyn - 18.06.2015, 18:03
Re: Saving weapon data (MySQL) - by b3nz - 07.07.2015, 20:41
Re: Saving weapon data (MySQL) - by TenTen - 10.07.2015, 01:42
Re: Saving weapon data (MySQL) - by 2KY - 18.07.2015, 00:29
Re: Saving weapon data (MySQL) - by TenTen - 23.07.2015, 01:37
Re: Saving weapon data (MySQL) - by vassilis - 25.11.2015, 15:21
Re: Saving weapon data (MySQL) - by Vince - 25.11.2015, 19:38
Re: Saving weapon data (MySQL) - by vassilis - 26.11.2015, 12:23
Re: Saving weapon data (MySQL) - by vassilis - 05.03.2016, 13:47
Re: Saving weapon data (MySQL) - by SyS - 05.03.2016, 13:53
Re: Saving weapon data (MySQL) - by vassilis - 05.03.2016, 14:11
Re: Saving weapon data (MySQL) - by SyS - 05.03.2016, 14:12
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 02:22
Re: Saving weapon data (MySQL) - by PrO.GameR - 08.05.2016, 10:11
Re: Saving weapon data (MySQL) - by Konstantinos - 08.05.2016, 11:19
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 16:40
Re: Saving weapon data (MySQL) - by Konstantinos - 08.05.2016, 16:52
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 17:50
Re: Saving weapon data (MySQL) - by Konstantinos - 08.05.2016, 18:23
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 18:54
Re: Saving weapon data (MySQL) - by Vince - 08.05.2016, 19:41
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 20:34
Re: Saving weapon data (MySQL) - by vernz - 08.05.2016, 21:37
Re: Saving weapon data (MySQL) - by Richie© - 08.05.2016, 21:54
Re: Saving weapon data (MySQL) - by vernz - 09.05.2016, 18:14
Re: Saving weapon data (MySQL) - by oMa37 - 02.07.2016, 16:27
Re: Saving weapon data (MySQL) - by Konstantinos - 02.07.2016, 16:45
Re: Saving weapon data (MySQL) - by dragondex - 11.08.2016, 12:29
Re: Saving weapon data (MySQL) - by knuckleduster5 - 10.12.2016, 09:50
Re: Saving weapon data (MySQL) - by X337 - 10.12.2016, 09:52
Re: Saving weapon data (MySQL) - by knuckleduster5 - 10.12.2016, 10:10
Re: Saving weapon data (MySQL) - by X337 - 10.12.2016, 12:26
Re: Saving weapon data (MySQL) - by nikotragedy - 04.03.2017, 07:18
Re: Saving weapon data (MySQL) - by JustNothing - 04.04.2017, 14:12
Re: Saving weapon data (MySQL) - by Kane - 15.04.2017, 00:50
Re: Saving weapon data (MySQL) - by OuDayas - 29.01.2019, 12:41
Re: Saving weapon data (MySQL) - by Nawickaz - 12.01.2020, 17:16
Re: Saving weapon data (MySQL) - by Arramis - 29.04.2020, 13:58
Re: Saving weapon data (MySQL) - by Art - 29.04.2020, 14:01
Re: Saving weapon data (MySQL) - by MrCesar - 29.04.2020, 14:02
Re: Saving weapon data (MySQL) - by tuss - 29.04.2020, 21:54
Re: Saving weapon data (MySQL) - by JacksonWhite - 31.05.2020, 14:04

Forum Jump:


Users browsing this thread: 4 Guest(s)