/announce cmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /announce cmd (
/showthread.php?tid=403101)
/announce cmd -
Captain_jeffree95 - 29.12.2012
Can someone show me an example of a /announce command that shows what you type as gametext
e.g.
/announce <text>
then show up as clientmessage and gametext pls help.
Re: /announce cmd -
Ballu Miaa - 29.12.2012
Posting both the methods below. To use this command you will need ZCMD by Zeek and sscanf by ******.
EDIT:
The SendClientMessage one!
pawn Код:
COMMAND:announce(playerid, params[])
{
new string[128],msg[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid,-1, "USAGE: /ann [Admin Message]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "You are not authorised to use this command!");
format(string,sizeof(string),"* [Admin] : %s %s *",pname,msg);
SendClientMessageToAll(-1,string);
return 1;
}
Game Text one!
pawn Код:
COMMAND:announce(playerid, params[])
{
new string[128],msg[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid,-1, "USAGE: /ann [Admin Message]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1, "You are not authorised to use this command!");
format(string,sizeof(string),"[%s]: %s",pname,msg);
GameTextForPlayer( playerid, string, 5000, 3 );
return 1;
}
Re: /announce cmd -
[HK]Ryder[AN] - 29.12.2012
Quote:
Originally Posted by Ballu Miaa
Posting both the methods below. To use this command you will need ZCMD by Zeek and sscanf by ******.
The SendClientMessage one!
pawn Код:
COMMAND:announce(playerid, params[]) { new string[128],msg[128],pname[MAX_PLAYER_NAME]; GetPlayerName(playerid,pname,sizeof(pname)); if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid,COLOR_WHITE, "USAGE: /ann [Admin Message]"); if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GRAD2, "You are not authorised to use this command!"); format(string,sizeof(string),"* [Admin] : %s *",msg); SendClientMessageToAll(COLOR_DBLUE,string); return 1; }
Game Text one!
pawn Код:
COMMAND:announce(playerid, params[]) { new string[128],msg[128],pname[MAX_PLAYER_NAME]; GetPlayerName(playerid,pname,sizeof(pname)); if(sscanf(params,"s[128]",msg)) return SendClientMessage(playerid,COLOR_WHITE, "USAGE: /ann [Admin Message]"); if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GRAD2, "You are not authorised to use this command!"); format(string,sizeof(string),"Admin: %s",msg); GameTextForPlayer( playerid, string, 5000, 3 ); return 1; }
|
@Ballu - You should be more careful. He will get undefined symbol errors cuz of the colors.
Re: /announce cmd -
Faisal_khan - 29.12.2012
Quote:
Originally Posted by [HK]Ryder[AN]
@Ballu - You should be more careful. He will get undefined symbol errors cuz of the colors.
|
Haha got him this time :P
Re: /announce cmd -
Ballu Miaa - 29.12.2012
Quote:
Originally Posted by Faisal_khan
Haha got him this time :P
|
Haha True Faisal! You're right this time Haardik.
![Cheesy](images/smilies/biggrin.png)
I Edited it.