OnPlayerCommand

From Vice City Multiplayer
Revision as of 16:45, 15 March 2016 by Decent 946 (talk | contribs)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

When a player changes his weapon to newone or oldone.

Syntax

function onPlayerWeaponChange( player, oldwep, newwep )

Parameters

  • Player player - The player who changes the weapon.
  • oldwep - Players old weapon
  • newwep - Players new weapon

Example

If a player will try to change his weapon to "33" ( minigun ), this example will automatically set his weapons ammo to 0. and in result, he won't be able to use that weapon.

function onPlayerWeaponChange( player, oldwep, newwep )
{
    if ( newwep == 33 )
    {
        PrivMessage( player, "it is a blocked weapon" );
        player.SetWeapon( 33,0 ); //sets weapons ammo to 0.
    }
return 1; //returns true for other weapons.
}

Notes

Function PrivMessage and function SetWeapon were used in this example.

Related Events