SendClientMessageToAdmins command -
Tadas - 16.04.2014
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;
}
Re: SendClientMessageToAdmins command -
Hanuman - 16.04.2014
Do u use Sscanf?
Re: SendClientMessageToAdmins command -
Tadas - 16.04.2014
Quote:
Originally Posted by Hanuman
Do u use Sscanf?
|
Yes.
Re: SendClientMessageToAdmins command -
PrivatioBoni - 16.04.2014
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;
}
Re: SendClientMessageToAdmins command -
BroZeus - 16.04.2014
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;}
Re: SendClientMessageToAdmins command -
Hanuman - 16.04.2014
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;
}
Re: SendClientMessageToAdmins command -
PrivatioBoni - 16.04.2014
There is no point using sscanf with one parameter folks.
Also, why do you two have 'parmas' instead of 'params'? That will cause problems.
Re: SendClientMessageToAdmins command -
Tadas - 16.04.2014
Thanks very much for every one, it's working

))
Re: SendClientMessageToAdmins command -
Konstantinos - 16.04.2014
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!
Re: SendClientMessageToAdmins command -
PrivatioBoni - 16.04.2014
Thanks for the clarification, Konst.