kuwalda Posted June 2, 2014 Share Posted June 2, 2014 I got this function going on for me function testejam(thePlayer, command) if ( getElementData( thePlayer, "allowrace" ) == 1 ) then if ( getElementData ( thePlayer, "dbid" ) == 2 ) then setElementData(thePlayer, "laiks", getTickCount ()) end local ciga = getElementData ( thePlayer, "dbid" ) outputChatBox("Tavs ID:"..tonumber(ciga)..".", thePlayer, 255, 255, 0) destroyElement(markeritis) markeritis = createMarker ( blueBerryRally[ciga][1], blueBerryRally[ciga][2], blueBerryRally[ciga][3], "checkpoint", 6, 190, 156, 252, 170 ) setElementVisibleTo(markeritis, root, false) setElementVisibleTo(markeritis, thePlayer, true) if ( #blueBerryRally == ciga ) then outputChatBox(Finished", thePlayer, 255, 255, 0) outputChatBox("Finisha time:"..(getTickCount () - getElementData( thePlayer, "laiks" )) / 1000 .."sec. GL NEXT TIME", root, 255, 255, 0) setElementData(thePlayer, "dbid", 1) end setElementData ( thePlayer, "dbid", getElementData ( thePlayer, "dbid" ) + 1 ) if isElementVisibleTo(markeritis,source) then addEventHandler( "onMarkerHit", markeritis, testejam ) end end end addCommandHandler("race", testejam) And my question is - why does it give Bad argument @ 'isElementVisibleTo' [Expected element at argument 2, got nil] ? Have tried alot of variables, none of them worked. Link to comment
Et-win Posted June 2, 2014 Share Posted June 2, 2014 Try instead of "source": "thePlayer" ? Link to comment
kuwalda Posted June 2, 2014 Author Share Posted June 2, 2014 I tried, but it didn`t worked - same error Link to comment
Max+ Posted June 3, 2014 Share Posted June 3, 2014 function testejam(thePlayer, command) if ( getElementData( thePlayer, "allowrace" ) == 1 ) then if ( getElementData ( thePlayer, "dbid" ) == 2 ) then setElementData(thePlayer, "laiks", getTickCount ()) end local ciga = getElementData ( thePlayer, "dbid" ) outputChatBox("Tavs ID:"..tonumber(ciga)..".", thePlayer, 255, 255, 0) destroyElement(markeritis) markeritis = createMarker ( blueBerryRally[ciga][1], blueBerryRally[ciga][2], blueBerryRally[ciga][3], "checkpoint", 6, 190, 156, 252, 170 ) setElementVisibleTo(markeritis, root, false) setElementVisibleTo(markeritis, thePlayer, true) if ( #blueBerryRally == ciga ) then outputChatBox("Finished", thePlayer, 255, 255, 0) outputChatBox("Finisha time:"..(getTickCount () - getElementData( thePlayer, "laiks" )) / 1000 .."sec. GL NEXT TIME", root, 255, 255, 0) setElementData(thePlayer, "dbid", 1) end setElementData ( thePlayer, "dbid", getElementData ( thePlayer, "dbid" ) + 1 ) if isElementVisibleTo(markeritis,source) then addEventHandler( "onMarkerHit", markeritis, testejam ) end end end addCommandHandler("race", testejam) Use Mta Script Editor to see the Error of the Script , 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