Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
|
03-09-2014
, 13:39
[HELP] With The Shop Plugin
|
#1
|
Hi, all!!! All day i'm making this Shop Plugin, but all the time - errors and more errors. I'll post you the code, and if someone could help me, it'll be great!
PHP Code:
#pragma semicolon 1
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <engine> #include <fun> #include <hamsandwich> #include <fakemeta> #include <vault>
// Define the Plugin Version new const VERSION[] = { "1.0" };
// PREFIX new const PREFIX[] = { "^x3[CS-MaxgaminG.iNFO]!n" };
public plugin_init() { register_plugin("HNS Shop", VERSION, "flicker"); RegisterHam(Ham_Spawn, "player", "FwdHamSpawn_Post", 1); RegisterHam(Ham_Item_PreFrame, "player", "FwdPreFrame_Post", 1); RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage"); //RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1); register_event("CurWeapon","event_curweapon","be","1=1"); register_clcmd("say /shop", "cmdVmenu"); register_clcmd("say_team /shop", "cmdVmenu"); //g_pVisiblity = register_cvar( "km_invis", "200" ); // 255 = clearly visible set_task(480.0, "kmodmsg", 0, _, _, "b"); // Ham TakeDamage register_forward( FM_CmdStart, "fw_CmdStart" ); //RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1); }
public cmdVmenu(id) { new menu = menu_create("\yHNS Shop:^n\r", "Vmenu"); menu_additem(menu, "\wAWP", "1", 0); menu_additem(menu, "\wScout", "2", 0); menu_additem(menu, "\wDeagle", "3", 0); menu_additem(menu, "\wAK47", "4", 0); menu_additem(menu, "\wM4A1", "5", 0); menu_additem(menu, "\wHE Grenade", "6", 0); menu_additem(menu, "\wFlashbang", "7", 0); menu_additem(menu, "\wSmoke Grenade", "8", 0); menu_additem(menu, "\w+ 100 Armor", "9", 0); menu_additem(menu, "\w+ 40 Health", "10", 0); menu_display(id, menu); }
public Vmenu(id, menu, item) { new data[6], iName[64]; new access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); new key = str_to_num(data); switch(key) { case 1: { new iMoney = cs_get_user_money(id); new iPrice = 8000; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; cs_set_weapon_ammo(give_item(id, "weapon_awp" ), 1); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gAWP!n", PREFIX); } case 2: { new iMoney = cs_get_user_money(id); new iPrice = 5000; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; cs_set_weapon_ammo(give_item(id, "weapon_scout" ), 1); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gScout!n", PREFIX); } case 3: { new iMoney = cs_get_user_money(id); new iPrice = 6700; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; cs_set_weapon_ammo(give_item(id, "weapon_deagle" ), 1); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gDeagle!n", PREFIX); } case 4: { new iMoney = cs_get_user_money(id); new iPrice = 6700; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; cs_set_weapon_ammo(give_item(id, "weapon_ak47" ), 1); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gAK47!n", PREFIX); } case 5: { new iMoney = cs_get_user_money(id); new iPrice = 6850; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; cs_set_weapon_ammo(give_item(id, "weapon_m4a1" ), 1); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gM4A1!n", PREFIX); } case 6: { new iMoney = cs_get_user_money(id); new iPrice = 5500; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; give_item(id,"weapon_hegrenade"); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gHE Grenade!n", PREFIX); } case 7: { new iMoney = cs_get_user_money(id); new iPrice = 3500; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; give_item(id,"weapon_flashbang"); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gFlashbang!n", PREFIX); } case 8: { new iMoney = cs_get_user_money(id); new iPrice = 4000; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; give_item(id,"weapon_smokegrenade"); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !gSmoke Grenade!n", PREFIX); } case 9: { new iMoney = cs_get_user_money(id); new iPrice = 14000; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) < iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; set_user_armor(id, get_user_armor(id) + 100); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !g100 Armor!n", PREFIX); } case 10: { new iMoney = cs_get_user_money(id); new iPrice = 12500; if (!(is_user_alive(id))) ColorMessage(id, "^1You have to be ^4alive^1 to buy this!"); return PLUGIN_HANDLED; if (!(cs_get_user_money(id) >= iPrice)) ColorMessage(id, "^1You cant ^4afford^1 this weapon!"); return PLUGIN_HANDLED; if (get_user_weapon(id) == CSW_DEAGLE) ColorMessage(id, "^1You ^4already^1 have this weapon!"); return PLUGIN_HANDLED; set_user_health(id, get_user_health(id) + 40); cs_set_user_money(id, iMoney - iPrice); ColorMessage(id, "%s !tTi kupi !g40 HP!n", PREFIX); }
} menu_destroy(menu); return PLUGIN_HANDLED; }
stock ColorMessage(const id, const input[], any:...){ new count = 1, players[32]; static msg[ 191 ]; vformat(msg, 190, input, 3); if (id) players[0] = id; else get_players(players , count , "ch"); { for (new i = 0; i < count; i++){ if (is_user_connected(players[i])){ message_begin(MSG_ONE_UNRELIABLE , get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end();}}} }
There it is. For me, there's no problem. But when i type /shop in the chat, nothing happens.... The plugin is running, but nothing.. PLEASE, HELP!
Last edited by Flick3rR; 03-09-2014 at 13:56.
|
|