Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.70 KB | None | 0 0
  1. Version =  "1.0"
  2. Author  =  "Perlo_0ung?!"
  3. ModifiedBy = "sneak"
  4. Modname =  "^3Vote Limiter"
  5.  
  6. -- Changelog by sneak
  7. --
  8. -- v1.0
  9. -- Changed version to 1.0
  10. -- Translations to English
  11. -- Fixed grammar mistake "Votelimiter" -> "Vote Limiter"
  12. -- Modified et.G_Print message to include Version variable and "(modified by sneak)"
  13. --global vars
  14. cancel_time_mins = 2
  15. samplerate = 1000 --- don't change
  16.  
  17.  
  18.  
  19. ---------------------------------------don't change
  20. cancel_timer = cancel_time_mins * 60
  21. max_votes = tonumber(et.trap_Cvar_Get( "vote_limit" ))
  22. -------------------------------------------
  23. function et_InitGame( levelTime, randomSeed, restart )
  24.     et.G_Print("[Vote Limiter] Version: "..Version.." (modified by sneak) Loaded\n")
  25.     -- et.RegisterModname(Modname .. " " .. Version)
  26.     et.RegisterModname("^3Vote Limiter 1.0^7")
  27.  
  28.     gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
  29.         vote = {}
  30.         vote_config = 0
  31.         vote_maprestart = 0
  32.         vote_map = 0
  33.         vote_matchreset = 0
  34.         vote_nextmap = 0   
  35.         vote_surrender = 0
  36.         vote_counter_config = 0
  37.         vote_counter_maprestart = 0
  38.         vote_counter_map = 0
  39.         vote_counter_matchreset = 0
  40.         vote_counter_nextmap = 0   
  41.         vote_counter_surrender = 0
  42. end
  43. function et_RunFrame( levelTime )
  44.     if math.mod(levelTime, samplerate) ~= 0 then return end
  45.         --et.trap_SendServerCommand(-1 , "chat \""..vote_maprestart.."\n\"" )
  46.         --et.trap_SendServerCommand(-1 , "chat \""..vote_counter_maprestart.."\n\"" )
  47. ---------------------------------------------------------------------------------------------------------
  48.         if vote_counter_config > 1 then
  49.         vote_counter_config = vote_counter_config - 1  
  50.         end
  51.         if vote_counter_maprestart > 1 then
  52.         vote_counter_maprestart = vote_counter_maprestart - 1
  53.         end
  54.         if vote_counter_map > 1 then
  55.         vote_counter_map = vote_counter_map + 1
  56.         end
  57.         if vote_counter_matchreset > 1 then
  58.         vote_counter_matchreset = vote_counter_matchreset - 1
  59.         end
  60.         if vote_nextmap > 1 then
  61.         vote_counter_nextmap = vote_counter_nextmap - 1
  62.         end
  63.         if vote_surrender > 1 then
  64.         vote_counter_surrender = vote_counter_surrender - 1
  65.         end
  66. --------------------------------------------------------------------------------------------------------
  67.         if vote_config == 1 then
  68.         vote_config = vote_config + 1  
  69.         end
  70.         if vote_maprestart == 1 then
  71.         vote_maprestart = vote_maprestart + 1
  72.         end
  73.         if vote_map == 1 then
  74.         vote_map = vote_map + 1
  75.         end
  76.         if vote_matchreset == 1 then
  77.         vote_matchreset = vote_matchreset + 1
  78.         end
  79.         if vote_nextmap == 1 then
  80.         vote_nextmap = vote_nextmap + 1
  81.         end
  82.         if vote_surrender == 1 then
  83.         vote_surrender = vote_surrender + 1
  84.         end
  85. ---------------------------------------------------------------------------------------------------------
  86.  
  87.         if vote_config == (cancel_time_mins * 60) or gamestate == 2 then
  88.         vote_config = 0
  89.         end
  90.         if vote_maprestart == (cancel_time_mins * 60) or gamestate == 2  then
  91.         vote_maprestart = 0
  92.         end
  93.         if vote_map == (cancel_time_mins * 60) or gamestate == 2 then
  94.         vote_map = 0
  95.         end
  96.         if vote_matchreset == (cancel_time_mins * 60) or gamestate == 2 then
  97.         vote_matchreset = 0
  98.         end
  99.         if vote_nextmap == (cancel_time_mins * 60) or gamestate == 2 then
  100.         vote_nextmap = 0
  101.         end
  102.         if vote_surrender == (cancel_time_mins * 60) or gamestate == 2 then
  103.         vote_surrender = 0
  104.         end
  105.     end
  106.    
  107. function et_ClientCommand( cno, cmd )
  108.     local entered_command = string.lower(et.trap_Argv(0))
  109.     local entered_argument = string.lower(et.trap_Argv(1))
  110.    if entered_command == "callvote" then
  111.    if tonumber(et.gentity_get(cno, "pers.voteCount")) >= max_votes then return end
  112.       if entered_argument == "config" then
  113.         if vote_config == 0 then
  114.             vote_config = 1
  115.             vote_counter_config = cancel_timer
  116.         elseif vote_config > 1 then
  117.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait ^1"..vote_counter__config.." ^7seconds\n")
  118.         end
  119.       end
  120.      
  121.       if entered_argument == "maprestart" then
  122.         if vote_maprestart == 0 then
  123.           vote_maprestart = 1
  124.           vote_counter_maprestart = cancel_timer
  125.         elseif vote_maprestart > 1 then
  126.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait ^1"..vote_counter_maprestart.." ^7seconds\n")
  127.         end
  128.       end
  129.      
  130.       if entered_argument == "map" then
  131.         if vote_map == 0 then
  132.         vote_map = 1
  133.         vote_counter_map = cancel_timer
  134.         elseif vote_map > 1 then
  135.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait ^1"..vote_counter_map.." ^7seconds\n")
  136.           end
  137.      end
  138.       if entered_argument == "matchreset" then
  139.         if vote_matchreset == 0 then
  140.         vote_matchreset = 1
  141.         vote_counter_matchreset = cancel_timer
  142.         elseif vote_matchreset > 1 then
  143.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait ^1"..vote_counter_matchreset.." ^7seconds\n")
  144.       end
  145.      end
  146.       if entered_argument == "nextmap" then
  147.         if vote_nextmap == 0 then
  148.         vote_nextmap = 1
  149.         vote_counter_nextmap = cancel_timer
  150.         elseif vote_nextmap > 1 then
  151.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait "..vote_counter_nextmap.." ^7seconds\n")
  152.       end
  153.      end
  154.  
  155.       if entered_argument == "surrender" then
  156.        if vote_surrender == 0 then
  157.         vote_surrender = 1
  158.         vote_counter_surrender = cancel_timer
  159.         elseif vote_surrender > 1 then
  160.         et.trap_SendConsoleCommand( et.EXEC_APPEND, "cancelvote ; qsay ^7Voting has been disabled! To vote again wait "..vote_counter_surrender.." ^7seconds\n")
  161.       end
  162.      end
  163.  
  164.    end
  165.    end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement