Scripting/Squirrel/Functions/Player.Vehicle

From Vice City Multiplayer
Revision as of 09:19, 8 January 2015 by MatheuS (talk | contribs) (Created page with "== Syntax == <pre>vehicle player.Vehicle player.Vehicle = newVehicle</pre> == Example == This command gives the vehicle player is driving when someone types '/c car playern...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

Syntax

vehicle player.Vehicle

player.Vehicle = newVehicle

Example

This command gives the vehicle player is driving when someone types '/c car playername'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "car" )
     {
          local plr = FindPlayer( text );
          
          if ( !plr ) MessagePlayer( "Error: Player '" + text + "' is not online.", player );
          else MessagePlayer( plr.Name + "'s vehicle: " + plr.Vehicle, player );
     }
}

Example 2. Setting

This command puts the player into a car when they type '/c gimmeacar'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "gimmeacar" )
     {
          player.Vehicle = FindVehicle( 1 );
     }
}