Jump to content

Level?


Bean666

Recommended Posts

Posted

hi guys , today i made a script , a player can only have access to a skin if he's level 20 , when i click the button , it triggers this event. when i clicked the button it changes my skin even i dont have level 20 .

can u guys help me?

local nLevel = tonumber( getElementData( player, "level" ) ) or 0; 
  
addEvent("supersoldier",true)  
addEventHandler("supersoldier",root,  
function() 
   if ( nLevel < 20 ) then 
    setPedSkin ( source, 285 ) 
else 
outputChatBox('You don\'t have the requirements of the supersoldier!', source, 255, 0, 0 ) 
end 
end) 
  

Posted
  
addEvent("supersoldier",true) 
addEventHandler("supersoldier",root, 
function() 
    local nLevel = tonumber( getElementData( source, "level" ) ) or 0 
    if ( nLevel < 20 ) then 
        setElementModel( source, 285 ) 
    else 
        outputChatBox('You dont have the requirements of the supersoldier!', source, 255, 0, 0 ) 
    end 
end) 
  

Posted
addEvent("supersoldier", true) 
addEventHandler("supersoldier", root, 
function() 
    local nLevel = tonumber(getElementData(source, "level")) or 0 
    if (nLevel >= 20) then 
        setElementModel(source, 285) 
    else 
        outputChatBox("You don't have the requirements of the supersoldier!", source, 255, 0, 0) 
    end 
end) 

Posted

You made if nLevel < 20 which means , he can get the skin if his level is lower than 20 , you should use the greater and equal operator as TAPL gave you

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