| MetalSkater92 |
03-13-2013 00:24 |
[PROBLEM SOLVED] Need help fixing this code
So I am making this plugin, and I get strange compiler errors shown below:
PHP Code:
//amxmodx\scripting\buy2.sma<84> : error 017: undefined symbol "give item"
//amxmodx\scripting\buy2.sma<105> : error 017: undefined symbol "give item"
//amxmodx\scripting\buy2.sma<126> : error 017: undefined symbol "give item"
//amxmodx\scripting\buy2.sma<178> : error 017: undefined symbol "give item"
//amxmodx\scripting\buy2.sma<199> : error 017: undefined symbol "give item"
//amxmodx\scripting\buy2.sma<220> : error 017: undefined symbol "give item"
Here is the plugin code:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#define PLUGIN "Black Market Plugin"
#define VERSION "1.0"
#define AUTHOR "Nemesis"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd( "say /buy2", "CTorT" );
}
public CTorT()
{
new iPlayers[32]
new iNum
new id
get_players( iPlayers, iNum, "a" )
for( new i = 0; i < iNum; i++ )
{
id = iPlayers[i]
if (cs_get_user_team(id) == CS_TEAM_CT)
{
CT(id)
}
else if (cs_get_user_team(id) == CS_TEAM_T)
{
T(id)
}
}
}
public T(id)
{
new menu = menu_create("\yBloodStorm Warfare Black Market", "menu_handlerT");
menu_additem(menu, "\wM4A1 [3100$]", "1", 0);
menu_additem(menu, "\wFamas [2250$]", "2", 0);
menu_additem(menu, "\wAUG [3500$]", "3", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0)
}
public menu_handlerT(id, menu, item, ent)
{
if( item == MENU_EXIT )
{
return;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
menu_destroy(menu);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You must be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 3100))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_M4A1)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bought a M4A1.")
cs_set_user_money(id, cs_get_user_money(id) - 3100)
give_item(id, "weapon_m4a1")
cs_set_user_bpammo( id, CSW_M4A1, 90 )
}
case 2:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You must be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 2250))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_FAMAS)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bought a Famas")
cs_set_user_money(id, cs_get_user_money(id) - 2250)
give_item(id, "weapon_famas")
cs_set_user_bpammo( id, CSW_FAMAS, 90 )
}
case 3:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You must be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 3500))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_AUG)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bought a AUG")
cs_set_user_money(id, cs_get_user_money(id) - 3500)
give_item(id, "weapon_aug")
cs_set_user_bpammo( id, CSW_AUG, 90 )
}
}
}
public CT(id)
{
new menu = menu_create("\yBloodStorm Warfare Black Market", "menu_handlerCT");
menu_additem(menu, "\wAK-47 [2500$]", "1", 0);
menu_additem(menu, "\wGalil [2000$]", "2", 0);
menu_additem(menu, "\wKrieg 552 [4200$]", "3", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0)
}
public menu_handlerCT(id, menu, item, ent)
{
if( item == MENU_EXIT )
{
return;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
menu_destroy(menu);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You have to be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 2500))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_AK47)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bough a AK-47")
cs_set_user_money(id, cs_get_user_money(id) - 2500)
give_item(id, "weapon_ak47")
cs_set_user_bpammo( id, CSW_AK47, 90 )
}
case 2:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You have to be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 2000))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_GALIL)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bough a Galil.")
cs_set_user_money(id, cs_get_user_money(id) - 2000)
give_item(id, "weapon_galil")
cs_set_user_bpammo( id, CSW_GALIL, 90 )
}
case 3:
{
if (!(is_user_alive(id)))
{
client_print(id, print_chat, "You have to be alive to buy this!")
}
if (!(cs_get_user_money(id) >= 4200))
{
client_print(id, print_chat, "You can't afford this weapon!")
}
if (get_user_weapon(id) == CSW_SG550)
{
client_print(id, print_chat, "You already own this weapon!")
}
client_print(id, print_chat, "You bough a Krieg 550.")
cs_set_user_money(id, cs_get_user_money(id) - 4200)
give_item(id, "weapon_sg552")
cs_set_user_bpammo( id, CSW_SG550, 90 )
}
}
}
Any help on this will be appreciated, quite frankly, I can't see what went wrong here. :S
|