Member
|
![Old](images/statusicon/post_old.svg)
12-13-2016
, 20:20
Adding new Weapon on Shopmenu !
|
#1
|
Hello everyone with help of some people here i made this shop plugin for my ZE Sever on cs 1.6 , i want to add a different weapon on shop , i searched on forum and i tried for 3hours but no result till now , i think im making mistakes but i cant find them , can anyone add a weapon named "Monster Weapon" or add GoldenAK please i need this , just put this weapon then i will know how to include other weapons .
SMA
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <Protektion>
#define PLUGIN " ZE ShopMenu"
#define VERSION "1.0"
#define AUTHOR "AlliedModders"
#define TASK_INVISIBILITY 2002101
new para_ent[33];
new cash[33];
new bool:parachute[33],bool:UnlAmmo[33]
public plugin_init()
{
ScrappeR_Protektion()
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_Killed, "player", "ham_Player_Killed_Pre", 0 )
RegisterHam(Ham_Spawn,"player","FwSpawn",1)
register_forward(FM_PlayerPreThink, "FWD_ParachutePreThink")
register_event("CurWeapon" , "event_CurWeapon" , "be" , "1=1")
register_clcmd("say shop", "cmdShop", 0);
register_clcmd("say /shop", "cmdShop", 0);
}
public plugin_precache()
{
precache_model("models/parachute.mdl")
}
public FwSpawn(id)
{
if(is_user_alive(id))
{
parachute[id] = false
set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0 )
UnlAmmo[id] = false
}
}
public cmdShop(id)
{
new menu = menu_create("\rZombieEscape Human ShopMenu", "cmdShop_handler");
menu_additem(menu, "\wHE Grenade [800$]", "1", 0);
menu_additem(menu, "\wFlash Grenade [800$]", "2", 0);
menu_additem(menu, "\wSmoke Grenade [800$]", "3", 0);
menu_additem(menu, "\wDeagle [4000$]", "4", 0);
menu_additem(menu, "\wSpeed [12000$]", "5", 0);
menu_additem(menu, "\wHealth [5000$] \d(+1500HP)", "6", 0);
menu_additem(menu, "\wGravity [7000$]", "7", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public cmdShop_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
cash[id] = cs_get_user_money(id);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if(cash[id] >= 800)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere HE Nade , You have bought He Nade.");
cs_set_user_money(id, cash[id] - 800);
give_item(id, "weapon_hegrenade");
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 2:
{
if(cash[id] >= 800)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Flash Nade , You have bought Flash Nade.");
cs_set_user_money(id, cash[id] - 800);
give_item(id, "weapon_flashbang");
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 3:
{
if(cash[id] >= 800)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Smoke Nade , You have bought Smoke Nade.");
cs_set_user_money(id, cash[id] - 800);
give_item(id, "weapon_smokegrenade");
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 4:
{
if(cash[id] >= 4000)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Deagle , You have bought Deagle.");
cs_set_user_money(id, cash[id] - 4000);
give_item(id, "weapon_deagle");
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 5:
{
if(cash[id] >= 12000)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Speed , You have bought Speed.");
cs_set_user_money(id, cash[id] - 12000);
set_user_maxspeed(id,get_user_maxspeed(id) + 75.0);
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 6:
{
if(cash[id] >= 4000)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Health , You have bought Health.");
cs_set_user_money(id, cash[id] - 4000);
set_user_health(id,get_user_health(id) + 1500);
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
case 7:
{
if(cash[id] >= 7000)
{
if ( cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id, print_chat, "Ti ke blere Gravity , You have bought Gravity.");
cs_set_user_money(id, cash[id] - 7000);
set_user_gravity(id, 0.45);
}
}
else
{
client_print(id, print_chat, "Nuk ke para te mjaftueshme , You Dont have Enough Money");
}
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public event_CurWeapon(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE;
if(UnlAmmo[id])
{
static wpnid, clip;
wpnid = read_data(2);
clip = read_data(3);
give_ammo(id , wpnid , clip);
}
return PLUGIN_CONTINUE;
}
public give_ammo(id , wpnid , clip)
{
if(!is_user_alive(id))
return;
if( wpnid==CSW_C4 ||
wpnid==CSW_KNIFE ||
wpnid==CSW_HEGRENADE ||
wpnid==CSW_SMOKEGRENADE ||
wpnid==CSW_FLASHBANG )
return;
if(!clip)
{
static weapname[33];
get_weaponname(wpnid , weapname , 32);
static wpn
wpn = -1;
while((wpn = find_ent_by_class(wpn , weapname)) != 0)
{
if(id == entity_get_edict(wpn , EV_ENT_owner))
{
cs_set_weapon_ammo(wpn , maxclip(wpnid))
break;
}
}
}
}
stock maxclip(wpnid)
{
static ca;
ca = 0;
switch (wpnid)
{
case CSW_P228 : ca = 13;
case CSW_SCOUT : ca = 10;
case CSW_HEGRENADE : ca = 0;
case CSW_XM1014 : ca = 7;
case CSW_C4 : ca = 0;
case CSW_MAC10 : ca = 30;
case CSW_AUG : ca = 30;
case CSW_SMOKEGRENADE : ca = 0;
case CSW_ELITE : ca = 15;
case CSW_FIVESEVEN : ca = 20;
case CSW_UMP45 : ca = 25;
case CSW_SG550 : ca = 30;
case CSW_GALI : ca = 35;
case CSW_FAMAS : ca = 25;
case CSW_USP : ca = 12;
case CSW_GLOCK18 : ca = 20;
case CSW_AWP : ca = 10;
case CSW_MP5NAVY : ca = 30;
case CSW_M249 : ca = 100;
case CSW_M3 : ca = 8;
case CSW_M4A1 : ca = 30;
case CSW_TMP : ca = 30;
case CSW_G3SG1 : ca = 20;
case CSW_FLASHBANG : ca = 0;
case CSW_DEAGLE : ca = 7;
case CSW_SG552 : ca = 30;
case CSW_AK47 : ca = 30;
case CSW_P90 : ca = 50;
}
return ca;
}
public InvNone(id)
{
id -= TASK_INVISIBILITY
set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0 )
}
public ham_Player_Killed_Pre( iVictim, iKiller, iShouldGib )
{
if( !is_user_connected( iVictim ) )
return HAM_IGNORED;
if(task_exists(iVictim + TASK_INVISIBILITY))
remove_task(iVictim + TASK_INVISIBILITY)
return HAM_IGNORED
}
public FWD_ParachutePreThink(id)
{
if(is_user_alive(id) && parachute[id])
{
if (get_user_button(id) & IN_USE )
{
if ( !( get_entity_flags(id) & FL_ONGROUND ) )
{
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if(velocity[2] < 0)
{
if (para_ent[id] == 0)
{
para_ent[id] = create_entity("info_target")
if (para_ent[id] > 0)
{
entity_set_model(para_ent[id], "models/parachute.mdl")
entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(para_ent[id], EV_ENT_aiment, id)
}
}
if (para_ent[id] > 0)
{
velocity[2] = (velocity[2] + 150.0 < -50) ? velocity[2] + 150.0 : -50.0
entity_set_vector(id, EV_VEC_velocity, velocity)
if (entity_get_float(para_ent[id], EV_FL_frame) < 0.0 || entity_get_float(para_ent[id], EV_FL_frame) > 254.0)
{
if (entity_get_int(para_ent[id], EV_INT_sequence) != 1)
{
entity_set_int(para_ent[id], EV_INT_sequence, 1)
}
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
}
else
{
entity_set_float(para_ent[id], EV_FL_frame, entity_get_float(para_ent[id], EV_FL_frame) + 1.0)
}
}
}
else
{
if (para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
else
{
if (para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
else if (get_user_oldbutton(id) & IN_USE)
{
if (para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
return PLUGIN_CONTINUE
}
Model of weapon
Last edited by E.bo; 12-14-2016 at 10:08.
|
|