/a admin chat help [+rep] - 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: /a admin chat help [+rep] (
/showthread.php?tid=605816)
/a admin chat help [+rep] -
[SU]Spartan - 25.04.2016
So I tried to script this
CMD:a(playerid,params[])
{
new text[256], astring[128];
GetPlayerName(playerid,astring,sizeof(astring));
format(astring,sizeof(astring),"Admin Chat: %s says: %s",pName(pid),text);
MessageToAdmins(COLOR_GREEN,astring);
return 1;
}
it's admin chat.
How it should be working
/a (text) and sends message to all admins online
For example if I use /a test it should send message to admin: Admin Chat: (name) says: a
How it works
It actually sends the message to admins but its blank. the message is not sent,just the Admin Chat: (name) says: <ITS BLANK HERE> and I don't know why.
Re: /a admin chat help [+rep] -
introzen - 25.04.2016
Your string: "text" is not formatted according to the command parameters. Use Sscanf for that.
PHP код:
CMD:a(playerid,params[])
{
new text[85], string[128];
if(sscanf(params, "s[85]", text)) return SendClientMessage(playerid, -1, "USAGE: /a <text>");
format(string,sizeof(string), "Admin Chat: %s says: %s", pName(playerid), text);
MessageToAdmins(COLOR_GREEN, string);
return 1;
}
Re: /a admin chat help [+rep] -
[SU]Spartan - 25.04.2016
repped thanks
Re: /a admin chat help [+rep] -
-CaRRoT - 25.04.2016
You dont need to use sscanf, params exist for a reason when you use ZCMD.