Admin command to giveweapon
#7

Ok, so I #include <sscanf2> and I copy/past his code and I got 7 errors!


Vince's code:
pawn Код:
COMMAND:agiveweapon(playerid, params[]) // 4551
{
    if(!logged[playerid])
        return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in!");

    if(PlayerInfo[playerid][pAdmin] < 1)
        return SendClientMessage(playerid, COLOR_BRIGHTRED, "You are not allowed to use that command!");

    new
        targetid = INVALID_PLAYER_ID, // 4560
        weaponid,
        ammo;

    if(sscanf(params, "uii", targetid, weaponid ammo)) // 4564
        return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /agiveweapon [id] [arme] [munitions]");

    if(!IsPlayerConnected(targetid))
    {
        format(string, sizeof(string), "ID:%d is not an active player.", targetid);
        SendClientMessage(playerid, COLOR_BRIGHTRED, string);
        return 1;
    }

    new
        targetName[MAX_PLAYER_NAME],
        weaponName[32];

    GetPlayerName(targetid, targetName, sizeof targetName);
    GetWeaponName(weaponid, weaponName, sizeof weaponName);

    GivePlayerWeapon(targetid, weaponid, ammo);

    format(string, sizeof(string), "You have given %s a %d with %d ammo.", targetName, weaponName, ammo);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}
My errors:
pawn Код:
\pawno\include\sscanf2.inc(27) : error 021: symbol already defined: "sscanf"
\pawno\include\sscanf2.inc(28) : error 021: symbol already defined: "unformat"
(4551) : error 017: undefined symbol "agiveweapon"
(4560) : warning 219: local variable "targetid" shadows a variable at a preceding level
(4564) : error 017: undefined symbol "params"
(4564) : warning 215: expression has no effect
(4564) : error 001: expected token: ";", but found ")"
(4564) : error 029: invalid expression, assumed zero
(4564) : fatal error 107: too many error messages on one line
Reply


Messages In This Thread
[FIXED] Admin command to giveweapon - by Adamsy - 13.08.2016, 13:16
Re: Admin command to giveweapon - by oMa37 - 13.08.2016, 13:49
Re: Admin command to giveweapon - by Adamsy - 13.08.2016, 14:12
Re: Admin command to giveweapon - by Vince - 13.08.2016, 14:21
Re: Admin command to giveweapon - by Adamsy - 13.08.2016, 23:23
Re: Admin command to giveweapon - by Dayrion - 14.08.2016, 00:00
Re: Admin command to giveweapon - by Adamsy - 14.08.2016, 01:48
Re: Admin command to giveweapon - by Shinja - 14.08.2016, 02:46
Re: Admin command to giveweapon - by Adamsy - 14.08.2016, 03:15
Re: Admin command to giveweapon - by Shinja - 14.08.2016, 11:37

Forum Jump:


Users browsing this thread: 1 Guest(s)