Scripting/Squirrel/Functions/Players/DrivebyAbility

From VC-MP Wiki

Jump to: navigation, search

NOTE: This function has been added in VC:MP 0.3z r2. It will not work in previous versions.


This Player class property will toggle player's driveby ability. You can either get or set the value.

Syntax

bool Player.DrivebyAbility
Player.DrivebyAbility = bool bAbility

Arguments

  • bAbility - Toggle the driveby ability to on (true) or off (false)

Example

This command will return if the player is able to Drive-By.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "driveby" )
     {
          if ( player.DrivebyAbility == false ) MessagePlayer( "You do not have the ability to drive-by.", player );
          else if ( player.DrivebyAbility == true ) MessagePlayer( "You have ability to drive-by.", player );
     }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Example 2

This command gives the player ability to drive-by when typing '/c drivebyon'.

function onPlayerCommand( player, cmd, text )
{
	if ( cmd == "drivebyon" )
	{
		player.DrivebyAbility = true;
		MessagePlayer( "Driveby turned on", player );
        }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Example 3

This command removes the player's ability to drive-by when typing '/c drivebyoff'.

function onPlayerCommand( player, cmd, text )
{
	if ( cmd == "drivebyoff" )
	{
		player.DrivebyAbility = false;
		MessagePlayer( "Driveby turned off", player );
        }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting