SA-MP Forums Archive
Vehicle Owning. - 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: Vehicle Owning. (/showthread.php?tid=244559)



Vehicle Owning. - Compton - 27.03.2011

Hello, I need help with something.

Example: I made a car in my server, and I want that only one person will be able to drive it, and if someone else gets in as a driver the car ejects him with showing a message that this car belongs only to me. Is it hard to make?

-Thank you.


Re: Vehicle Owning. - aircombat - 27.03.2011

pawn Код:
new MyVehicle;
under OnGameModeInit :
pawn Код:
MyVehicle = AddStaticVehicle(.....)
then under OnPlayerEnterVehicle :
pawn Код:
new pName[24]; GetPlayerName(playerid,pName,24);
if(vehicleid == MyVehicle)
{
if(!strcmp("The Name You Want",pName,true))
{
      SendClientMessage(playerid,COLOR_RED,"Welcome To Your Vehicle");
      return 1;
}
} else return SendClientMessage(playerid,COLOR_RED,"This Isn't Your Vehicle");



Re: Vehicle Owning. - Compton - 27.03.2011

Well Its only half what I wanted it todo, all it dose meanwhile is sending me a message when I get in it, But other people can still get in as drivers and drive it.. and It dosent show nothing to them.

And I need a script that will allow only a unique player to drive this ride.


Re: Vehicle Owning. - Max_Coldheart - 27.03.2011

Quote:
Originally Posted by aircombat
Посмотреть сообщение
pawn Код:
new MyVehicle;
under OnGameModeInit :
pawn Код:
MyVehicle = AddStaticVehicle(.....)
then under OnPlayerEnterVehicle :
pawn Код:
new pName[24]; GetPlayerName(playerid,pName,24);
if(vehicleid == MyVehicle)
{
if(!strcmp("The Name You Want",pName,true))
{
      SendClientMessage(playerid,COLOR_RED,"Welcome To Your Vehicle");
      return 1;
}
} else return SendClientMessage(playerid,COLOR_RED,"This Isn't Your Vehicle");
pawn Код:
new MyVehicle;
under OnGameModeInit :
pawn Код:
MyVehicle = AddStaticVehicle(.....)
pawn Код:
public OnPlayerStateChange
{
If(newstate == PLAYER_STATE_DRIVER)
{
new pName[24]; GetPlayerName(playerid,pName,24);
if(vehicleid == MyVehicle)
{
if(!strcmp("The Name You Want",pName,true))
{
      SendClientMessage(playerid,COLOR_RED,"Welcome To Your Vehicle");
      return 1;
}
} else return SendClientMessage(playerid,COLOR_RED,"This Isn't Your Vehicle");
EDIT: Sorry if doesn work. Wrote with iPod


Re: Vehicle Owning. - austin070 - 27.03.2011

pawn Код:
} else return SendClientMessage(playerid,COLOR_RED,"This Isn't Your Vehicle"); RemovePlayerFromVehicle(playerid);
Forgot that part.