Jump to content

Help


Recommended Posts

I started to learn the lua and i stock one thing

I want to the script if the player was stand in to the marker then he just set it to the different dimenson

local marker = createMarker(13,1,3,"checkpoint",4.0,0,0,255,255) 
  
function onPlayerEnterVehicle ( hitElement, matchingDimension ) 
       local elementType = getElementType( hitElement ) 
    setElementDimension ( source, 1 )                    
    end 
addEventHandler ( "onMarkerHit", marker, onPlayerEnterVehicle ) 
  
  

This is my server side :D some one please help me to fix it and explain what i need to change and why , because i want to learn it and not just ask for help always :(

Link to comment

you want to change the player's dimension? if yes...

in "onMarkerHit" event source is "[...] the marker that got hit by the element." (you can see this at the wiki), you want the player to go to another dimension, not the marker, right? so you have to use the first parameter of onPlayerEnterVehicle function (which is attached to the event "onMarkerHit").

your final code will be like this:

local marker = createMarker(13,1,3,"checkpoint",4.0,0,0,255,255) 
  
function onPlayerEnterVehicle ( hitElement, matchingDimension ) 
       --local elementType = getElementType( hitElement ) -- this is unnecessary because you never use 'elementType' 
    setElementDimension ( hitElement, 1 ) -- < see, i replaced [b]source[/b] (marker) with [b]hitElement[/b] (player, or vehicle maybe)             
end 
addEventHandler ( "onMarkerHit", marker, onPlayerEnterVehicle ) 

Sorry if my english isn't very well, i've done my best :)

regards.

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