Jump to content

get player´s level


bartje01

Recommended Posts

Hey guys. I want that if the player his level = 2, the triggerevent activates.

I have this:

  
        if getElementData(source, tostring(sqldata[1]["level"])) == 2 then 
        triggerClientEvent ( source,"l2", source ) 
  

Well, I know that this is terribly wrong, but I'm not sure how to fix it. Does anyone have an idea?

This is the executetable (Not sure if needed)

  
executeSQLCreateTable("levels", "accountname STRING, level INT") 
  

Link to comment
You can't use that as handler,

You have to trigger from the script, that set this element data or you can use a timer.

What the hell are you talking?

Hey guys. I want that if the player his level = 2, the triggerevent activates.

I have this:

  
        if getElementData(source, tostring(sqldata[1]["level"])) == 2 then 
        triggerClientEvent ( source,"l2", source ) 
  

Well, I know that this is terribly wrong, but I'm not sure how to fix it. Does anyone have an idea?

This is the executetable (Not sure if needed)

  
executeSQLCreateTable("levels", "accountname STRING, level INT") 
  

local sql = executeSQLQuery ( 'SELECT `level` FROM `levels` WHERE accountname = "myAccount"' ); 
if ( tonumber ( sql[1]['level'] ) == 2 ) then 
    triggerClientEvent ( source, 'l2', source ); -- is source element defined? 
end 

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