bartje01 Posted June 15, 2012 Posted June 15, 2012 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")
Moderators IIYAMA Posted June 15, 2012 Moderators Posted June 15, 2012 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Anderl Posted June 15, 2012 Posted June 15, 2012 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 "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now