Message gang
#1

Hello. How to make a message for players who are available and in the same gang. With this message for the player "Your gang %s has taken over a territory not belonging to any gang". %s - FracName Gang.

https://pastebin.com/UZkZWSAM
Reply
#2

I think it's possible by using foreach and run a loop to check all the players, then send the message only to the players who are inside that gang.
Reply
#3

Yes but some mistake. When I'm in the Ballas gang and taking over the area, it shows me the message "Your Vagos gang has taken over territory not belonging to any gang". I'm not in Vagos but Ballas
Code:
foreach(Player, p)
{
	format(str, sizeof(str), "Your gang %s has taken over a territory not belonging to any gang", FracInfo[ZoneInfo[i][ZoneAttacker]][FracName]);
	if(GetPlayerTeam(p) == PlayerInfo[p][f_Member])
	{
		SendClientMessage(p, -1, str);
	}
}
Reply
#4

if(GetPlayerTeam(p) == PlayerInfo[playerid][f_Member])
Reply
#5

I still have a problem with this message. I'm in the Grove gang, it shows me the message "Your gang Ballas has taken over the territory" and when I'm in the Ballas gang, "Your gang Vagos has taken over the territory" ...
Reply
#6

Can you send some code?
The one that gets the player's gang & the one that send the message.
Reply
#7

Please code: https://pastebin.com/zXdeTihL
Reply
#8

The ganid / factionid isn't the index so you got the wrong entry
pawn Code:
format(str, sizeof(str), "Your gang %s has taken over a territory not belonging to any gang", GetFactionName(ZoneInfo[i][ZoneAttacker]));
SendFactionMessage(ZoneInfo[i][ZoneAttacker], str);
pawn Code:
GetFactionName(factionid) {
    new name[40];

    for(new t = 0; t < sizeof(FracInfo); t++) {
        if(FracInfo[t][FracID] == factionid) {
            strcat(name, FracInfo[t][FracName]);
            return name;
        }
    }
    name = "Undefined";
    return name;
}

SendFactionMessage(factionid, message[]) {
    foreach(Player, p) {
        if(GetPlayerTeam(p) == factionid) {
            SendClientMessage(p, -1, str);
        }
    }
}
Reply
#9

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)