AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   weapongiver generic errors (compiler error 088 and 017) [solved] (https://forums.alliedmods.net/showthread.php?t=236643)

KneeGrow 03-08-2014 16:05

weapongiver generic errors (compiler error 088 and 017) [solved]
 
What I wanted to do, after giving my first shot at pawn, was have a command that will give you a weapon if you enter in a certain number
e.g. amx_giveweapon <playername> 3 - you'll be given a magnum
I have compared this code to other people's code but I can't find the problem.
I wanted to use this code for Sven Coop

Code:

#include <amxmodx>
#include <fun>

#define PLUGIN "giveWeapon"
#define VERSION "1.0"
#define AUTHOR "KneeGrow"

public plugin_init(){
        register_plugin(PLUGIN,VERSION,AUTHOR);
        register_concmd("amx_giveweapon","giveWeapon",ADMIN_KICK,"<target> <weaponid> enter 0-4");
}
public giveWeapon(id,wid){
        if(wid==0){
                give_item(id,weapon_shotgun);
                return PLUGIN_HANDLED;
        } else if(wid==1){
                give_item(id,weapon_9mmhandgun);
                return PLUGIN_HANDLED;
        } else if(wid==2){
                give_item(id,weapon_mp5);
                return PLUGIN_HANDLED;
        } else if(wid==3){
                give_item(id,weapon_357);
                return PLUGIN_HANDLED;
        } else if(wid==4){
                give item(id,weapon_m249);
                return PLUGIN_HANDLED;
        } else {
                console_print(id,"out of range, 0-4 only");
        }
        return PLUGIN_HANDLED;
}

After compiling, if this matters to you guys, because I can't decipher this
weapongiver.sma(14) : error 017: undefined symbol "weapon_shotgun"
weapongiver.sma(14) : error 088: number of arguments does not match definition
weapongiver.sma(17) : error 017: undefined symbol "weapon_9mmhandgun"
weapongiver.sma(17) : error 088: number of arguments does not match definition
weapongiver.sma(20) : error 017: undefined symbol "weapon_mp5"
weapongiver.sma(20) : error 088: number of arguments does not match definition
weapongiver.sma(23) : error 017: undefined symbol "weapon_357"
weapongiver.sma(23) : error 088: number of arguments does not match definition
weapongiver.sma(26) : error 017: undefined symbol "give"
weapongiver.sma(26) : error 088: number of arguments does not match definition

YamiKaitou 03-08-2014 16:23

Re: weapongiver generic errors (undefined symbol....)
 
The weapon names are strings, not variables
You forgot an Underscore between give and item

KneeGrow 03-08-2014 16:27

Re: weapongiver generic errors (compiler error 088 and 017)
 
ah good eye there,
I would have probably looked over the code for a long time and would have missed that :s


problem solved, thank you


All times are GMT -4. The time now is 06:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.