Jump to content

Script Problem..Help please


Recommended Posts

I made this script to set Levels in Label i made in panel if the another label shows 100 Points....but when i earned 100...Not Showed Level: 1...only Stand in Level: 0 :( ..please help

Client:

function WeaponLevels (player, weapon) 
          
local Weapon = guiGetText(GUIEditor.label[2]) 
if Weapon then 
local Point = tonumber(Weapon) 
if Point == 100 and weapon == 22 then  
guiSetText (GUIEditor.label[3],"Level: 1") 
        end 
    end 
end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

Link to post
can post full code?

I can to post the only the Original Labels..

label [2]

        GUIEditor.label[2] = guiCreateLabel(80, 52, 87, 17, "Points: 0", false, GUIEditor.tab[1]) 

Label [3]

        GUIEditor.label[3] = guiCreateLabel(80, 71, 88, 21, "Level: 0", false, GUIEditor.tab[1]) 

any thing from the script you want to get tell me...but sorry can't post the full script :/

Link to post

Try this:

function WeaponLevels (player, weapon) 
          
local Weapon = guiGetText(GUIEditor.label[2]) 
if Weapon then 
local Point = tonumber(Weapon) 
if Point >= 100 and weapon == 22 then 
guiSetText (GUIEditor.label[3],"Level: 1") 
        end 
    end 
end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

because you maybe haven't 100 points, but more

Link to post
Try this:
function WeaponLevels (player, weapon) 
          
local Weapon = guiGetText(GUIEditor.label[2]) 
if Weapon then 
local Point = tonumber(Weapon) 
if Point >= 100 and weapon == 22 then 
guiSetText (GUIEditor.label[3],"Level: 1") 
        end 
    end 
end 
addEventHandler( "onClientRender",getRootElement(), WeaponLevels) 

because you maybe haven't 100 points, but more

I'm tested it...the same thing...gimme an error :

attempt to compare number with nil 

Please help :(

Link to post
say line error and post full whole Script code

I can't just post my Full script in the forum for public...i hope you understand me......and the line error is:

    attempt to compare number with nil 

that's what i got from the debug script!...and THANKS For helping :)

Link to post

You want if points = 100 and weapon = 22 ??

for weapon use : getPedWeapon

i mean :

local weapon = getPedWeapon(localPlayer) 
    if weapon == 22 then 
        -- Your code 

if the answer yes < try :

addEventHandler( "onClientRender",root, 
function() 
    local Weapon = guiGetText(GUIEditor.label[2]) 
        if Weapon then 
        local Point = tonumber(Weapon) 
        if Point == 100 and getPedWeapon(localPlayer) == 22 then 
        guiSetText (GUIEditor.label[3],"Level: 1") 
            end 
        end 
    end 
) 
Link to post

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