Jump to content

Dude with onPlayerReachCheckpoint


novo

Recommended Posts

Hi all.

I have a dude with handler onPlayerReachCheckpoint.

I made a function for random cars on each checkpoint.

I saw on wiki, that to do something on some checkpoint the syntax is:

  
int checkpoint 
  

And i want know how it should be, i use this one:

  
checkpoint 1 
  

Can somebody correct my dudes, please ?

Bye.

Link to comment
Heh , wtf do you mean ?

If you can explain , do it...

Heh, why the Fuck are you talking badly ?

If you can't talk better, don't try to help...

I came here to got help, no to get answers where people talks to me badly.

@-SOAD-: I want know wich is the syntax to do something on checkpoint 1,2,3... I mean, a checkpoint number, a function on each checkpoint. This is the function wich i use:

  
addEventHandler("onPlayerReachCheckpoint", 
function checkpoint1 () 
local randomboats = math.random(454, 472) -- Random Boats 
    if ( isPedInVehicle ( source ) ) then 
    checkpoint 1 
    setElementModel ( getPedOccupiedVehicle (source), randomboats ) 
    end 
end 
) 
  

checkpoint 1, i mean that, to do the function when player reachs the checkpoint nº1.

Bye.

Link to comment
  
addEventHandler("onPlayerReachCheckpoint", 
function checkpoint1 (checkpoint) 
local randomboats = math.random(454, 472) -- Random Boats 
    if ( isPedInVehicle ( source ) ) then 
         if checkpoint == 1 then 
                 setElementModel ( getPedOccupiedVehicle (source), randomboats ) 
        end 
    end 
end 
) 
  

Link to comment

1. You didn't create the checkpoint

2. You can simply make a marker o.0

  
local boatMarker = createMarker( x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) 
  
function MarkerHit( hitElement, matchingDimension ) 
local randomboats = math.random(454, 472) 
    if ( isPedInVehicle ( source ) ) then 
    setElementModel ( getPedOccupiedVehicle (source), randomboats ) 
   end 
end 
) 
addEventHandler( "onMarkerHit", boatMarker, MarkerHit )  

Link to comment
  
addEvent('onPlayerReachCheckpoint', true)  --this is most important... since the event is CUSTOM and not built-in MTA.. 
--Check this: [url=https://wiki.multitheftauto.com/wiki/RU/Resource:Race]https://wiki.multitheftauto.com/wiki/RU/Resource:Race[/url] 
addEventHandler("onPlayerReachCheckpoint", root   --you forgot this bit 
function(checkpoint)    --i am not sure, but i dont think you can name the function if you use it like that. Afaik the function must already exist when calling it by name 
local randomboats = math.random(454, 472)  
    if ( isPedInVehicle ( source ) ) then 
         if checkpoint == 1 then 
                 setElementModel ( getPedOccupiedVehicle (source), randomboats ) 
        end 
    end 
end 
) 
  

PS: What's with all the 'dude-dude-dude' thing..

  • Like 1
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...