Commands
#1

Hello,


How I can do this:


When the player types any command send a message to all with the command,

Like this:

Alex_Obando just typed /hello
Reply
#2

hey alex first

@ OnPlayerCommandText do

like
pawn Код:
if(Isadmin > 3)
{
  format(string, sizeof(string), "player %s (%d) have typed Command: %s", pName(playerid),playerid,cmdtext);
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
  SendClientMessage(i, COLOR_WHITE, string);
  }
}
Reply
#3

hey alex haha.. UnknownKiller is a good helper eh ?..good luck with ur thingy
Reply
#4

Hey thanks UK :P

Hows your server anyways?
Reply
#5

OnPlayerCommandText:
pawn Код:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, sizeof(str), "%s (%d) just typed: %s", pName,playerid,cmdtext);
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        SendClientMessage(i, -1, str);
    }
}
Reply
#6

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
Hey thanks UK :P

Hows your server anyways?
Its pretty cool alex visit us you are welcome anytime
Reply
#7

Quote:
Originally Posted by UnknownKilla2
Посмотреть сообщение
Its pretty cool alex visit us you are welcome anytime
Try and stay on topic.
If you want to talk do it in pm , or some messager.

Here isn't the place.
Reply
#8

Quote:
Originally Posted by Russell_
Посмотреть сообщение
OnPlayerCommandText:
pawn Код:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, sizeof(str), "%s (%d) just typed: %s", pName,playerid,cmdtext);
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        SendClientMessage(i, -1, str);
    }
}
Gave you +1 Reputation.
Btw, How do I do like a variable like this:
/messageson
You will now be able to see the commands that the players type.

/messagesoff
You wont be longer able to see the commands.
Reply
#9

pawn Код:
//On top of script:
new bool:EnabledCmds[MAX_PLAYERS];

//Already given, just modify little:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, sizeof(str), "%s (%d) just typed: %s", pName,playerid,cmdtext);
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i) && EnabledCmds[i])
    {
        SendClientMessage(i, -1, str);
    }
}

//In your /message command: (Single command to turn on-off)
if(!EnabledCmds[playerid])
{ EnabledCmds[playerid] = true; SendClientMessage(playerid, 0x00FF00FF, "Enabled..."); }
else
{ EnabledCmds[playerid] = false; SendClientMessage(playerid, 0xFF0000FF, "Disabled..."); }
Reply
#10

^
|
|
|
|
|
Reply
#11

Thank you very much, iPLEOMAX see pm.
+1 reputation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)