Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.30 KB | None | 0 0
  1. public Startslayvote(id)
  2. {
  3.   get_players( ga_PlayerID, gi_TotalPlayers )
  4.   for(i=0; i<gi_TotalPlayers; i++)
  5.   {
  6.  
  7.     new TempID = ga_PlayerID[i]
  8.  
  9.     if(TempID == id)
  10.       gi_VoteStarter=i
  11.  
  12.     get_user_name( TempID, ga_PlayerName[i], 31 )
  13.     get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
  14.     get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
  15.   }
  16.  
  17.   gi_MenuPosition = 0
  18.   ShowSlayPlayerMenu(id)
  19.   return 0
  20. }
  21.  
  22. public ShowSlayPlayerMenu(id)
  23. {
  24.   new arrayloc = 0
  25.   new keys = (1<<9)
  26.  
  27.   arrayloc = format(ga_MenuData,(MAX_menudata-1),"\y[HB] Vote Slay^nChoose Player\w ^n^n")
  28.   for(i=0; i<8; i++)
  29.    if( gi_TotalPlayers>(gi_MenuPosition+i) )
  30.    {
  31.      arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
  32.      keys |= (1<<i)
  33.    }
  34.   if( gi_TotalPlayers>(gi_MenuPosition+8) )
  35.   {
  36.     arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. More")
  37.     keys |= (1<<8)
  38.   }
  39.   arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Exit")
  40.  
  41.   show_menu(id, keys, ga_MenuData, 20, "ChooseSlayPlayer")
  42.   return PLUGIN_HANDLED
  43. }
  44.  
  45. public ChooseSlayMenu(id, key)
  46. {
  47.   switch(key)
  48.   {
  49.     case 8:
  50.     {
  51.       gi_MenuPosition=gi_MenuPosition+8
  52.       ShowSlayPlayerMenu(id)
  53.     }
  54.     case 9:
  55.     {
  56.       if(gi_MenuPosition>=8)
  57.       {
  58.         gi_MenuPosition=gi_MenuPosition-8
  59.         ShowSlayPlayerMenu(id)
  60.       }
  61.       else
  62.         return 0
  63.     }
  64.     default:
  65.     {
  66.       gi_Sellection=gi_MenuPosition+key
  67.       new Now=get_systime(gi_SysTimeOffset)
  68.       set_pcvar_num(gi_LastTime, Now)
  69.  
  70.       run_slayvote()
  71.       return 0
  72.     }
  73.   }
  74.   return PLUGIN_HANDLED
  75. }
  76.  
  77. public run_slayvote()
  78. {
  79.   client_cmd(0, "spk sound/HBMusic/vote.wav")
  80.   log_amx("Vote slay started by %s for %s %s", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
  81.   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])
  82.   ga_Choice[0] = 0
  83.   ga_Choice[1] = 0
  84.   show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteSlayMenu" )
  85.   set_task(15.0,"slayoutcom")
  86.   return 0
  87. }
  88.  
  89. public CountSlayVotes(id, key)
  90. {
  91.   ++ga_Choice[key]
  92.   return PLUGIN_HANDLED
  93. }
  94.  
  95. public slayoutcom()
  96. {
  97.   new TotalVotes = ga_Choice[0] + ga_Choice[1]
  98.   new Float:result = (float(ga_Choice[0]) / float(TotalVotes))
  99.  
  100.   if( result >= get_pcvar_float(gf_Ratio) )
  101.   {
  102.     ColorChat(0, GREY, "^x04%s^x03 The vote succeeded, %s is slayed.", prefix, ga_PlayerName[gi_Sellection])
  103.     log_amx("[AMXX] The vote succeeded: %s is slayed.", ga_PlayerAuthID[gi_Sellection])
  104.     ActualSlay(gi_Sellection)
  105.   }
  106.   else
  107.   {
  108.     ColorChat(0, GREY, "^x04%s^x03 The vote did not succeeded!", prefix)
  109.     log_amx("[AMXX] The voteslay did not succeed.")
  110.   }
  111.  
  112.   ColorChat(0, GREY, "^x04%s^x03 A total of %d players, %d voted yes.", prefix, gi_TotalPlayers, ga_Choice[0])
  113.  
  114.   return 0
  115. }
  116.  
  117. public ActualSlay(Selected)
  118. {      
  119.     //server_cmd ( "amx_slay ^"%s^"", ga_PlayerAuthID [ Selected ] )
  120.     new slayme [ 50 ]
  121.     format ( slayme, 49, "%s", ga_PlayerAuthID [ Selected ] )
  122.    
  123.     client_cmd ( slayme, "kill" )
  124.     ColorChat ( 0, GREY, "^4%s^3 >^4 %s^3 < was voteslayed!", prefix, ga_PlayerName [ Selected ] )
  125.    
  126.     return 0
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement