Jump to content

Script Problem..Help please


Recommended Posts

Posted

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) 

Posted
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 :/

Posted

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

bruh

Posted

That doesn't really make much sense, "onClientRender" has no parameters.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Ah yes, my bad, i didn't check the whole code at all, which is a big mistake ^^'.

I guess the event should be onZombieWasted. (from what i know you're working on)

bruh

Posted
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 :(

Posted
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 :)

Posted

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 
) 

Sha67 سابقاً

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