Vehicle Owning.
#1

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.
Reply
#2

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");
Reply
#3

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.
Reply
#4

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
Reply
#5

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


Forum Jump:


Users browsing this thread: 4 Guest(s)