Jump to content

couple of questions


kuwalda

Recommended Posts

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

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

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