PDA

View Full Version : SendClientMessageToAdmins command


Tadas
16/04/2014, 09:53 AM
Hello, I have this code and I need change it to ZCMD. Can anyone help me to do that ? :)
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;
}

Hanuman
16/04/2014, 09:59 AM
Do u use Sscanf?

Tadas
16/04/2014, 10:04 AM
Do u use Sscanf?

Yes.

PrivatioBoni
16/04/2014, 10:09 AM
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;
}

BroZeus
16/04/2014, 10:09 AM
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;}

Hanuman
16/04/2014, 10:11 AM
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;
}

PrivatioBoni
16/04/2014, 10:13 AM
There is no point using sscanf with one parameter folks.
Also, why do you two have 'parmas' instead of 'params'? That will cause problems.

Tadas
16/04/2014, 10:34 AM
Thanks very much for every one, it's working :)))

Konstantinos
16/04/2014, 11:01 AM
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:

CMD:test(pid, parameters[])
{
return 1;
}

The above is correct!

PrivatioBoni
16/04/2014, 11:42 AM
Thanks for the clarification, Konst.