Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- #include < engine >
- #include < fakemeta_util >
- #include < cstrike >
- #include < colorchat>
- #define PLUGIN "Bonus Box v2"
- #define VERSION "1.0"
- #define AUTHOR "MegastorM"
- #define TASK_BONUS 1234
- new modell[] = { "models/box/w_bonus.mdl" }
- new const szPrefix[15] = "[Bonus Box v2]"
- new g_sprite
- new Float:OriginZrtve[3], Float:Uglovi[3]
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_event("DeathMsg", "event_death", "ade");
- register_touch("BonusBox", "player", "touchbox");
- // Add your code here...
- }
- public plugin_precache()
- {
- precache_model(modell)
- g_sprite = precache_model("sprites/box/box_sprite.spr")
- precache_sound("box/supplybox.wav")
- precache_sound("box/touched.wav")
- }
- public event_death()
- {
- new victim = read_data(2)
- if(is_user_connected(victim))
- {
- get_origin(victim)
- set_task(0.1,"create_bonusbox",TASK_BONUS)
- }
- }
- public get_origin(id)
- {
- pev(id, pev_origin, OriginZrtve)
- pev(id, pev_angles, Uglovi)
- Uglovi[0] = 0.0
- }
- public create_bonusbox()
- {
- new ent = create_entity("info_target")
- entity_set_origin(ent, OriginZrtve)
- entity_set_string(ent, EV_SZ_classname, "BonusBox")
- entity_set_model(ent, modell)
- set_rendering ( ent, kRenderFxGlowShell, random_num(128,255),random_num(128,255),random_num(128,255), kRenderFxNone, 255 )
- emit_sound(ent, CHAN_ITEM, "box/supplybox.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
- entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
- entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP)
- entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
- drop_to_floor(ent)
- engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, OriginZrtve, 0)
- write_byte(TE_BEAMCYLINDER) // TE id
- engfunc(EngFunc_WriteCoord, OriginZrtve[0]) // x
- engfunc(EngFunc_WriteCoord, OriginZrtve[1]) // y
- engfunc(EngFunc_WriteCoord, OriginZrtve[2]) // z
- engfunc(EngFunc_WriteCoord, OriginZrtve[0]) // x axis
- engfunc(EngFunc_WriteCoord, OriginZrtve[1]) // y axis
- engfunc(EngFunc_WriteCoord, OriginZrtve[2]+385.0) // z axis
- write_short(g_sprite) // sprite
- write_byte(0) // startframe
- write_byte(0) // framerate
- write_byte(4) // life
- write_byte(30) // width
- write_byte(0) // noise
- write_byte(250) // red
- write_byte(0) // green
- write_byte(0) // blue
- write_byte(200) // brightness
- write_byte(0) // speed
- message_end()
- }
- public touchbox(ent, toucher)
- {
- if (!is_user_alive(toucher) || !pev_valid(ent))
- return FMRES_IGNORED
- new classname[32]
- pev(ent, pev_classname, classname, 31)
- if (!equal(classname, "BonusBox"))
- return FMRES_IGNORED
- meni_za_potvrdu(toucher)
- emit_sound(toucher, CHAN_ITEM, "box/touched.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
- set_pev(ent, pev_effects, EF_NODRAW)
- set_pev(ent, pev_solid, SOLID_NOT)
- remove_ent(ent)
- return FMRES_IGNORED
- }
- public meni_za_potvrdu(id)
- {
- new szItem[32]
- new menu = menu_create("Da li zelis random item iz kutije?","Box_H");
- formatex(szItem,charsmax(szItem),"\yDa")
- menu_additem(menu, szItem)
- formatex(szItem,charsmax(szItem),"\dNe")
- menu_additem(menu,szItem)
- menu_display(id,menu);
- }
- public Box_H(id, menu, item)
- {
- switch(item)
- {
- case 0:
- {
- switch(random_num(1, 13))
- {
- case 1:
- {
- set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
- fm_give_item(id, "weapon_deagle")
- cs_set_user_bpammo(id, CSW_DEAGLE,35)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 Desert Eagle+Aura",szPrefix)
- }
- case 2:
- {
- fm_give_item(id, "weapon_ak47")
- cs_set_user_bpammo(id, CSW_AK47,90)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 AK47",szPrefix)
- }
- case 3:
- {
- fm_give_item(id, "weapon_m4a1")
- cs_set_user_bpammo(id, CSW_M4A1,90)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 M4A1",szPrefix)
- }
- case 4:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
- }
- case 5:
- {
- fm_give_item(id, "weapon_sg550")
- cs_set_user_bpammo(id, CSW_SG550,90)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 SG550",szPrefix)
- }
- case 6:
- {
- fm_give_item(id, "weapon_g3sg1")
- cs_set_user_bpammo(id, CSW_G3SG1,90)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 G3SG1",szPrefix)
- }
- case 7:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
- }
- case 8:
- {
- fm_set_user_health(id, get_user_health(id)+250)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +250HP",szPrefix)
- }
- case 9:
- {
- fm_set_user_health(id, get_user_health(id)+500)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +500HP",szPrefix)
- }
- case 10:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,nisi dobio nista,vise srece sledeci put",szPrefix)
- }
- case 11:
- {
- cs_set_user_money(id, cs_get_user_money(id)+1000)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +1000$",szPrefix)
- }
- case 12:
- {
- cs_set_user_money(id, cs_get_user_money(id)+5000)
- ColorChat(id, TEAM_COLOR, "^4%s^1 dobio si^3 +5000$",szPrefix)
- }
- case 13:
- {
- cs_set_user_money(id, 0)
- ColorChat(id, TEAM_COLOR, "^4%s^1 Nazalost,izgubio si^3 sve pare",szPrefix)
- }
- }
- }
- case 1:
- {
- switch(random_num(1,3))
- {
- case 1:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Sledeci put prihvati bonus iz kutije!",szPrefix)
- }
- case 2:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Ne boj se,neces umreti ako prihvatis bonus!",szPrefix)
- }
- case 3:
- {
- ColorChat(id, TEAM_COLOR, "^4%s^1 Nisi prihvatio bonus tako da nisi ni nagradjen!",szPrefix)
- }
- }
- }
- }
- return PLUGIN_CONTINUE;
- }
- public remove_ent(ent)
- {
- if (pev_valid(ent))
- engfunc(EngFunc_RemoveEntity, ent)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement