zzx Posted March 8, 2014 Share Posted March 8, 2014 Hey guys, I just ahve a code that makes the map restart itself by voting when everybody die. find me the problem guys please. addCommandHandler("redo", function() if not i then i = 0 end if i >= 4 then outputChatBox("[REDO]: Die Map wird bereits wiederholt!", root,0,125,0) else i = i + 1 end if i == 3 then outputChatBox("[REDO]: "..getPlayerName(source).." vote for redo! ["..i.."/3]",root,0,125,0) outputChatBox("[REDO]: Map will be restarted!",root,0,125,0) g_ForcedNextMap = currentMap setTimer(function() i = 0 end, 150*1000,1) elseif i <= 2 then outputChatBox("[REDO]: "..getPlayerName(source).." vote for redo! ["..i.."/3]",root,0,125,0) end end) Link to comment
TAPL Posted March 8, 2014 Share Posted March 8, 2014 addCommandHandler("redo", function(source) if not i then i = 0 end if i >= 4 then outputChatBox("[REDO]: Die Map wird bereits wiederholt!", root,0,125,0) else i = i + 1 end if i == 3 then outputChatBox("[REDO]: "..getPlayerName(source).." vote for redo! ["..i.."/3]",root,0,125,0) outputChatBox("[REDO]: Map will be restarted!",root,0,125,0) g_ForcedNextMap = currentMap setTimer(function() i = 0 end, 150*1000,1) elseif i <= 2 then outputChatBox("[REDO]: "..getPlayerName(source).." vote for redo! ["..i.."/3]",root,0,125,0) end end) Link to comment
zzx Posted March 8, 2014 Author Share Posted March 8, 2014 Nothing happened, or i don't know the command. Do i have to put client side as well? i only use server side and meta.xml to this script. Link to comment
.:HyPeX:. Posted March 8, 2014 Share Posted March 8, 2014 Nothing happened, or i don't know the command. Do i have to put client side as well? i only use server side and meta.xml to this script. is this inside the race resource? if no then you should make a trigger to it or add the script there, you cant use global variables from other resources. You should also note that if you have any map buying system you should make the code over that basis. Link to comment
zzx Posted March 8, 2014 Author Share Posted March 8, 2014 (edited) hypex, No it's not in the race resource, is there any mistake in the script? And pls write me the steps how to install it, and you know... Edited March 8, 2014 by Guest Link to comment
Discord Moderators Megadreams Posted March 8, 2014 Discord Moderators Share Posted March 8, 2014 Is the variable"i" a global variable? If so i'd rename it to something more understandable. Also because "i" is often used as a iterator in a for loop. Link to comment
.:HyPeX:. Posted March 8, 2014 Share Posted March 8, 2014 hypex, No it's not in the race resource, is there any mistake in the script?And pls write me the steps how to install it, and you know... you should note that g_ForcedNextMap is a variable inside the race wich you cant modify from outside of it. (it is even only modified from the actually core script of the race.) Is the variable"i" a global variable? If so i'd rename it to something more understandable. Also because "i" is often used as a iterator in a for loop. Umm drop it, he's just using a random variable as a way to count. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now