Nem tudtam tesztelni.
[spoiler]
Kód:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <colorchat>
#define PLUGIN "1v1 terror menu"
#define VERSION "1.0"
#define AUTHOR "HunGamer"
new terrorindex
new ctindex
new bool:granatkor
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "Death", "a")
register_logevent("Event_Roundend", 2, "1=Round_End")
RegisterHam(Ham_Weapon_PrimaryAttack,"weapon_hegrenade","Eldobas", 1)
}
public Death()
{
new tplayers[32], tpnum
get_players(tplayers, tpnum, "aceh", "TERRORIST")
new ctplayers[32], ctpnum
get_players(ctplayers, ctpnum, "aceh", "CT")
if(tpnum == 1 && ctpnum == 1)
{
terrorindex = tplayers[0]
ctindex = ctplayers[0]
lastmenu(terrorindex)
}
return PLUGIN_CONTINUE
}
public Event_Roundend()
{
granatkor = false
terrorindex = 0
ctindex = 0
}
public lastmenu(id)
{
new iMenu = menu_create("\yVálassz befejezési módot", "lastmenuh")
menu_additem(iMenu, "Normal", "1")
menu_additem(iMenu, "Egy golyos", "2")
menu_additem(iMenu, "Granatos", "3")
menu_additem(iMenu, "Keses", "4")
menu_additem(iMenu, "Ongyilkossag", "5")
menu_additem(iMenu, "Random", "6")
menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}
public lastmenuh(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new Data[6], Name[64]
new Access, Callback
menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
new Key = str_to_num(Data)
switch (Key)
{
case 1:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a normal modot")
ColorChat(ctindex, GREEN, "A terrorista normal modot valasztott")
}
case 2:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad az egy golyo modot")
ColorChat(ctindex, GREEN, "A terrorista egy golyo modot valasztott")
Egygolyo(terrorindex, ctindex)
}
case 3:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a granat modot")
ColorChat(ctindex, GREEN, "A terrorista granat modot valasztott")
Granat(terrorindex, ctindex)
}
case 4:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a kes modot")
ColorChat(ctindex, GREEN, "A terrorista kes modot valasztott")
Keses(terrorindex, ctindex)
}
case 5:
{
ColorChat(terrorindex, GREEN, "Ongyilkos lettel")
ColorChat(ctindex, GREEN, "A terrorista ongyilkos lett")
Ongyilkossag(terrorindex)
}
case 6:
{
switch (random_num(1, 5))
{
case 1:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a normal modot")
ColorChat(ctindex, GREEN, "A terrorista normal modot valasztott")
}
case 2:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad az egy golyo modot")
ColorChat(ctindex, GREEN, "A terrorista egy golyo modot valasztott")
Egygolyo(terrorindex, ctindex)
}
case 3:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a granat modot")
ColorChat(ctindex, GREEN, "A terrorista granat modot valasztott")
Granat(terrorindex, ctindex)
}
case 4:
{
ColorChat(terrorindex, GREEN, "Kivalasztottad a kes modot")
ColorChat(ctindex, GREEN, "A terrorista kes modot valasztott")
Keses(terrorindex, ctindex)
}
case 5:
{
ColorChat(terrorindex, GREEN, "Ongyilkos lettel")
ColorChat(ctindex, GREEN, "A terrorista ongyilkos lett")
Ongyilkossag(terrorindex)
}
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public Egygolyo(terror, ct)
{
strip_user_weapons(terror)
strip_user_weapons(ct)
give_item(terror, "weapon_knife")
give_item(ct, "weapon_knife")
cs_set_weapon_ammo(give_item(terror, "weapon_deagle"), 1)
cs_set_user_bpammo(terror, CSW_DEAGLE, 0)
cs_set_weapon_ammo(give_item(ct, "weapon_deagle"), 1)
cs_set_user_bpammo(ct, CSW_DEAGLE, 0)
return PLUGIN_HANDLED
}
public Granat(terror, ct)
{
strip_user_weapons(terror)
strip_user_weapons(ct)
give_item(terror, "weapon_knife")
give_item(ct, "weapon_knife")
give_item(terror, "weapon_hegrenade")
give_item(ct, "weapon_hegrenade")
granatkor = true
return PLUGIN_HANDLED
}
public Eldobas(weapon_entity)
{
if(!granatkor)
return HAM_IGNORED
static attacker
attacker = get_pdata_cbase(weapon_entity, 41, 4)
give_item(attacker, "weapon_hegrenade")
return HAM_IGNORED
}
public Keses(terror, ct)
{
strip_user_weapons(terror)
strip_user_weapons(ct)
give_item(terror, "weapon_knife")
give_item(ct, "weapon_knife")
return PLUGIN_HANDLED
}
public Ongyilkossag(terror)
{
user_kill(terror)
return PLUGIN_HANDLED
}
[/spoiler]