01.03.2012, 19:59
Hi, i have problem with a command, which keeps returning "Server: Unknown command" and i can't seem to find out why it does so.
I'm not sure if your allowed to use switches in commands, but i did try make it "if's", and it had the same problem, so i don't think that's whats wrong.
EDIT: Forgot to mention, if i put none or 1 parameters, it will write the "SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: /setteam [playerid][team]");" message, but if i write both parameters it says Server: Unknown command.
EDIT2: Fixed, changed param "u" to "i".
pawn Код:
dcmd_setteam(playerid, params[])
{
new pid,team;
if(sscanf(params,"ui",pid,team)) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: /setteam [playerid][team]");
if(logged[pid] == 0) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: That player is not online.");
if(team < 0 || team > 2) return SendClientMessage(playerid,COLOR_RED,"[SYSTEM]: Team has to be Civil (0), team1 (1) or team2 (2)");
else{
new str[128], name[MAX_PLAYER_NAME],nTeam[40];
GetPlayerName(pid,name,sizeof(name));
switch(team){
case 0: nTeam = "Civils";
case 1: nTeam = "Team1";
case 2: nTeam = "Team2";
}
format(str,sizeof(str),"%s has joined %s!",name,nTeam);
SendClientMessageToAll(COLOR_GREEN,str);
PlayerInfo[pid][pTeam] = team;
return 1;
}
}
EDIT: Forgot to mention, if i put none or 1 parameters, it will write the "SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: /setteam [playerid][team]");" message, but if i write both parameters it says Server: Unknown command.
EDIT2: Fixed, changed param "u" to "i".