Squirrel/Server/Functions/Players/Vehicle
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|Vehicle.Health}} This ''Player'' class member returns or sets the players vehicle. == Syntax == You can either return or set a new value using this member: <co…') |
|||
Line 1: | Line 1: | ||
− | {{Squirrel/Title| | + | {{Squirrel/Title|Player.Vehicle}} |
This ''Player'' class member returns or sets the players vehicle. | This ''Player'' class member returns or sets the players vehicle. | ||
Latest revision as of 10:07, 11 October 2010
This Player class member returns or sets the players vehicle.
[edit] Syntax
You can either return or set a new value using this member:
vehicle player.Vehicle
player.Vehicle = vehicle veh
[edit] Arguments
- veh - The vehicle to set
[edit] Example 1. Returning
function onPlayerCommand( player, szCommand, szText ) { if ( szCommand == "mycar" ) { if ( player.Vehicle ) MessagePlayer( "You are currently driving a " + GetVehicleName( player.Vehicle ), player ); } return 1; }
[edit] Notes
The function MessagePlayer, GetVehicleName and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
[edit] Example 2. Setting
function onPlayerCommand( player, szCommand, szText ) { if ( szCommand == "runaway" ) { local veh = GetClosestVehicle( player ); if ( veh ) { MessagePlayer( "Placing you in the closest vehicle so you can run away! (wuss!)", player ); player.Vehicle = veh; } } return 1; }
[edit] Notes
The function MessagePlayer, GetClosestVehicle and event onPlayerCommand was used in this example. More info about this in the corresponding page.
[edit] Related Functions
- FindPlayer
- GetClosestPlayer
- Player.Alpha
- Player.Angle
- Player.Armour
- Player.Cash
- Player.Class
- Player.ClearWeapons
- Player.Colour
- Player.ColouredName
- Player.EnterVehicle
- Player.ExitVehicle
- Player.ForceToSpawnScreen
- Player.Frozen
- Player.GetBoundariesLower
- Player.GetBoundariesUpper
- Player.GetIgnored
- Player.Health
- Player.ID
- Player.IP
- Player.Immune
- Player.Island
- Player.LUID
- Player.Marker
- Player.MarkerScale
- Player.MarkerSprite
- Player.Muted
- Player.Name
- Player.Nametag
- Player.NametagColour
- Player.Ping
- Player.Pos
- Player.RemoveFromVehicle
- Player.RemoveLimb
- Player.Score
- Player.SetAnim
- Player.SetBoundaries
- Player.SetIgnored
- Player.SetIgnoredBy
- Player.SetVehicleEnterDoor
- Player.SetWeapon
- Player.Skin
- Player.Spawn
- Player.Spawned
- Player.Team
- Player.Train
- Player.Vehicle
- Player.VehicleSeat
- Player.Velocity
- Player.VirtualWorld
- Player.WantedLevel
- Player.Weapon
- Player.SetWeapon
- Player.WeaponAmmo
- Player.WeaponState