Message to all when typed command -
ultrAslan - 09.03.2015
Hello , i need a little function when a player types a cmd like /hello , i want that in chat it shows that PLayer xxx has used /hello . I now it works with sendclientmessage to all but how i can make it with the player ? Thanks
Re: Message to all when typed command -
wooolly - 09.03.2015
use SendClientMessageToAll(-1, "message here");
this will send to all players

Much better than SendClientMessage if you want it to go to ALL players.
If you want it to go to more than one person but not all players, use SendClientMessage in a loop, where the loop will go through all players and use an if statement to determine if it should send the message to them
Код:
hello(string[]) {
SendClientMessageToAll(-1,string);
}
AW: Re: Message to all when typed command -
ultrAslan - 09.03.2015
Quote:
Originally Posted by wooolly
use SendClientMessageToAll(-1, "message here");
this will send to all players  Much better than SendClientMessage if you want it to go to ALL players.
If you want it to go to more than one person but not all players, use SendClientMessage in a loop, where the loop will go through all players and use an if statement to determine if it should send the message to them
Код:
hello(string[]) {
SendClientMessageToAll(-1,string);
}
|
Thanks , but i need when a player types the Command example /hello that it show in chat for all that Player xxx has used /Hello.
thanks
Re: Message to all when typed command -
Misiur - 09.03.2015
With player you have first to format your message:
pawn Код:
new
message[23 + MAX_PLAYER_NAME], // We only need space for "Player " +player name " has used /hello" + end of string indicator
playername[MAX_PLAYER_NAME + 1]
;
GetPlayerName(playerid, playername, sizeof(playername)); //You have to pass playerid to function, in most command processors it's by default passed (ZCMD/YCMD)
format(message, sizeof(message), "Player %s has used /hello", playername);
SendClientMessageToAll(0xBADA55FF, message);
Also check out
format wiki documentation
Re: Message to all when typed command -
ReD_HunTeR - 09.03.2015
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "Player %s has used %s", pName, cmdtext);
SendClientMessageToAll(-1, string);
return 1;
}
Re: Message to all when typed command -
MohanedZzZ - 09.03.2015
No one here understand what he mean
If you don't know what he want then stop shitposting.
First of all use zcmd include.
Here is code,
Код:
CMD:hello(playerid, params[])
{
SendClientMessageToAll(-1, "Player %s has used /hello",pname);
return 1;
}
Re: Message to all when typed command -
ReD_HunTeR - 09.03.2015
Quote:
Originally Posted by MohanedZzZ
No one here understand what he mean
If you don't know what he want then stop shitposting.
First of all use zcmd include.
Here is code,
Код:
CMD:hello(playerid, params[])
{
SendClientMessageToAll(-1, "Player %s has used /hello",pname);
return 1;
}
|
mad?, he's just showing an example of "/hello" -_-
AW: Message to all when typed command -
ultrAslan - 09.03.2015
here is what i try . I Put the Sendlicnetmessage to all but i get error at pname
Quote:
181) : error 017: undefined symbol "playername"
|
Quote:
CMD:radio(playerid)
{
HideRadioTextdraws(playerid);
TextDrawShowForPlayer(playerid,Radio[0]);
TextDrawShowForPlayer(playerid,Radio[1]);
TextDrawShowForPlayer(playerid,Radio[2]);
TextDrawShowForPlayer(playerid,Radio[3]);
Radio_viewing[playerid] =1;
SendClientMessageToAll(-1, "Player %s used /Radio",playername);
return 1;
}
|
Re: Message to all when typed command -
Misiur - 09.03.2015
Check my post, you're missing a few lines
Re: Message to all when typed command -
MohanedZzZ - 10.03.2015
Quote:
Originally Posted by ReD_HunTeR
mad?, he's just showing an example of "/hello" -_-
|
hey yo
Some servers made this command
When player connect he type /hello
Its appear in the chat Player blah blah said hello.
Got it ?
He asked for an example and i posted it.
Eh stay with your CVT leaked script :']