08.05.2016, 16:40
So it would be something like:
Just an example with the givewep command.
PHP Code:
CMD:givewep(playerid, params[])
{
new userid, weaponid, ammo, query[156];
//if(PlayerInfo[playerid][pAdmin] < 4) return SendErrorMessage(playerid, ERROR_ADMIN);
if(sscanf(params, "udI(500)", userid, weaponid, ammo)) return SendSyntaxMessage(playerid, "/givewep [playerid/name] [weaponid] [ammo]");
if(userid == INVALID_PLAYER_ID) return SendErrorMessage(playerid, ERROR_PLAYER);
if(weaponid <= 0 || weaponid > 46 || (weaponid >= 19 && weaponid <= 21)) return SendErrorMessage(playerid, "You have specified an invalid weapon.");
mysql_format(mysql, query, sizeof(query), "DELETE FROM weapons WHERE Slot=%d", GetWeaponSlot(weaponid));
mysql_tquery(mysql, query, "", "");
GivePlayerWeapon(playerid, weaponid, ammo);
SendInfoMessage(playerid, "You have gave %s a %s with %d ammo.", ReturnName(userid, 0), ReturnWeaponName(weaponid), ammo);
return 1;
}