20.01.2014, 13:56
Hey guys, I've got another problemo. This time, my department radio isn't functioning properly.
It will come up like this.
** LSPD () Firstname Lastname:
It's supposed to come up like this.
** LSPD Rank (Division) Firstname Lastname
or another example..
** LSPD Chief of Police (ADM) James Monroe:
I have the department radio set to the ranks and the divisions load from a file. Nothing is corrupted in the file, because it works on my radio (/r) command perfectly.
Department Radio code
My radio code..
The radio code comes BEFORE the department radio code, so that might be the problem?
It will come up like this.
** LSPD () Firstname Lastname:
It's supposed to come up like this.
** LSPD Rank (Division) Firstname Lastname
or another example..
** LSPD Chief of Police (ADM) James Monroe:
I have the department radio set to the ranks and the divisions load from a file. Nothing is corrupted in the file, because it works on my radio (/r) command perfectly.
Department Radio code
pawn Код:
CMD:dept(playerid, params[])
{
new string[128];
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/d)epartments [department chat]");
new employer[16], rank[64], division[16];
switch (PlayerInfo[playerid][pMember]) // employer/rank/division data is pulled from here
{
case 1:
{
employer = "LSPD";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac1ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac1divisions.txt"
}
}
case 2:
{
employer = "FBI";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac2ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac2divisions.txt"
}
}
case 3:
{
employer = "DHS";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac3ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac3divisions.txt"
}
}
case 4:
{
employer = "LSFMD";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac4ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac4divisions.txt"
}
}
case 5:
{
employer = "";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac5ranks.txt"
}
}
case 6:
{
employer = "State";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac6ranks.txt"
}
}
case 7:
{
employer = "SAST";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac7ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac7divisions.txt"
}
}
case 11:
{
employer = "National Guard";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac11ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac11divisions.txt"
}
}
case 13:
{
employer = "NOOSE";
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac13ranks.txt"
}
#include "..\scriptfiles\factioninfo\fac13divisions.txt"
}
default:
{
SendClientMessageEx(playerid,COLOR_GRAD2,"You're not in a faction.");
return 1;
}
}
format(string, sizeof(string), "** %s %s (%s) %s: %s **", employer, rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(1, DEPTRADIO, string);
SendRadioMessage(2, DEPTRADIO, string);
SendRadioMessage(3, DEPTRADIO, string);
SendRadioMessage(4, DEPTRADIO, string);
SendRadioMessage(5, DEPTRADIO, string);
SendRadioMessage(6, DEPTRADIO, string);
SendRadioMessage(7, DEPTRADIO, string);
SendRadioMessage(11, DEPTRADIO, string);
SendRadioMessage(13, DEPTRADIO, string);
format(string, sizeof(string), "(radio) %s",params);
SetPlayerChatBubble(playerid,string,COLOR_WHITE,15.0,5000);
foreach(Player, i)
{
if(PlayerInfo[i][pReceiver] > 0)
{
if(GetPVarInt(i, "pReceiverOn") == 1)
{
if(GetPVarInt(i, "pReceiverMLeft") > 0)
{
format(string, sizeof(string), "** Receiver: %s **", params);
SendClientMessageEx(i, DEPTRADIO, params);
SetPVarInt(i, "pReceiverMLeft", GetPVarInt(i, "pReceiverMLeft") - 1);
}
else
{
PlayerInfo[i][pReceiver]--;
SetPVarInt(i, "pReceiverMLeft", 4);
SendClientMessageEx(i, DEPTRADIO, "Your receiver ran out of batteries!");
}
}
}
return 1;
}
return 1;
}
pawn Код:
CMD:r(playerid, params[])
{
new string[128];
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/r)adio [radio chat]");
new rank[64], division[16];
switch (PlayerInfo[playerid][pMember]) // employer/rank/division data is pulled from here
{
case 1:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac1ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac1divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(1, RADIO, string);
}
case 2:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac2ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac2divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(2, RADIO, string);
}
case 3:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac3ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac3divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(3, TEAM_DHS, string);
}
case 4:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac4ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac4divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(4, TEAM_LSFMD_COLOR, string);
}
case 5:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac5ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac5divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(5, COLOR_GRAD2, string);
}
case 6:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac6ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac6divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(6, COLOR_GRAD4, string);
}
case 7:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac7ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac7divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(7, TEAM_SAST, string);
}
case 9:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac9ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac9divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(9, TEAM_NEWS_COLOR, string);
}
case 11:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac11ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac11divisions.txt"
}
format(string, sizeof(string), "** %s (%s) %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(11, COLOR_LIGHTGREEN, string);
}
case 12:
{
if(PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 0)
{
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Citizen";
case 2: rank = "People's Representative";
case 3: rank = "Tribal Representative";
case 4: rank = "Mayor";
case 5: rank = "Ruling Council Member";
case 6: rank = "Executive Officer of RC";
default: rank = "Citizen";
}
}
else if(PlayerInfo[playerid][pDivision] == 2)
{
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Citizen";
case 2: rank = "Private";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "General";
case 6: rank = "Executive Officer of RC";
default: rank = "Citizen";
}
}
else if(PlayerInfo[playerid][pDivision] == 3)
{
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Citizen";
case 2: rank = "Trainee";
case 3: rank = "Lieutenant";
case 4: rank = "Captain";
case 5: rank = "Chief";
case 6: rank = "Executive Officer of RC";
default: rank = "Citizen";
}
}
else if(PlayerInfo[playerid][pDivision] == 4)
{
switch(PlayerInfo[playerid][pRank])
{
case 1: rank = "Citizen";
case 2: rank = "Aide";
case 3: rank = "Staff";
case 4: rank = "Ambassador";
case 5: rank = "Councelor General";
case 6: rank = "Executive Officer of RC";
default: rank = "Citizen";
}
}
switch(PlayerInfo[playerid][pDivision])
{
case 1: division = "";
case 2: division = " (AF)";
case 3: division = " (ES)";
case 4: division = " (DC)";
default: division = " (G.D.)";
}
format(string, sizeof(string), "** %s%s %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(12, TEAM_STR_COLOR, string);
}
case 13:
{
switch(PlayerInfo[playerid][pRank])
{
#include "..\scriptfiles\factioninfo\fac13ranks.txt"
}
switch(PlayerInfo[playerid][pDivision])
{
#include "..\scriptfiles\factioninfo\fac13divisions.txt"
}
format(string, sizeof(string), "** %s%s %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
SendRadioMessage(13, COLOR_NOOSE, string);
}
default:
{
SendClientMessageEx(playerid,COLOR_GRAD2,"You're not in a faction.");
return 1;
}
}
format(string, sizeof(string), "(radio) %s",params);
SetPlayerChatBubble(playerid,string,COLOR_WHITE,15.0,5000);
return 1;
}