Jump to content

Script Errors..help


Recommended Posts

Hello guys :) .. I made this script to set Levels every 100 Points in weapon skills...but i got some script ERRORS...may you help me with it?

Client:

function WeaponLevels (killer, weapon, bodypart) 
  
  
local Nothing = tonumber(getPedStat(killer, 69)) 
if Nothing = 100 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
elseif Nothing = 200 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
elseif Nothing = 300 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
elseif Nothing = 400 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
elseif Nothing = 500 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
elseif Nothing = 600 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
elseif Nothing = 700 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
elseif Nothing = 800 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
elseif Nothing = 900 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
elseif Nothing = 1000 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
end 
    end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 
  

ERROR:

WeaponPoints.lua:125: 'then' expected near '=' 

Please help :(

Link to comment

try this:

function WeaponLevels (killer, weapon) 
  
  
local Nothing = tonumber(getPedStat(killer, 69)) 
if Nothing = 100 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
elseif Nothing == 200 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
elseif Nothing == 300 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
elseif Nothing == 400 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
elseif Nothing == 500 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
elseif Nothing == 600 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
elseif Nothing == 700 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
elseif Nothing == 800 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
elseif Nothing == 900 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
elseif Nothing == 1000 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
end 
    end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 
  

Link to comment

Try this:

function WeaponLevels (killer, weapon, bodypart) 
  
local Nothing = tonumber(getPedStat(killer, 69)) 
    if Nothing <= 100 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
    elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
    elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
    elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
    elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
    elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
    elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
    elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
    elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
    elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then 
        guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
    end 
end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

Edited by Guest
Link to comment
try this:
function WeaponLevels (killer, weapon) 
  
  
local Nothing = tonumber(getPedStat(killer, 69)) 
if Nothing = 100 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
elseif Nothing == 200 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
elseif Nothing == 300 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
elseif Nothing == 400 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
elseif Nothing == 500 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
elseif Nothing == 600 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
elseif Nothing == 700 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
elseif Nothing == 800 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
elseif Nothing == 900 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
elseif Nothing == 1000 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
end 
    end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 
  

Now i got another ERROR:

WeaponPoints_c.lua:128: 'then' expected near '=' 

Link to comment
try this:
function WeaponLevels (killer, weapon) 
  
  
local Nothing = tonumber(getPedStat(killer, 69)) 
if Nothing = 100 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
elseif Nothing == 200 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
elseif Nothing == 300 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
elseif Nothing == 400 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
elseif Nothing == 500 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
elseif Nothing == 600 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
elseif Nothing == 700 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
elseif Nothing == 800 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
elseif Nothing == 900 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
elseif Nothing == 1000 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
end 
    end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 
  

Now i got another ERROR:

WeaponPoints_c.lua:128: 'then' expected near '=' 

The ERROR is here in :128:...Just shows because it's not the full script

    if Nothing = 100 and weapon = 22 then 

Edited by Guest
Link to comment
try this:
function WeaponLevels (killer, weapon) 
  
  
local Nothing = tonumber(getPedStat(killer, 69)) 
if Nothing = 100 and weapon = 22 then 
guiSetText (GUIEditor.label[3], "Level: 1",Nothing) 
elseif Nothing == 200 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 2",Nothing) 
elseif Nothing == 300 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 3",Nothing) 
elseif Nothing == 400 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 4",Nothing) 
elseif Nothing == 500 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 5",Nothing) 
elseif Nothing == 600 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 6",Nothing) 
elseif Nothing == 700 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 7",Nothing) 
elseif Nothing == 800 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 8",Nothing) 
elseif Nothing == 900 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 9",Nothing) 
elseif Nothing == 1000 and weapon == 22 then 
guiSetText (GUIEditor.label[3], "Level: 10",Nothing) 
end 
    end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 
  

Now i got another ERROR:

WeaponPoints_c.lua:128: 'then' expected near '=' 

The ERROR is here in :128:...Just shows because it's not the full script

    if WeaponLevels = 100 and weapon = 22 then 

HEllo?!!! Are you here guys?

Link to comment
In guiSetText, remove ",Nothing"

lol!! look :116: is

function WeaponPoints() 
local WeaponPoints = getPedStat( localPlayer, 69 ); 
guiSetText( GUIEditor.label[2],"Points: "..WeaponPoints ); 
end 
addEventHandler( "onClientRender", root, WeaponPoints ); 

it's the script i use to set player points in the label...it was working 1000000% before i put this new script

    function WeaponLevels (killer, weapon) 
      
    local Nothing = tonumber(getPedStat(killer, 69)) 
        if Nothing <= 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 1") 
        elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 2") 
        elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 3") 
        elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 4") 
        elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 5") 
        elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 6") 
        elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 7") 
        elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 8") 
        elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 9") 
        elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 10") 
        end 
    end 
end 
    addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

Link to comment

it won't works

try this

function WeaponLevels (killer, weapon) 
      
    local Nothing = tonumber(getPedStat(killer, 69)) 
        if Nothing <= 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 1") 
        elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 2") 
        elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 3") 
        elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 4") 
        elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 5") 
        elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 6") 
        elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 7") 
        elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 8") 
        elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 9") 
        elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 10") 
        end 
    end 
    addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

Link to comment
it won't works

try this

function WeaponLevels (killer, weapon) 
      
    local Nothing = tonumber(getPedStat(killer, 69)) 
        if Nothing <= 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 1") 
        elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 2") 
        elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 3") 
        elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 4") 
        elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 5") 
        elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 6") 
        elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 7") 
        elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 8") 
        elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 9") 
        elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then 
            guiSetText (GUIEditor.label[3], "Level: 10") 
        end 
    end 
    addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

ERROR:

:124: attempt to compare nil with number 

Warning:

:123: Bad Argument @ 'getPedStat' 

:116: Bad Argument @ 'guiSetText' [Expected gui-element at argument 1,got nil 

:123:...Script

        local Nothing = tonumber(getPedStat(killer, 69)) 

:116: Script

guiSetText( GUIEditor.label[2],"Points: "..WeaponPoints ); 

:116: its another function...but it was working 100% before i add this new script for levels...also i think this levels need server side or what?..please help

Link to comment
at 116 be sure that the label name is correct
        GUIEditor.label[2] = guiCreateLabel(80, 52, 87, 17, "Points: 0", false, GUIEditor.tab[1]) 

It's the Label...Correct right?

look Nevermind about this script problem...it's because i was puted guisetVisible... it was making A lot of ERRORS...

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