11.02.2011, 05:02
when i type "/cm" i get this:
USAGE: /cm (message)
SERVER: Unknown Command
and sometimes it gets an random player id
/cm Hello
cop msg: Unknown(156) Hello
SERVER: Unknown Command
What am i doing wrong
USAGE: /cm (message)
SERVER: Unknown Command
and sometimes it gets an random player id
/cm Hello
cop msg: Unknown(156) Hello
SERVER: Unknown Command
What am i doing wrong
pawn Код:
dcmd_cm(playerid, params[])
{
if(gTeam[playerid] == TEAM_COP ||gTeam[playerid] == TEAM_AIRCOP ||gTeam[playerid] == TEAM_MARINECOP)
{
new message[128];
if(sscanf(params, "s[128]", message)) SendClientMessage(playerid, COLOR_USAGE, "USAGE: /cm (message)");
else
{
new playername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "cop msg: %s(%d) %s", playername, playerid, message);
SendPoliceTeamMessage(COLOR_TEAMCHAT, string);
return 1;
}
}
return 0;
}
pawn Код:
public SendPoliceTeamMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == TEAM_COP ||gTeam[i] == TEAM_AIRCOP ||gTeam[i] == TEAM_MARINECOP)
{
SendClientMessage(i, color, string);
}
}
}
}