Jump to content

Solved..


1LoL1

Recommended Posts

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 by Guest
Link to comment

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
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
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
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

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

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
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

Did you paste the entire function ?? Because it's how it looks like in my Notepad++

2bb2c6f38c3e49d31d80efa45147c6e8.png

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...