Announce: 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
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
== Syntax ==
== Syntax ==


<pre>Announce( message, playerTo, type )</pre>
<pre>Announce( message, playerTo, type )</pre>




Line 12: Line 12:


== Example ==
== Example ==
<pre>function onPlayerCommand( player, cmd, text)
<source lang=js>function onPlayerCommand(player, cmd, text)
{
{
if (cmd == "ann")//*Made by crystal
    if (cmd == "ann")
     {
     {
         if (!text) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
         if (!text) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
        if (split(text, " ").len() < 3) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
         local v = split(text, " ");
         local v = split(text, " ");
         if (v[1].tolower() == "all") AnnounceAll (text.slice(v[0].len() + v[1].len() + 2), v[0].tointeger());
        if (v.len() < 3) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
         else Announce (text.slice(v[0].len() + v[1].len() + 2), FindPlayer(v[1]), v[0].tointeger());
         if (v[1].tolower() == "all") AnnounceAll(text.slice(v[0].len() + v[1].len() + 2), v[0].tointeger());
         else Announce(text.slice(v[0].len() + v[1].len() + 2), FindPlayer(v[1]), v[0].tointeger());
     }
     }
}</source>

Latest revision as of 11:44, 25 April 2017

Syntax

Announce( message, playerTo, type )


Arguments

  • Player playerTo - The player to send the message to
  • string message - The message to send
  • int type - The type of the message

Example

function onPlayerCommand(player, cmd, text)
{
    if (cmd == "ann")
    {
        if (!text) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
        local v = split(text, " ");
        if (v.len() < 3) return ClientMessage("[#FF0000][Syntax]/ann <ID> <All/Nick/ID> <Text>", player, 0, 0, 0);
        if (v[1].tolower() == "all") AnnounceAll(text.slice(v[0].len() + v[1].len() + 2), v[0].tointeger());
        else Announce(text.slice(v[0].len() + v[1].len() + 2), FindPlayer(v[1]), v[0].tointeger());
    }
}