CMD:cr(playerid, params[]) return cmd_radio(playerid, params); CMD:radio(playerid, params[]) { new string[128], text[128], ctext[60], pname[MAX_PLAYER_NAME+1];//establishes a few things needed to tell the players name, rank, and the text he has written. GetPlayerName(playerid, pname, sizeof(pname));//gets the name of the player using /radio if(pInfo[playerid][Faction] == 1)//checks if the player is in the first faction if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} /r(adio) [text]");//if /r is not used correctly it will tell you the correct way to use it { if(pInfo[playerid][FactionTier] == 1){ ctext = "Chief"; }//all of these check the players rank and if(pInfo[playerid][FactionTier] == 2){ ctext = "Deputy Chief"; }// sets each rank to a specific name if(pInfo[playerid][FactionTier] == 3){ ctext = "Squad Commander"; } if(pInfo[playerid][FactionTier] == 4){ ctext = "Traffic Squad Commander"; } if(pInfo[playerid][FactionTier] == 5){ ctext = "S.W.A.T Squad Commander"; } if(pInfo[playerid][FactionTier] == 6){ ctext = "Public Relations Officer"; } if(pInfo[playerid][FactionTier] == 7){ ctext = "Traffic Officer"; } if(pInfo[playerid][FactionTier] == 8){ ctext = "S.W.A.T Unit"; } if(pInfo[playerid][FactionTier] == 9){ ctext = "Senior Officer"; } if(pInfo[playerid][FactionTier] == 10){ ctext = "Trainee Officer"; } format(string, sizeof(string), "(Radio) %s %s: %s", ctext, pname, text); if(pInfo[playerid][Faction] > 0)//if the player is not in a faction it will not send him any messages { SendCopMessage(COLOR_PDRAD, string);//calls a stock below that checks who the /r should be sent to } } return 1; } CMD:er(playerid, params[]) return cmd_emsradio(playerid, params); CMD:emsradio(playerid, params[]) { new string[128], text[128], pname[MAX_PLAYER_NAME+1];//establishes a few things needed to tell the players name, rank, and the text he has written. GetPlayerName(playerid, pname, sizeof(pname));//gets the name of the player using /radio if(pInfo[playerid][Faction] == 2)//checks if the player is in the first faction if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER:{FFFFFF} /r(adio) [text]");//if /r is not used correctly it will tell you the correct way to use it { format(string, sizeof(string), "(Radio) %s: %s", pname, text); if(pInfo[playerid][Faction] == 2) //if the player is not in a faction it will not send him any messages { SendEMSMessage(COLOR_RED, string);//calls a stock below that checks who the /r should be sent to } } return 1; }
CMD:radio(playerid, params[])
{
if (!pInfo[playerid][Faction]) return 1;
if (isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "SERVER:{FFFFFF} /r(adio) [text]");
new string[144], pname[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pname, sizeof(pname));
switch (pInfo[playerid][Faction])
{
case 1:
{
new rnk_name[][] = {"Chief","Deputy Chief","Squad Commander","Traffic Squad Commander","S.W.A.T Squad Commander","Public Relations Officer","Traffic Officer","S.W.A.T Unit","Senior Officer","Trainee Officer"};
format(string, sizeof(string), "(Radio) %s %s: %s", (1 <= pInfo[playerid][FactionTier] <= 10) ? rnk_name[pInfo[playerid][FactionTier]-1] : ("N/A"), pname, params);
SendCopMessage(COLOR_PDRAD, string);
}
case 2:
{
format(string, sizeof(string), "(Radio) %s: %s", pname, params);
SendEMSMessage(COLOR_RED, string);
}
}
return 1;
}
Check this post Here
|