[Tutorial] Saving weapon data (MySQL)
#31

So it would be something like:

PHP Code:
CMD:givewep(playeridparams[])
{
    new 
useridweaponidammoquery[156];
    
//if(PlayerInfo[playerid][pAdmin] < 4) return SendErrorMessage(playerid, ERROR_ADMIN);
    
if(sscanf(params"udI(500)"useridweaponidammo)) return SendSyntaxMessage(playerid"/givewep [playerid/name] [weaponid] [ammo]");
    if(
userid == INVALID_PLAYER_ID) return SendErrorMessage(playeridERROR_PLAYER);
    if(
weaponid <= || weaponid 46 || (weaponid >= 19 && weaponid <= 21)) return SendErrorMessage(playerid"You have specified an invalid weapon.");
    
mysql_format(mysqlquerysizeof(query), "DELETE FROM weapons WHERE Slot=%d"GetWeaponSlot(weaponid));
    
mysql_tquery(mysqlquery"""");
    
GivePlayerWeapon(playeridweaponidammo);
    
SendInfoMessage(playerid"You have gave %s a %s with %d ammo."ReturnName(userid0), ReturnWeaponName(weaponid), ammo);
    return 
1;

Just an example with the givewep command.
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: 9 Guest(s)