Vehicle for specific player
#2

You should create a vehicle array
PHP код:
// global
new gVehicleOwner[MAX_VEHICLES 1]; 
The code gets way more simply
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate) {
    if(
newstate == PLAYER_STATE_DRIVER) {
        new
            
vehicleid GetPlayerVehicleID(playerid),
            
owner gVehicleOwner[vehicleid]
        ;
        if(
owner == INVALID_PLAYER_ID) {
            
// vehicle has no owner
        
} else {
            if(
owner == playerid) {
                
// Vehicle is owned by playerid
            
} else {
                
// Vehicle isn't owned by playerid
                
RemovePlayerFromVehicle(playerid);
            }
            new 
string[64];
            
GetPlayerName(ownerstringMAX_PLAYER_NAME);
            
format(stringsizeof(string), "This car is owned by %s"string);
            
SendClientMessage(playerid, -1string);
        }
    }
    return 
1;

Reply


Messages In This Thread
Vehicle for specific player - by Supermaxultraswag - 14.09.2015, 17:04
AW: Vehicle for specific player - by Nero_3D - 14.09.2015, 18:43
Re : Vehicle for specific player - by KillerDVX - 14.09.2015, 22:38
Re: Vehicle for specific player - by Supermaxultraswag - 18.09.2015, 15:25
Re: Vehicle for specific player - by Mister0 - 18.09.2015, 15:30
Re: Vehicle for specific player - by Supermaxultraswag - 18.09.2015, 15:33
Re: Vehicle for specific player - by Mister0 - 18.09.2015, 15:45
Re: Vehicle for specific player - by rappy93 - 18.09.2015, 15:46
Re: Vehicle for specific player - by Jefff - 18.09.2015, 15:47
Re: Vehicle for specific player - by Supermaxultraswag - 03.10.2015, 12:47

Forum Jump:


Users browsing this thread: 3 Guest(s)