Scripting/Squirrel/Functions/Player.Typing: 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
 
Line 11: Line 11:


== Result ==
== Result ==
Toggle - true or false.
Bool - true or false.


== Example ==
== Example ==

Latest revision as of 19:22, 4 August 2017

This function will inform you whether a player is typing or not.

-> This function is triggered when a player starts typing.

Syntax

player.Typing

player.Typing = true;

player.Typing = false;

Result

Bool - true or false.

Example

In this Example, We are going to check if the specified player is typing or not. it will either return as true or false. Where true means yes and false means not.

function onPlayerCommand( player, cmd, text )
{
  if ( cmd == "istyping" )
  {
    if ( text == null ) PrivMessage( player, "SYNTAX: /istyping < player ID >" );
    else if ( !IsNum(text) ) PrivMessage( player, "Error - Please Sepcify player's ID" ); //ID selects the distnict player.
    else
    {
      local plr = FindPlayer( text.tointeger() );
      
      if ( !plr ) PrivMessage( player, "No such player..." );
      else
      {
         MessagePlayer( "Is "+plr+" typing: "+plr.Typing, player ); // true = yes & false = no.
      }
    }
  }

}


Notes

Call onPlayerCommand, functions FindPlayer, PrivMessage and MessagePlayer were used in this example


Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.