SA-MP Forums Archive
How would i go about making a car only usable by one person? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How would i go about making a car only usable by one person? (/showthread.php?tid=270419)



How would i go about making a car only usable by one person? - slymatt - 20.07.2011

Im making a dmv system and i was wondering how can i make a car that spawns when the player chooses to do there license only usable by that person?

Thanks Matt


Re: How would i go about making a car only usable by one person? - TouR - 20.07.2011

Here is the basic code


pawn Код:
new
     vUser[MAX_VEHICLES];

new vehicleid = CreateVehicle( modelid, x ,y ,z , col1, col2 ); // You create the car that the player will use
vUser[vehicleid] = playerid; // When the player is ready to take the test

if( vUser[vehicleid] == playerid ) { .... code } // under OnPlayerStateChange
else { RemovePlayerFromVehicle(playerid); }



Re: How would i go about making a car only usable by one person? - slymatt - 20.07.2011

this code sets every car to be for that player.


Re: How would i go about making a car only usable by one person? - XGh0stz - 20.07.2011

Код:
new DrivingTestVehicle=CreateVehicle( modelid, x ,y ,z , col1, col2 );// The Driver Test Vehicle

SetPVarInt(playerid,"DrivingTest",1);// For when the player is ready to take the test

if(vehicleid==DrivingTestVehicle&&GetPVarInt(playerid,"DrivingTest")==0)// For under OnPlayerEnterVehicle
{
RemovePlayerFromVehicle(playerid);
}



Re: How would i go about making a car only usable by one person? - slymatt - 20.07.2011

after putting this in my pawn says pawn library has stopped working.

im i right in thinking SetPVarInt(playerid,"DrivingTest",1);// For when the player is ready to take the test
goes where my DMV code is?


Re: How would i go about making a car only usable by one person? - slymatt - 20.07.2011

Im so confused can you give me a simple way of doing it because that way doesnt seem to work