27.07.2012, 18:25
RemovePlayerFromVehicle would only work if he's already inside the vehicle.
I think he wants to know how to prevent anyone to even enter the vehicle, like it would be as if the doors are locked.
Everytime a player logs in, you can process all vehicles and set the doors locked/unlocked based on the ownership of the vehicle.
Pseudocode:
I think he wants to know how to prevent anyone to even enter the vehicle, like it would be as if the doors are locked.
Everytime a player logs in, you can process all vehicles and set the doors locked/unlocked based on the ownership of the vehicle.
Pseudocode:
Code:
// Loop through all vehicles for vid = 0 to 1999 // Check if this vehicle exists if (VehicleData[vid][VehicleExists] == 1) // Loop through all players for playerid = 0 to MAX_PLAYERS // Check if this player is connected if IsPlayerConnected(playerid) // Check if this player is the owner if (GetPlayerName(playerid) == VehicleData[vid][Owner]) // Unlock the doors for the owner SetVehicleParamsForPlayer(vid, playerid, 0, 0) else // Lock the doors for every other player SetVehicleParamsForPlayer(vid, playerid, 0, 1) endif endif next endif next