SendClientMessageToAdmins command
#1

Hello, I have this code and I need change it to ZCMD. Can anyone help me to do that ?
pawn Код:
if(strcmp(cmd, "/admin", true) == 0)
        {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                        SendClientMessage(playerid, COLOR_GRAY, "USAGE: /admin[msg]");
                        return 1;
                }
                else
                {
                        format(string, sizeof(string), "AdmCmd: %s", tmp);
                        SendClientMessageToAdmins(COLOR_ADM_RED, string);
                }
                return 1;
        }
Reply
#2

Do u use Sscanf?
Reply
#3

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
Do u use Sscanf?
Yes.
Reply
#4

pawn Код:
CMD:admin(playerid, params[])
{
    new string[144];

    if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAY, "USAGE: /admin[msg]");

    format(string, sizeof(string), "AdmCmd: %s", params);
    SendClientMessageToAdmins(COLOR_ADM_RED, string);

    return 1;
}
Reply
#5

pawn Код:
CMD:admin(playerid,parmas[])
{
new msg[128],string[130];
if(sscanf(parmas,"s[128]",msg))return SendClientMessage(playerid, COLOR_GRAY, "USAGE: /admin [msg]");
format(string, sizeof(string), "AdmCmd: %s", msg);
SendClientMessageToAdmins(COLOR_ADM_RED, string);
  return 1;}
Reply
#6

pawn Код:
CMD:admin(playerid,parmas[])
{
    new string[128],msg[128];
    if(sscanf(parmas,"s[128]",msg))return SendClientMessage(playerid, COLOR_GRAY, "USAGE: /admin [msg]");
    format(string, sizeof(string), "AdmCmd: %s", msg);
    SendClientMessageToAdmins(COLOR_ADM_RED, string);
    return 1;
}
Reply
#7

There is no point using sscanf with one parameter folks.
Also, why do you two have 'parmas' instead of 'params'? That will cause problems.
Reply
#8

Thanks very much for every one, it's working ))
Reply
#9

Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
There is no point using sscanf with one parameter folks.
Also, why do you two have 'parmas' instead of 'params'? That will cause problems.
It's true - using sscanf for a single string parameter is pointless and all you do is using 1 extra array. isnull is the best option but I'd recommend to declare the string after the isnull check.

The actual reason I'm posting at the moment is because of 'parmas'. I've seen that in other threads too and it's not going to cause any problem at all. You can use any name you want:
pawn Код:
CMD:test(pid, parameters[])
{
    return 1;
}
The above is correct!
Reply
#10

Thanks for the clarification, Konst.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)