02.12.2014, 21:44
First problem:
Only one hardcoded player (his name needs to be defined in the script) can own a car, and nobody else has that possibility?
And to change the owner of that single vehicle, you'll have to edit the script, recompile and restart the server.
You need an array to make it work for all players, and add code to set ownership of the vehicle in-game.
Second problem:
OnPlayerEnterVehicle is called whenever a player is NEAR a vehicle and presses the ENTER key.
Then the player's character will start moving towards the vehicle and can't be removed from the vehicle as he's not yet inside of it, your code won't work.
He won't get ejected from the vehicle, you'll only get the message.
Use OnPlayerStateChange instead.
Only one hardcoded player (his name needs to be defined in the script) can own a car, and nobody else has that possibility?
And to change the owner of that single vehicle, you'll have to edit the script, recompile and restart the server.
You need an array to make it work for all players, and add code to set ownership of the vehicle in-game.
Second problem:
OnPlayerEnterVehicle is called whenever a player is NEAR a vehicle and presses the ENTER key.
Then the player's character will start moving towards the vehicle and can't be removed from the vehicle as he's not yet inside of it, your code won't work.
He won't get ejected from the vehicle, you'll only get the message.
Use OnPlayerStateChange instead.