lua end map
Moderators: Forum moderators, developers
lua end map
i want a lua which ends the map
but not with the timelimit cmd cause i dont want to have timelmit vote activated but a new cmd that ends the map !
greetz crazy
but not with the timelimit cmd cause i dont want to have timelmit vote activated but a new cmd that ends the map !
greetz crazy
- =FF=im2good4u
- Posts: 3821
- Joined: Wed Feb 05, 2003 7:30 am
- Location: The Netherlands, HOLLAND
- Contact:
Re: lua end map
even if u have the vote disabled u cna still do it whit luacrazyfrag wrote:i want a lua which ends the map
but not with the timelimit cmd cause i dont want to have timelmit vote activated but a new cmd that ends the map !
greetz crazy
<a href="http://bunnyherolabs.com/adopt/showpet. ... dQ=="><img src="http://petimage.bunnyherolabs.com/adopt ... Q0dQ==.png" width="80" height="100" border="0"></a>
Re: lua end map
etadmin mod on? If yes just create new rcon cmd with timelimit 1crazyfrag wrote:i want a lua which ends the map
but not with the timelimit cmd cause i dont want to have timelmit vote activated but a new cmd that ends the map !
greetz crazy
in lua:
Code: Select all
function et_ConsoleCommand()
-- use string.lower to catch miscapitalized commands
local command = string.lower(et.trap_Argv(0))
if command == "endmap" then
et.trap_SendConsoleCommand( et.EXEC_APPEND, "timelimit 1\n" )
return 1
else
--for all other commands we return 0
return 0
end
end
wolFTeam.pl
it tried it like this :
i create a callvote button ( callvote map mapend)
lua detectes -> Vote Passed: Change map to mapend -> sets the timelimit to 0.1
dont work
i create a callvote button ( callvote map mapend)
lua detectes -> Vote Passed: Change map to mapend -> sets the timelimit to 0.1
Code: Select all
function et_Print(text)
-- text = "Vote Passed: Change map to mapend"
if text == "Vote Passed: Change map to mapend" then
et.trap_SendConsoleCommand(et.EXEC_NOW, "timelimit 0.1\n")
end
end
eh, what a mess ;pcrazyfrag wrote:it tried it like this :
i create a callvote button ( callvote map mapend)
lua detectes -> Vote Passed: Change map to mapend -> sets the timelimit to 0.1
dont workCode: Select all
function et_Print(text) -- text = "Vote Passed: Change map to mapend" if text == "Vote Passed: Change map to mapend" then et.trap_SendConsoleCommand(et.EXEC_NOW, "timelimit 0.1\n") end end
simply ways:
1) set vote_allow_surrender "1" (u can edit surrender to like end map)
2) set vote_allow_surrender "1" (u can edit surrender to 'end map' + change the cmd to timelimit 1)
wolFTeam.pl
i see u want to do this via menu, so:
1) enable surrender & timelimit vote
2) edit surrender:
to
3) create a lua cmds.lua:
thats it...
btw surrender is working only for one side but executed from rcon the side doesnt matter, i tested it on my server with etadmin mod. You have to just create a cmd:
and add to specified lvl
regards
1) enable surrender & timelimit vote
2) edit surrender:
Code: Select all
BUTTONEXT( 6, 176, WINDOW_WIDTH-12, 14, "SURRENDER", .24, 11, exec "cmd callvote surrender"; uiScript closeingame, voteFlag CV_SVF_SURRENDER )
Code: Select all
BUTTONEXT( 6, 176, WINDOW_WIDTH-12, 14, "END MAP", .24, 11, exec "cmd callvote timelimit 1"; uiScript closeingame, voteFlag CV_SVF_SURRENDER )
Code: Select all
function et_ClientCommand(cno, cmd)
-- start of client's cmds mod:
entered_command = string.lower(et.trap_Argv(0))
entered_argument1 = string.lower(et.trap_Argv(1))
entered_argument2 = string.lower(et.trap_Argv(2))
if entered_command == "callvote" then
if entered_argument1 == "timelimit" then
timel = tonumber(entered_argument2)
if (timel <= 0) or (timel > 1) then
et.trap_SendServerCommand(cno, "cpm \"^1You can vote only for end the map!\n\"" )
return 1
end
elseif entered_argument1 == "surrender" then
et.trap_SendServerCommand(cno, "cpm \"^1You can't vote for this option !\n\"" )
return 1
end
end
return 0
end
btw surrender is working only for one side but executed from rcon the side doesnt matter, i tested it on my server with etadmin mod. You have to just create a cmd:
Code: Select all
end_map = surrender
Code: Select all
end_map
regards
Last edited by Luk4ward on Sun Mar 30, 2008 3:29 pm, edited 1 time in total.
wolFTeam.pl
Luk4ward wrote: 3) create a lua cmds.lua:
Code: Select all
function et_ClientCommand(cno, cmd) -- start of client's cmds mod: entered_command = string.lower(et.trap_Argv(0)) entered_argument1 = string.lower(et.trap_Argv(1)) entered_argument2 = string.lower(et.trap_Argv(2)) if entered_command == "callvote" then if entered_argument1 == "timelimit" then timel = tonumber(entered_argument2) if (timel <= 0) and (timel > 1) then et.trap_SendServerCommand(cno, "cpm "^1You can vote only for end the map!\n"" ) return 1 end elseif entered_argument1 == "surrender" then et.trap_SendServerCommand(cno, "cpm "^1You can't vote for this option !\n"" ) return 1 end end return 0 end
Code: Select all
if (timel <= 0) and (timel > 1) then
Code: Select all
if (timel <= 0) or (timel > 1) then
>>full code
Code: Select all
function et_ClientCommand(cno, cmd)
-- start of client's cmds mod:
entered_command = string.lower(et.trap_Argv(0))
entered_argument1 = string.lower(et.trap_Argv(1))
entered_argument2 = string.lower(et.trap_Argv(2))
if entered_command == "callvote" then
if entered_argument1 == "timelimit" then
timel = tonumber(entered_argument2)
if (timel <= 0) or (timel > 1) then
et.trap_SendServerCommand(cno, "cpm "^1You can vote only for end the map!\n"" )
return 1
end
elseif entered_argument1 == "surrender" then
et.trap_SendServerCommand(cno, "cpm "^1You can't vote for this option !\n"" )
return 1
end
end
return 0
end
actually if you use and... it will never execute... you can't be less then or equal to 0 and greater to 1 at the same time...Goomis wrote:<with "and" between... lua doesn't work properlyCode: Select all
if (timel <= 0) and (timel > 1) then
< must be "or"Code: Select all
if (timel <= 0) or (timel > 1) then
if you use or... it will always execute, so you don't even need the if statement... it will always execute, as you are always lessthen or equal to 0 or greater then 1
i know, i just said it above your post ffs.... . Goomis asked for the help so i looked into code, all the time was thinking about the or, but sent him the code with and. Ofc i know the difference, as soon as i spotted this forgot to correct the code as i said above, so dunno why u r posting all those thingsgotenks wrote:actually if you use and... it will never execute... you can't be less then or equal to 0 and greater to 1 at the same time...Goomis wrote:<with "and" between... lua doesn't work properlyCode: Select all
if (timel <= 0) and (timel > 1) then
< must be "or"Code: Select all
if (timel <= 0) or (timel > 1) then
if you use or... it will always execute, so you don't even need the if statement... it will always execute, as you are always lessthen or equal to 0 or greater then 1
wolFTeam.pl