Registering a car to a players name
#4

you can also do it this way (this is a kinda stupid and long way, however you can learn it by using this at the beginning)

imagine the player is called: Peter

at the top of your script:
Код:
new peter;
then at the vehicle you want to assign to peter:
Код:
peter = AddStaticVehicle(................);
and now search "OnPlayerStateChange" in your script and write:
Код:
new v = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT){
 if(v = peter){
  new owner[50]; 
  GetPlayerName(playerid, owner, 50);
  if(!strcmp(owner, "Peter", true)){
   SendClientMessage(playerid, YOURCOLOR, "This vehicle is assigned to you");
  }else{
   RemovePlayerFromVehicle(playerid);
   SendClientMessage(playerid, YOURCOLOR, "This vehicle belongs to Peter");
  }
 }
 return 1;
}
as the "peter" has now the ID of the vehicle, you can check whether the vehicle the player just entered has the same ID as peter and if it has it is the vehicle you assigned to Peter.
then you get the name of the player and check whether the name is = "Peter" and if it is it will send a message to Peter that this vehicle is assigned to him...
if it is not Peter the player will get a message which tells him that the vehicle belongs to Peter and will remove him from the vehicle...

I hope I could help you a bit:P
Reply


Messages In This Thread
Registering a car to a players name - by CSMajor - 19.10.2010, 02:43
Re: Registering a car to a players name - by CSMajor - 19.10.2010, 19:49
Re: Registering a car to a players name - by NewYorkRP - 19.10.2010, 19:52
Re: Registering a car to a players name - by Sascha - 19.10.2010, 20:29
Re: Registering a car to a players name - by Cameltoe - 19.10.2010, 21:04
Re: Registering a car to a players name - by CSMajor - 19.10.2010, 21:04
Re: Registering a car to a players name - by Cameltoe - 19.10.2010, 21:06
Re: Registering a car to a players name - by CSMajor - 19.10.2010, 21:06
Re: Registering a car to a players name - by Cameltoe - 19.10.2010, 21:09
Re: Registering a car to a players name - by CSMajor - 19.10.2010, 21:13
Re: Registering a car to a players name - by CSMajor - 19.10.2010, 21:32
Re: Registering a car to a players name - by Cameltoe - 19.10.2010, 21:34

Forum Jump:


Users browsing this thread: 4 Guest(s)