SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/05/2020, 01:10 PM   #1
Calinut200
Big Clucker
 
Join Date: Jun 2016
Posts: 74
Reputation: 0
Default Help put player in vehicle

Helo Guys! I have a race system and i have some problems.
When the race lobby is 2/2 the race will start and only first player will be put in the vehicle created
How to make if are 5 players in race to put each player in diferent car.
Thank you in advance
PHP Code:
stock racelobby(playerid)
{
    if(
raceplayers 2)
    {
        
sendtorace(-1"Waiting for players");
    }
    else if(
raceplayers >= 2)
    {
        
sendtorace(-1"THE RACE WILL START IN 10 SECONDS");
        
SetTimer("race"100000);
    }
}
forward race(playerid);
public 
race(playerid)
{
    
SendClientMessageToAll(-1"DEBUG: RACE StART");
    
racestatus 1;
    new 
car1 CreateVehicle(411, -2518.1865, -2301.781714.8012, -90.0000, -1, -1100);
    new 
car2 CreateVehicle(411, -2517.9319, -2307.267814.8012, -90.0000, -1, -1100);
    
PutPlayerInVehicle(playeridcar10);
    
SendClientMessage(playerid, -1"In 5 seconds the race will start");
    return 
1;

Calinut200 is offline   Reply With Quote
Old 29/05/2020, 01:17 PM   #2
RedGun2015
Huge Clucker
 
RedGun2015's Avatar
 
Join Date: Sep 2015
Location: Romania
Posts: 290
Reputation: 0
Default Re: Help put player in vehicle

This is an example, you must create some position in order to create a car, because if you create the same car in the same location some players will be stucked there (only if you are using collision in your race system).

PHP Code:
stock racelobby(playerid)
{
    if(
raceplayers 2)
    {
        
sendtorace(-1"Waiting for players");
    }
    else if(
raceplayers >= 2)
    {
        
sendtorace(-1"THE RACE WILL START IN 10 SECONDS");
        
SetTimer("race"100000);
    }
}

forward race();
public 
race()
{
    
SendClientMessageToAll(-1"DEBUG: RACE StART");
    
racestatus 1;
    
    foreach(new 
Player)
    {
        new 
car CreateVehicle(411, -2518.1865, -2301.781714.8012, -90.0000, -1, -1100);
        
PutPlayerInVehicle(icar0);
        
SendClientMessage(i, -1"In 5 seconds the race will start");
    }

    return 
1;

__________________
Here - but - not really here.
RedGun2015 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect player ramming his vehicle into another player's vehicle? Amads Scripting Help 7 06/03/2016 01:54 PM
No driver bug while putting player directly from RC vehicle to normal vehicle. KovaNovik Bug Reports 1 27/07/2015 05:24 PM
[Help] Show vehicle model when player enters vehicle. iDuckling Scripting Help 9 22/12/2013 09:53 PM
Destroy specific vehicle when player exit vehicle se7evolution Scripting Help 10 25/01/2013 08:08 PM
Instead of a player pressing enter near the vehicle, when your in the vehicle Studio Help Archive 5 28/12/2009 07:22 AM


All times are GMT. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.