Giveweapon issues
#5

Sorry for the double post AGAIN but..

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


Messages In This Thread
Giveweapon issues - by vIBIENNYx - 18.05.2012, 21:47
Re: Giveweapon issues - by vIBIENNYx - 18.05.2012, 22:01
Re: Giveweapon issues - by MP2 - 18.05.2012, 22:04
Re: Giveweapon issues - by vIBIENNYx - 18.05.2012, 22:07
Re: Giveweapon issues - by vIBIENNYx - 18.05.2012, 22:24
AW: Re: Giveweapon issues - by Nero_3D - 18.05.2012, 22:43
Re: AW: Re: Giveweapon issues - by vIBIENNYx - 18.05.2012, 22:57
Re: AW: Re: Giveweapon issues - by vIBIENNYx - 18.05.2012, 23:09
AW: Re: AW: Re: Giveweapon issues - by Nero_3D - 19.05.2012, 01:33
Re: Giveweapon issues - by vIBIENNYx - 19.05.2012, 01:49

Forum Jump:


Users browsing this thread: 2 Guest(s)