/a admin chat help [+rep]
#1

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.
Reply
#2

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_GREENstring);
    return 
1;

Reply
#3

repped thanks
Reply
#4

You dont need to use sscanf, params exist for a reason when you use ZCMD.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)