11.11.2012, 18:38
Can someone tell me what's wrong with this ?
I made it so there's 2 frequencies, you can only listen to the command if ur in one of these 2 frequencies, and u have a radio, but only ID 0 can read the message, and if he ain't the one sending the mssage, it doesn't gets the player name.
Help will be appreciated.
I made it so there's 2 frequencies, you can only listen to the command if ur in one of these 2 frequencies, and u have a radio, but only ID 0 can read the message, and if he ain't the one sending the mssage, it doesn't gets the player name.
pawn Код:
CMD:ra(playerid, params[])
{
new name[MAX_PLAYER_NAME], string[128];
if(PlayerData[playerid][LSPDRank] < 1 && PlayerData[playerid][FBIRank] < 1) return SendClientMessage(playerid, GRAY, "You must be a Trainee / Agent Trainee or higher to use this command ! ");
if(PlayerData[playerid][Duty] == 0) return SendClientMessage(playerid, GRAY, "You're not on police duty ! ");
if(PlayerData[playerid][Radio] == 0) return SendClientMessage(playerid, GRAY, "You don't have a police radio ! ");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, GRAY, "Function : /ra [ text ]");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid, i) < 5 && PlayerData[playerid][Frequency] == 1 && i != playerid)
{
format(string, sizeof(string),"[LSPD Radio] %s: %s, over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid, i) < 5 && PlayerData[playerid][Frequency] == 2 && i != playerid)
{
format(string, sizeof(string),"[FBI Radio] %s: %s, over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 1 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Trainee %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 1 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Agent Trainee %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 1 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Trainee %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 1 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Agent Trainee %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 2 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Academy Cadet %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 2 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Agent in Training %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 2 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Academy Cadet %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 2 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Agent in Training %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 3 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Police Cadet %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 3 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Sub Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 3 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Police Cadet %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 3 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Sub Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 4 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Police Officer %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 4 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 4 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Police Officer %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 4 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 5 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD] Senior Lead Officer %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 5 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Agent in Charge %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 5 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Senior Lead Officer %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 5 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Agent in Charge %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 6 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Sergeant %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 6 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Special Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 6 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Sergeant %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 6 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Special Agent %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 7 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Lieutenant %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 7 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Section Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 7 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Lieutenant %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 7 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Section Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 8 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Captain %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 8 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Chief in Charge %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 8 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Captain %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 8 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Chief in Charge %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 9 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Police Commander %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 9 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Deputy Assistant Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 9 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Police Commander %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 9 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Deputy Assistant Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 10 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Co-Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 10 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Deputy Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 10 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Co-Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 10 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Deputy Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 11 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Police Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 11 && PlayerData[i][Frequency] == 1 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[LSPD Radio] Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][LSPDRank] == 11 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Police Chief %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
if(PlayerData[i][FBIRank] == 11 && PlayerData[i][Frequency] == 2 && PlayerData[i][Radio] == 1)
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[FBI Radio] Director %s : %s , over.", name, params);
SendClientMessage(i, GRAY, string);
return 1;
}
return 1;
}
return 1;
}