1LoL1 Posted August 17, 2015 Share Posted August 17, 2015 (edited) i have this: 1 = Point! 2 and more = Points! but this not work please can anyone help me? if tonumber (points) == 1 then PointsString = "Point!" else if tonumber (points) == 2 then PointsString = "Points!" else if tonumber (points) == 3 then PointsString = "TEST" end outputChatBox("#FFFF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) Edited August 18, 2015 by Guest Link to comment
JR10 Posted August 17, 2015 Share Posted August 17, 2015 This is not the correct syntax of the if conditional in Lua. if tonumber (points) == 1 then PointsString = "Point!" elseif tonumber (points) >= 2 then PointsString = "Points!" end outputChatBox("#FFFF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) This is different from your original code, but it's what you described. Link to comment
1LoL1 Posted August 17, 2015 Author Share Posted August 17, 2015 This is not the correct syntax of the if conditional in Lua. if tonumber (points) == 1 then PointsString = "Point!" elseif tonumber (points) >= 2 then PointsString = "Points!" end outputChatBox("#FFFF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) This is different from your original code, but it's what you described. Thanks but not work. Here is my full code and how to this: 1 = TEST 2, 3, 4 = TEST1 5 and more = TEST2 if getElementData(localPlayer, "lang") == "EN" then if tonumber (points) == 1 then PointsString = "Point!" elseif tonumber (points) >= 2 then PointsString = "Points!" end outputChatBox("#00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end else if tonumber (points) == 1 then PointsString = "Point!" elseif tonumber (points) >= 2 then PointsString = "Points!" end outputChatBox("#00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end end) Link to comment
JR10 Posted August 17, 2015 Share Posted August 17, 2015 if tonumber (points) == 1 then PointsString = "TEST" elseif tonumber (points) >= 2 and tonumber(points) < 5 then PointsString = "TEST1" else PointsString = "TEST2" end outputChatBox("#FFFF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) Link to comment
1LoL1 Posted August 17, 2015 Author Share Posted August 17, 2015 if tonumber (points) == 1 then PointsString = "TEST" elseif tonumber (points) >= 2 and tonumber(points) < 5 then PointsString = "TEST1" else PointsString = "TEST2" end outputChatBox("#FFFF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) When i killed zombie 0 errors 0 warning so not work Link to comment
Moderators Citizen Posted August 17, 2015 Moderators Share Posted August 17, 2015 Here is my full code and how to this: 1 = TEST 2, 3, 4 = TEST1 5 and more = TEST2 Try somthing like this: if getElementData(localPlayer, "lang") == "EN" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) elseif getElementData(localPlayer, "lang") == "FR" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end Link to comment
1LoL1 Posted August 17, 2015 Author Share Posted August 17, 2015 Here is my full code and how to this: 1 = TEST 2, 3, 4 = TEST1 5 and more = TEST2 Try somthing like this: if getElementData(localPlayer, "lang") == "EN" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) elseif getElementData(localPlayer, "lang") == "FR" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end not work 0 error 0 warning and when i killed zombie i dont see outputChatBox Link to comment
Moderators Citizen Posted August 17, 2015 Moderators Share Posted August 17, 2015 I don't know where you pasted my code so please show us the entire function. Link to comment
1LoL1 Posted August 17, 2015 Author Share Posted August 17, 2015 addEvent("onZombieKilled",true) addEventHandler("onZombieKilled",getRootElement(), function (killer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(killer)),aclGetGroup("VIP")) then local points = math.random(1,10) givePlayerMoney(killer, points) if getElementData(localPlayer, "lang") == "EN" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) elseif getElementData(localPlayer, "lang") == "EN2" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end Link to comment
Moderators Citizen Posted August 17, 2015 Moderators Share Posted August 17, 2015 Did you paste the entire function ?? Because it's how it looks like in my Notepad++ if there is nothing to add after that in the function, just close it correctly: addEvent("onZombieKilled",true) addEventHandler("onZombieKilled", getRootElement(), function (killer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(killer)), aclGetGroup("VIP")) then local points = math.random(1,10) givePlayerMoney(killer, points) if getElementData(localPlayer, "lang") == "EN" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) elseif getElementData(localPlayer, "lang") == "EN2" then if tonumber(points) == 1 or tonumber(points) == 0 then PointsString = "TEST" elseif tonumber(points) >= 2 and tonumber(points) <= 4 then PointsString = "TEST1" elseif tonumber(points) => 5 then PointsString = "TEST2" end outputChatBox("#FFFF00[VIP] #00FF00test #FF0000[" .. points .. "] #00FF00"..PointsString, killer, 255, 255, 255, true) end end end) If it was the problem you should have seen errors in the server console you didn't mention. And please don't use notepad.exe, wordpad, Word etc, use Notepad++ or Sublime Text instead. Link to comment
1LoL1 Posted August 18, 2015 Author Share Posted August 18, 2015 Not Work and what i use wrong? i using Notepad++. Link to comment
JR10 Posted August 19, 2015 Share Posted August 19, 2015 Either you're not in the VIP group or you don't have the "lang" element data set to any of the two options. 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