Scripting/Squirrel/Functions/Player.Weapon: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "== Syntax == <pre>int player.Weapon</pre> == Example == This command gives player the name of the weapon they are using when they type '/c mywep'. <pre> function onPlayerCom...")
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:


== Example ==
== Example ==
This command gives player the name of the weapon they are using when they type '/c mywep'.
This command gives player the name of the weapon they are using when they type '/mywep'.


<pre> function onPlayerCommand( player, cmd, text )
<pre>function onPlayerCommand( player, cmd, text )
{
{
     if ( cmd == "mywep" )
     if ( cmd == "mywep" )
Line 12: Line 12:
     }
     }
}</pre>
}</pre>
== Related Functions ==
{{Scripting/Squirrel/Functions/Player Functions}}
[[Category:Scripting/Squirrel/Functions/Player_Functions]]

Latest revision as of 18:58, 30 January 2017

Syntax

int player.Weapon

Example

This command gives player the name of the weapon they are using when they type '/mywep'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "mywep" )
     {
          MessagePlayer( "Your current weapon: " + GetWeaponName( player.Weapon ), player );
     }
}

Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.