02.08.2011, 20:18
Create a variable to store whether the player is a police officer or not (if you haven't already) then create a command which stores the input of the officer's radio message, check if the params are null, then create a new string and format it however you want, then create a loop through all of the online players and checks if the player is a police officer (using the variable I told you to create) and send the message to the player if they are a police officer, and allow this to loop through all players, so all police officers will receive the message.
Example:
At the top of your script or near it:
In the area where you create your commands (note: this uses zcmd)
Example:
At the top of your script or near it:
pawn Код:
new g_iPoliceOfficer[MAX_PLAYERS];
pawn Код:
CMD:radio(playerid, params[]) {
if(isnull(params))
return SendClientMessage(playerid, 0, "Syntax: /radio [message]");
if(g_iPoliceOfficer[i] != 0)
return SendClientMessage(playerid, 0, "Cops only...");
new
szMessage[128],
szPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "** (radio) Officer %s: %s", szPlayerName, params);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && g_iPoliceOfficer[i] != 0)
SendClientMessage(playerid, 0, szMessage);
}
return 1;
}