Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Startslayvote(id)
- {
- get_players( ga_PlayerID, gi_TotalPlayers )
- for(i=0; i<gi_TotalPlayers; i++)
- {
- new TempID = ga_PlayerID[i]
- if(TempID == id)
- gi_VoteStarter=i
- get_user_name( TempID, ga_PlayerName[i], 31 )
- get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
- get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
- }
- gi_MenuPosition = 0
- ShowSlayPlayerMenu(id)
- return 0
- }
- public ShowSlayPlayerMenu(id)
- {
- new arrayloc = 0
- new keys = (1<<9)
- arrayloc = format(ga_MenuData,(MAX_menudata-1),"\y[HB] Vote Slay^nChoose Player\w ^n^n")
- for(i=0; i<8; i++)
- if( gi_TotalPlayers>(gi_MenuPosition+i) )
- {
- arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
- keys |= (1<<i)
- }
- if( gi_TotalPlayers>(gi_MenuPosition+8) )
- {
- arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. More")
- keys |= (1<<8)
- }
- arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Exit")
- show_menu(id, keys, ga_MenuData, 20, "ChooseSlayPlayer")
- return PLUGIN_HANDLED
- }
- public ChooseSlayMenu(id, key)
- {
- switch(key)
- {
- case 8:
- {
- gi_MenuPosition=gi_MenuPosition+8
- ShowSlayPlayerMenu(id)
- }
- case 9:
- {
- if(gi_MenuPosition>=8)
- {
- gi_MenuPosition=gi_MenuPosition-8
- ShowSlayPlayerMenu(id)
- }
- else
- return 0
- }
- default:
- {
- gi_Sellection=gi_MenuPosition+key
- new Now=get_systime(gi_SysTimeOffset)
- set_pcvar_num(gi_LastTime, Now)
- run_slayvote()
- return 0
- }
- }
- return PLUGIN_HANDLED
- }
- public run_slayvote()
- {
- client_cmd(0, "spk sound/HBMusic/vote.wav")
- log_amx("Vote slay started by %s for %s %s", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
- format(ga_MenuData,(MAX_menudata-1),"\r%s\w wants to slay \r%s\w^nDo you agree?^n^n\r1.\w Yes^n\r2.\w No", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection])
- ga_Choice[0] = 0
- ga_Choice[1] = 0
- show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteSlayMenu" )
- set_task(15.0,"slayoutcom")
- return 0
- }
- public CountSlayVotes(id, key)
- {
- ++ga_Choice[key]
- return PLUGIN_HANDLED
- }
- public slayoutcom()
- {
- new TotalVotes = ga_Choice[0] + ga_Choice[1]
- new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
- if( result >= get_pcvar_float(gf_Ratio) )
- {
- ColorChat(0, GREY, "^x04%s^x03 The vote succeeded, %s is slayed.", prefix, ga_PlayerName[gi_Sellection])
- log_amx("[AMXX] The vote succeeded: %s is slayed.", ga_PlayerAuthID[gi_Sellection])
- ActualSlay(gi_Sellection)
- }
- else
- {
- ColorChat(0, GREY, "^x04%s^x03 The vote did not succeeded!", prefix)
- log_amx("[AMXX] The voteslay did not succeed.")
- }
- ColorChat(0, GREY, "^x04%s^x03 A total of %d players, %d voted yes.", prefix, gi_TotalPlayers, ga_Choice[0])
- return 0
- }
- public ActualSlay(Selected)
- {
- //server_cmd ( "amx_slay ^"%s^"", ga_PlayerAuthID [ Selected ] )
- new slayme [ 50 ]
- format ( slayme, 49, "%s", ga_PlayerAuthID [ Selected ] )
- client_cmd ( slayme, "kill" )
- ColorChat ( 0, GREY, "^4%s^3 >^4 %s^3 < was voteslayed!", prefix, ga_PlayerName [ Selected ] )
- return 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement