Drakath Posted December 31, 2013 Posted December 31, 2013 Client: function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) elseif not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe) So if a player has more than 12 kills it outputs "ok". But if he doesn't, nothing happens. Why?
toxicsmoke11 Posted December 31, 2013 Posted December 31, 2013 on line 6 you wrote 'else if' together,maybe that
Chaos Posted December 31, 2013 Posted December 31, 2013 Try that function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) end if not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe)
Chaos Posted December 31, 2013 Posted December 31, 2013 function behehehe() player = localPlayer kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) end if not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe)
Chaos Posted December 31, 2013 Posted December 31, 2013 function behehehe() player = localPlayer kills = getElementData(player,"Zombie kills") if kills > 12 then outputChatBox("ok", 0,255,0) else outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true) end end addCommandHandler("omg", behehehe)
Drakath Posted December 31, 2013 Author Posted December 31, 2013 Thanks for trying to help, but I already fixed it.
Sasu Posted December 31, 2013 Posted December 31, 2013 function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) or 0 if kills > 12 then outputChatBox("ok", 0,255,0) elseif kills < 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe)
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