kuwalda Posted May 26, 2014 Share Posted May 26, 2014 Hey, I have some questions that I could not find answers to, so I thought you could help: addEventHandler('onClientGUIClick', getRootElement(), function(button, state, absoluteX, absoluteY) if(source == button1)then ... end end end) How can I define who pressed the button? Like getting "theplayer" variable. if getElementData(thePlayer, "dbid") == nil then setElementData(thePlayer, "dbid", 1) end Why this is not working? I did not define "dbid" anywhere before, but isn`t returned value not existant / nil ? function testejam(thePlayer, command) local pid = tonumber(getElementData(thePlayer, "dbid")) outputChatBox("Your ID:"..pid..".", thePlayer, 255, 255, 0) local ciga = getElementData ( thePlayer, "dbid" ) destroyElement(markeritis) markeritis = createMarker ( blueBerryRally[ciga][1], blueBerryRally[ciga][2], blueBerryRally[ciga][3], "checkpoint", 6, 190, 156, 252, 170 ) setElementData ( thePlayer, "dbid", getElementData ( thePlayer, "dbid" ) + 1 ) addEventHandler( "onMarkerHit", markeritis, testejam ) end addCommandHandler("race", testejam) Why does it give error: attempt to concatenate local 'pid' (a nil value) ? How can I determen if there is no more checkpoints left? Should I use if (markeritis == false) then ? Thanks for your replys, time and help! Link to comment
Castillo Posted May 26, 2014 Share Posted May 26, 2014 1. It's quite simple, since the code is client side, you use "localPlayer". 2. Is 'thePlayer' defined? check what 'dbid' returns. 3. It's because 'pid' is a nil value, it has no data in it. About the checkpoints, I think you can do somethling like: #blueBerryRally == ciga Link to comment
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