SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 30/12/2019, 04:36 AM   #1
nbx2000
Big Clucker
 
Join Date: Dec 2016
Posts: 170
Reputation: 5
Default How NoT Exit Cars game

hello guys a question i'm doing mini race game and i wonder how i can do for the player not to get out of the vehicle? An example
nbx2000 is offline   Reply With Quote
Old 30/12/2019, 07:25 AM   #2
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,162
Reputation: 73
Default Re: How NoT Exit Cars game

in OnPlayerStateChange, check if oldstate is PLAYER_STATE_DRIVER, so if it's true, just use PutPlayerInVehicle function (seat id 0 = driver)
but, you gonna save players' vehicle ID (as a global variable or PVar)
PHP Code:
//array variation
new PlayerVehicleID[MAX_PLAYERS];

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVERPlayerVehicleID[playerid] = GetPlayerVehicleID(playerid);
    else if(
oldstate == PLAYER_STATE_DRIVERPutPlayerInVehicle(playeridPlayerVehicleID[playerid]);
    return 
1;

__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala 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
Job cars respawn when exit them. [+REP] EgyptForLife Scripting Help 3 28/12/2015 03:03 PM
Error after exit the game KingArthur Client Support 8 07/04/2013 06:58 AM
Destroy Cars On Server Exit lewismichaelbbc Help Archive 0 05/09/2010 08:40 AM
Question on game mode exit aNdReSk Help Archive 10 18/07/2010 11:08 PM
How to make my rental cars save when player exit Steven82 Help Archive 0 05/05/2010 08:53 PM


All times are GMT. The time now is 06:10 AM.


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