08.12.2010, 05:01
Hello everybody, all commands I have like /ban [id], /slap [id], /givemoney [id], /makeadmin [id], etc.. when I type /makeadmin or any other command without the extra parameter (ID) it returns the correct usage, but If I type the ID it says 'SERVER: Unknown command'
This is the main template for the commands (for admins) that have extra parameters.
Now a 'full command'
Help is really appreciated.
P.S: I know I use 256 cells in a small var, dont remind it to me.
This is the main template for the commands (for admins) that have extra parameters.
pawn Код:
if(strcmp(cmdtext, "/command", true)==0)
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if (!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: /usage");
}
if(PlayerInfo[playerid][pAdminLevel] == 2)
{
return 1;
}
else SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: You are not an admin !");
if(strval(tmp) == playerid) SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot do this on yourself!");
if(strval(tmp) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Invalid ID.");
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/makegolden", true)==0)
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if (!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: /makegolden");
}
if(PlayerInfo[playerid][pAdminLevel] == 2)
{
new string[50], string2[50], adminname[MAX_PLAYER_NAME], givename[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
GetPlayerName(playerid, givename, sizeof(givename));
format(string, sizeof(string), " Administrator %s has made you a Golden User. Thanks for donating!", adminname);
format(string2, sizeof(string2), " You have made %s a Golden User.", givename);
SendClientMessage(playerid,COLOR_YELLOW,string2);
SendClientMessage(strval(tmp),COLOR_YELLOW,string);
PlayerInfo[strval(tmp)][pIsGolden] = 1;
return 1;
}
else SendClientMessage(playerid,COLOR_GRAY,"[SERVER]: You are not an admin !");
if(strval(tmp) == playerid) SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot do this on yourself!");
if(strval(tmp) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR]: Invalid ID.");
return 1;
}
P.S: I know I use 256 cells in a small var, dont remind it to me.