18.05.2012, 22:24
Sorry for the double post AGAIN but..
I seem to have fixed it, except with this code:
It won't allow me to search via ID, only by name.. Meaning that well, if someone wants Weapon ID: 5, it will spawn them an MP5, not Weapon ID 5.
I seem to have fixed it, except with this code:
pawn Код:
command(giveweapon, playerid, params[])
{
new sWeapon;
new str[128];
new id, ammo;
if(sscanf(params, "usd[20]", id, params, ammo)) return SendClientMessage(playerid, 0x66666666, "Usage: /giveweapon [Player ID] [Weapon ID] [Ammo] * You can only give 5000 ammo with the weapon *");
{
sWeapon = GetWeaponModelIDFromName(params);
if(sWeapon < 1 || sWeapon > 47) return SendClientMessage(playerid, 0x66666666, "That weapon model or ID doesn't exist.");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x66666666, "That player is not connected.");
if(ammo > 5000 || ammo < 0) return SendClientMessage(playerid, 0x66666666, "You can only give between 1-5000 ammo");
if(playerid == id)
{
format(str, sizeof(str), "You have given yourself a %s [ID %d] with '%d' ammo.", WeaponNames[sWeapon], sWeapon, ammo);
SendClientMessage(id, 0x99000000, str);
GivePlayerWeapon(id, sWeapon, ammo);
}
else
{
format(str, sizeof(str), "You have given %s a '%s [ID %d]' with '%d' ammo.", RemoveUnderScore(id), WeaponNames[sWeapon], sWeapon, ammo);
SendClientMessage(playerid, 0x99000000, str);
format(str, sizeof(str), "You have been given a '%s [ID %d]' with '%d' ammo by %s", WeaponNames[sWeapon], sWeapon, ammo, RemoveUnderScore(playerid));
SendClientMessage(id, 0x99000000, str);
GivePlayerWeapon(id, sWeapon, ammo);
}
}
return 1;
}