BARRICADES System bug [COP RADIO BUG]
#1

Hello SA:MP,
I found a bug. When someone /crb (creates a barricade) the message which should show it only on cop radio appears to EVERYBODY (Normal players) ..and not at the cop radio..

Can you help me?

THANK YOU!

Код:
	//Barricade System
  if(dialogid == BARRICADES)
	{
	if(response == 1)
	{

	   if(listitem == 0)
	   {
         if(IsACop(playerid)){
		if(IsPlayerInAnyVehicle(playerid)){
			return SendClientMessageEx(playerid, COLOR_GREY, "You must be on the ground to use this command");
		}
		if(PlayerInfo[playerid][pRank] < 3){
			return SendClientMessageEx(playerid, COLOR_GREY, "You need to be of rank 3.");
		}
		new  Float:Position[4];
		for(new i; i<MAX_BARRICADES; i++){
			if(Barricade[i] == 0){
				GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
				GetPlayerFacingAngle(playerid, Position[3]);
				Barricade[i] = CreateDynamicObject(981, Position[0], Position[1], Position[2], 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
				SetPlayerPos(playerid, Position[0], Position[1], Position[2]+5);
				new zone[MAX_ZONE_NAME];
				GetPlayer3DZone(playerid, zone, sizeof(zone));
				{
 				SendRadioMessage(1, DEPTRADIO, string);
				SendRadioMessage(2, DEPTRADIO, string);
				SendRadioMessage(3, DEPTRADIO, string);
				SendRadioMessage(5, DEPTRADIO, string);
				SendRadioMessage(7, DEPTRADIO, string);
				SendRadioMessage(11, DEPTRADIO, string);
				SendRadioMessage(13, DEPTRADIO, string);
				format(string, sizeof(string), "HQ: A barricade has been placed by %s in %s.", GetPlayerNameEx(playerid), zone);
				}
				foreach(Player, x){
					if(IsACop(x)){
						SendClientMessageEx(x, TEAM_BLUE_COLOR, string);
						if (PlayerInfo[x][pRank] >= 3){
							SendClientMessageEx(x, COLOR_YELLOW, "You can remove a barricade by typing /rrb.");
						}
					}
				}
				return 1;
			}
		}
		SendClientMessageEx(playerid, COLOR_GREY, "All available barriers have been deployed.");
	}
	else{ SendClientMessageEx(playerid, COLOR_GREY, "You're not SAPD / SAEM / FBI."); } return 1;


	    }
	    if(listitem == 1)
	    {
if(IsACop(playerid)){
		if(IsPlayerInAnyVehicle(playerid)){
			return SendClientMessageEx(playerid, COLOR_GREY, "You must be on the ground to use this command");
		}
		if(PlayerInfo[playerid][pRank] < 3){
			return SendClientMessageEx(playerid, COLOR_GREY, "You need to be of rank 3.");
		}
		new  Float:Position[4];
		for(new i; i<MAX_BARRICADES; i++){
			if(Barricade[i] == 0){
				GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
				GetPlayerFacingAngle(playerid, Position[3]);
				Barricade[i] = CreateDynamicObject(1459, Position[0], Position[1], Position[2], 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
				SetPlayerPos(playerid, Position[0], Position[1], Position[2]+5);
				new zone[MAX_ZONE_NAME];
				GetPlayer3DZone(playerid, zone, sizeof(zone));
				{
 				SendRadioMessage(1, DEPTRADIO, string);
				SendRadioMessage(2, DEPTRADIO, string);
				SendRadioMessage(3, DEPTRADIO, string);
				SendRadioMessage(5, DEPTRADIO, string);
				SendRadioMessage(7, DEPTRADIO, string);
				SendRadioMessage(11, DEPTRADIO, string);
				SendRadioMessage(13, DEPTRADIO, string);
				format(string, sizeof(string), "HQ: A barricade has been placed by %s in %s.", GetPlayerNameEx(playerid), zone);
				}
				foreach(Player, x){
					if(IsACop(x)){
						SendClientMessageEx(x, TEAM_BLUE_COLOR, string);
						if (PlayerInfo[x][pRank] >= 3){
							SendClientMessageEx(x, COLOR_YELLOW, "You can remove a barricade by typing /rrb.");
						}
					}
				}
				return 1;
			}
		}
		SendClientMessageEx(playerid, COLOR_GREY, "All available barriers have been deployed.");
	}
	else{ SendClientMessageEx(playerid, COLOR_GREY, "You're not SAPD / SAEM / FBI."); } return 1;


	    }
    	if(listitem == 2)
        {
if(IsACop(playerid)){
		if(IsPlayerInAnyVehicle(playerid)){
			return SendClientMessageEx(playerid, COLOR_GREY, "You must be on the ground to use this command");
		}
		if(PlayerInfo[playerid][pRank] < 3){
			return SendClientMessageEx(playerid, COLOR_GREY, "You need to be of rank 3.");
		}
		new  Float:Position[4];
		for(new i; i<MAX_BARRICADES; i++){
			if(Barricade[i] == 0){
				GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
				GetPlayerFacingAngle(playerid, Position[3]);
				Barricade[i] = CreateDynamicObject(978, Position[0], Position[1], Position[2]+0.6, 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
				SetPlayerPos(playerid, Position[0], Position[1], Position[2]+5);
				new zone[MAX_ZONE_NAME];
				GetPlayer3DZone(playerid, zone, sizeof(zone));
				{
 				SendRadioMessage(1, DEPTRADIO, string);
				SendRadioMessage(2, DEPTRADIO, string);
				SendRadioMessage(3, DEPTRADIO, string);
				SendRadioMessage(5, DEPTRADIO, string);
				SendRadioMessage(7, DEPTRADIO, string);
				SendRadioMessage(11, DEPTRADIO, string);
				SendRadioMessage(13, DEPTRADIO, string);
				format(string, sizeof(string), "HQ: A barricade has been placed by %s in %s.", GetPlayerNameEx(playerid), zone);
				}
				foreach(Player, x){
					if(IsACop(x)){
						SendClientMessageEx(x, TEAM_BLUE_COLOR, string);
						if (PlayerInfo[x][pRank] >= 3){
							SendClientMessageEx(x, COLOR_YELLOW, "You can remove a barricade by typing /rrb.");
						}
					}
				}
				return 1;
			}
		}
		SendClientMessageEx(playerid, COLOR_GREY, "All available barriers have been deployed.");
	}
	else{ SendClientMessageEx(playerid, COLOR_GREY, "You're not SAPD / SAEM / FBI."); } return 1;


	    }
	    if(listitem == 3)
        {
if(IsACop(playerid)){
		if(IsPlayerInAnyVehicle(playerid)){
			return SendClientMessageEx(playerid, COLOR_GREY, "You must be on the ground to use this command");
		}
		if(PlayerInfo[playerid][pRank] < 3){
			return SendClientMessageEx(playerid, COLOR_GREY, "You need to be of rank 3.");
		}
		new  Float:Position[4];
		for(new i; i<MAX_BARRICADES; i++){
			if(Barricade[i] == 0){
				GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
				GetPlayerFacingAngle(playerid, Position[3]);
				Barricade[i] = CreateDynamicObject(18728, Position[0], Position[1], Position[2]-2.8, 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
				new zone[MAX_ZONE_NAME];
				GetPlayer3DZone(playerid, zone, sizeof(zone));
				{
 				SendRadioMessage(1, DEPTRADIO, string);
				SendRadioMessage(2, DEPTRADIO, string);
				SendRadioMessage(3, DEPTRADIO, string);
				SendRadioMessage(5, DEPTRADIO, string);
				SendRadioMessage(7, DEPTRADIO, string);
				SendRadioMessage(11, DEPTRADIO, string);
				SendRadioMessage(13, DEPTRADIO, string);
				format(string, sizeof(string), "HQ: A flare was set by %s in %s.", GetPlayerNameEx(playerid), zone);
				}
				foreach(Player, x){
					if(IsACop(x)){
						SendClientMessageEx(x, TEAM_BLUE_COLOR, string);
						if (PlayerInfo[x][pRank] >= 3){
							SendClientMessageEx(x, COLOR_YELLOW, "You can remove a barricade by typing /rrb.");
						}
					}
				}
				return 1;
			}
		}
		SendClientMessageEx(playerid, COLOR_GREY, "All available barriers have been deployed.");
	}
	else{ SendClientMessageEx(playerid, COLOR_GREY, "You're not SAPD / SAEM / FBI."); } return 1;

	    }
	    if(listitem == 4)
        {
if(IsACop(playerid)){
		if(IsPlayerInAnyVehicle(playerid)){
			SendClientMessageEx(playerid, COLOR_GREY, "You must be on the ground to use this command");
			return 1;
		}
		if(PlayerInfo[playerid][pRank] < 3){
			SendClientMessageEx(playerid, COLOR_GREY, "You need to be of rank 3.");
			return 1;
		}
		new  Float:Position[4];
		for(new i; i<MAX_BARRICADES; i++){
			if(Barricade[i] == 0){
				GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
				GetPlayerFacingAngle(playerid, Position[3]);
				Barricade[i] = CreateDynamicObject(1238, Position[0], Position[1], Position[2]-0.7, 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
				new zone[MAX_ZONE_NAME];
				GetPlayer3DZone(playerid, zone, sizeof(zone));
				{
 				SendRadioMessage(1, DEPTRADIO, string);
				SendRadioMessage(2, DEPTRADIO, string);
				SendRadioMessage(3, DEPTRADIO, string);
				SendRadioMessage(5, DEPTRADIO, string);
				SendRadioMessage(7, DEPTRADIO, string);
				SendRadioMessage(11, DEPTRADIO, string);
				SendRadioMessage(13, DEPTRADIO, string);
				format(string, sizeof(string), "HQ: A cone has been placed by %s in %s.", GetPlayerNameEx(playerid), zone);
				}
				foreach(Player, x){
					if(IsACop(x)){
						SendClientMessageEx(x, TEAM_BLUE_COLOR, string);
						if (PlayerInfo[x][pRank] >= 3){
							SendClientMessageEx(x, COLOR_YELLOW, "You can remove a barricade by typing /rrb.");
						}
					}
				}
				return 1;
			}
		}
		SendClientMessageEx(playerid, COLOR_GREY, "All available barriers have been deployed.");
	}
	else{ SendClientMessageEx(playerid, COLOR_GREY, "You're not SAPD / SAEM / FBI.");} return 1;


	    }
	 }
	}
Reply
#2

someone please?
Reply
#3

this part of it looks fine.
i think you mightve made a mistake elsewhere,
maybe your script considers everyone a cop.
or maybe you just didnt test it well
Reply
#4

Replace foreach(player,x) with foreach(new x:Player)
Reply
#5

Still bugged.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)