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:
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