14.04.2016, 17:31
Код:
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; }
so i dont have to make a new radio cmd for each faction i mean...