Jump to content

onClientMarkerHit


Recommended Posts

Hello .

i created a marker on client side and i want to use "onClientMarkerHit" on the pay marker only not on the whole server markers but its not working like "onMakrerHit" on the server side.

local paymarker = setTimer (createMarker,1800000,0,  2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) 

addEventHandler( "onClientMarkerHit", getRootElement(), payme ) 

Link to comment

You are supposed to use source to detect which marker you hit.

This if statement supposed to detect the marker that you hit:

if source == paymarker 

So your full function should be like this

  
function payme() 
if (source == pay marker) then 
--The script that is going to run when the player hits to the marker 
end 
end 
  

Edited by Guest
Link to comment
local marker1 = createMarker(stuff) 
  
function test1() 
if (source == marker1) then 
outputChatBox("Marker1 hitted!") 
end 
end 
  
addEventHandler("onClientMarkerHit, getRootElement(), test1) 
  
 

Like that you can do it.

not working.

function payme() 
        if (source == paymarker) then 
        outputChatBox ("Type /iwonthewar get your prize ",255,0,0,false) 
        addCommandHandler("iwonthewar",money) 
    end 
    end 

addEventHandler( "onClientMarkerHit", getRootElement(),payme ) 

Link to comment

Hit detection supposed to work just fine. There should be a problem with your money giving script. Also u don't need to define a command for calling money function. You can call the function without adding a event handler. Simply call it with "money()".

Make your players feel comfortable :D

if (source == paymarker) then 
        -- since you are calling the function directly you wont need to output that message  
        money()  
end 

Btw prefer to use lua bb code rather than Code bb code.

Edited by Guest
Link to comment
'paymarker' is a timer, won't work indeed. You need to give up a marker.

Use the timer like this:

setTimer(function () marker1 = createMarker(stuff) end, time, times) 

    setTimer(function lol() paymarker = createMarker(2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) end, 10000, 0) 

that's not working

Link to comment
remove lol. Keep it as function()
  
   setTimer(function()  
                paymarker = createMarker(2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180)  
                end, 10000, 0) 
  

thanks alot it worked .thanks to all who helped me.

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