WolfDB

Your Filebase for Games like Return to Castle Wolfenstein , Enemy Territory and more ...

Custom Vote

Show Lua Code
				---------------------------------------------
				--        Edytowany przez mAzak            --
				--       osttnia edycja 04.07.2017         --
				-- Na potrzeby serwera Polska Vodka Silent --
				---------------------------------------------
--[[
	--------------------------------------------------------------------------------------------
	Custom vote script for silEnT Mod (addition to existing voting system)
	--------------------------------------------------------------------------------------------
	Script by .WAR|Geo.
	Customisation of the votes can be done in the config section
	--------------------------------------------------------------------------------------------

	IMPORTANT CVARS:

		"vote_allow_poll"		This MUST be set to "1" in server.cfg, it is essential for this script to function
		"omnibot_enable"		This will be set to "1" in server.cfg if you are using Omni-bot on your server
		"vote_limit"		I recommend you use a value of between 3 or less to avoid multiple votes

	--------------------------------------------------------------------------------------------

]]

	--------------------------------------------------------------------------------------------

	-- CONFIG:	

	-- Change the values below to allow or disallow votes (1 = true, 0 = false) 

	--------------------------------------------------------------------------------------------				

		vote_allow_kickbots		= 1		
		vote_allow_fivemins		= 1
		vote_allow_tenmins		= 1
		vote_allow_quarterbots		= 1		
		vote_allow_halfbots		= 1						
		vote_allow_crazygravityon	= 1
		vote_allow_crazygravityoff	= 1		
		vote_allow_crazyspeed		= 1
		vote_allow_putbotsspec		= 1
		vote_allow_panzerwaron		= 1
		vote_allow_panzerwaroff		= 1		
		vote_allow_sniperwaron		= 1
		vote_allow_sniperwaroff		= 1		
		vote_allow_riflewaron		= 1
		vote_allow_riflewaroff		= 1		
		vote_allow_pistolwaron		= 1
		vote_allow_pistolwaroff		= 1		
		vote_allow_heavyon		= 1
		vote_allow_heavyoff		= 1		
			
	--------------------------------------------------------------------------------------------
	-- Do not edit below this line
	--------------------------------------------------------------------------------------------
	

description = "Custom votes"


function et_InitGame( levelTime, randomSeed, restart)
         local modname = string.format("%s", description)

    	et.G_Print(string.format("%s loaded\n", modname))
   	et.RegisterModname( modname)
	
	sv_maxclients = et.trap_Cvar_Get("sv_maxclients")
		num0 = math.floor(sv_maxclients * 0.25)
		num1 = math.floor(sv_maxclients * 0.5) 

	if vote_allow_kickbots == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_kickbots EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_kickbots EQ 0;")
	end
	
	if vote_allow_fivemins == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_fivemins EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_fivemins EQ 0;")
	end

	if vote_allow_tenmins == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_tenmins EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_tenmins EQ 0;")
	end

	if vote_allow_quarterbots == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_quarterbots EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_quarterbots EQ 0;")
	end

	if vote_allow_halfbots == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_halfbots EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_halfbots EQ 0;")
	end

	if vote_allow_crazygravityon == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazygravityon EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazygravityon EQ 0;")
	end

	if vote_allow_crazygravityoff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazygravityoff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazygravityoff EQ 0;")
	end

	if vote_allow_crazyspeed == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazyspeed EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_crazyspeed EQ 0;")
	end

	if vote_allow_putbotsspec == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_putbotsspec EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_putbotsspec EQ 0; ")
	end

	if vote_allow_panzerwaron == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_panzerwaron EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_panzerwaron EQ 0; ")
	end

	if vote_allow_panzerwaroff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_panzerwaroff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_panzerwaroff EQ 0; ")
	end
	
	if vote_allow_sniperwaron == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_sniperwaron EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_sniperwaron EQ 0; ")
	end
	
	if vote_allow_sniperwaroff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_sniperwaroff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_sniperwaroff EQ 0; ")
	end
	
	if vote_allow_riflerwaron == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_riflewaron EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_riflewaron EQ 0; ")
	end

	if vote_allow_riflerwaroff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_riflewaroff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_riflewaroff EQ 0; ")
	end

	if vote_allow_pirstolwaron == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_pistolwaron EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_pistolwaron EQ 0; ")
	end

	if vote_allow_pirstolwaroff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_pistolwaroff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_pistolwaroff EQ 0; ")
	end

	if vote_allow_heavyon == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_heavyon EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_heavyon EQ 0; ")
	end

	if vote_allow_heavyoff == 1 then
		et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_heavyoff EQ 1;")
	else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_heavyoff EQ 0; ")
	end
end


function et_ClientCommand( clientNum, command)
	command = command:lower()

	if et.trap_Argv(0) == "votes" then

		et.trap_SendServerCommand( clientNum, "print \"\n")
		et.trap_SendServerCommand( clientNum, "print \"^7Custom ^3callvote ^7commands are:\n")
		et.trap_SendServerCommand( clientNum, "print \"^3-----------------------------\n")

	if vote_allow_kickbots == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5kickbots\n")
       	end
	
	if vote_allow_fivemins == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5+5 mins\n")
        	end

	if vote_allow_tenmins == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5+10 mins\n")
	end

	if vote_allow_quarterbots == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^525 percent bots\n")
        	end

	if vote_allow_halfbots == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^550 percent bots\n")
        	end

	if vote_allow_crazygravityon == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5crazygravity ^rON^s\n")
        	end

	if vote_allow_crazygravityoff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5crazygravity ^qOFF^s\n")
        	end

	if vote_allow_crazyspeed == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5crazyspeed\n")
        	end

	if vote_allow_putbotsspec == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5putbotsspec\n")
        	end

	if vote_allow_panzerwaron == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5panzerwar ^rON^s\n")
        	end

	if vote_allow_panzerwaroff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5panzerwar ^qOFF^s\n")
        	end

	if vote_allow_sniperwaron == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5sniperwar ^rON^s\n")
        	end

	if vote_allow_sniperwaroff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5sniperwar ^qOFF^s\n")
        	end


	if vote_allow_riflewaron == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5riflewar ^rON^s\n")
        	end

	if vote_allow_riflewaroff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5riflewar ^qOFF^s\n")
        	end
		
	if vote_allow_pistolwaron == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5pistolwar ^rON^s\n")
        	end

	if vote_allow_pistolwaroff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5pistolwar ^qOFF^s\n")
        	end

	if vote_allow_heavyon == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5heavyweapons ^rON^s\n")
        	end

	if vote_allow_heavyoff == 1 then
		et.trap_SendServerCommand( clientNum, "print \"^5heavyweapons ^qOFF^s\n")
        	end

		et.trap_SendServerCommand( clientNum, "print \"\n")
		et.trap_SendServerCommand( clientNum, "print \"^7Usage: ^3\\callvote poll \n")
        		et.trap_SendServerCommand( clientNum, "print \"\n")

		return 1
	end
end


function et_Print( text)
	
	if string.sub(text,1,19) == "Vote Passed: [poll]" then

		if string.format(text) == "Vote Passed: [poll] kickbots\n" then
			if vote_allow_kickbots == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "bot maxbots -1; bot kickall;")
		end
		return	

		elseif string.format(text) == "Vote Passed: [poll] +5 mins\n" then
			if vote_allow_fivemins == 1 then
				local time = et.trap_Cvar_Get( "timelimit")
				et.trap_Cvar_Set( "timelimit", time + 5)
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] +10 mins\n" then
			if vote_allow_tenmins == 1 then
				local time = et.trap_Cvar_Get( "timelimit")
				et.trap_Cvar_Set( "timelimit", time + 10)
		end
		return	

		elseif string.format(text) == "Vote Passed: [poll] 25 percent bots\n" then
			if vote_allow_quarterbots == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "bot maxbots " ..num0.. ";")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] 50 percent bots\n" then
			if vote_allow_halfbots == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "bot maxbots " ..num1.. ";")
		end
		return		
	
		elseif string.format(text) == "Vote Passed: [poll] crazygravityon\n" then
			if vote_allow_crazygravity == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!crazygravity on\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] crazygravityoff\n" then
			if vote_allow_crazygravity == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!crazygravity off\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] crazyspeed\n" then
			if vote_allow_crazyspeed == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!crazyspeed on\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] putbotsspec\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "exec omnispec.cfg;")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] panzerwaron\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!panzerwar 1\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] panzerwaroff\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!panzerwar 0\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] sniperwaron\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!sniperwar 1\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] sniperwaroff\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!sniperwar 0\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] riflewaron\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!riflewar 1\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] riflewaroff\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!riflewar 0\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] pistolwaron\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!pistolwar 1\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] pistolwaroff\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "!pistolwar 0\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] heavyon\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "g_heavyWeaponRestriction 100\n")
		end
		return

		elseif string.format(text) == "Vote Passed: [poll] heavyoff\n" then
			if vote_allow_putbotsspec == 1 then
				et.trap_SendConsoleCommand( et.EXEC_APPEND, "g_heavyWeaponRestriction 0\n")
		end
		return

		end
       	 end
end



DOWNLOAD

File size: 0 MB

Description:
Custom Vote