if(strcmp(cmdtext , "/radio", true) == 0) { if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this."); { if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3)) { new string[128]; new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),"*Radio: %s:%s",playername,cmdtext[128]); SendCopMessage(COLOR_BLUE, string); return 1; } } } return 0; }
SendCopMessage(color, text[]) { for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerConnected(i)) { if(GetPlayerTeam(playerid) != 5) SendClientMessage(i, color, text); } } } }
Originally Posted by OmeRinG
Problems are in the function SendCopMessage...
When you did GetPlayerTeam you used playerid instead of i You used 1 more bracket than you needed to |
if(strcmp(cmdtext , "/radio", true) == 0) { if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this."); { if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3)) { new string[128]; new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),"Police Radio: %s:%s",playername,cmdtext[128]); SendCopMessage(COLOR_BLUE, string); return 1; } } } return 0; }
SendCopMessage(color, text[]) { for(new i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerConnected(i)) { if(GetPlayerTeam(i) != 5) SendClientMessage(i, color, text); } } }