SA-MP Forums Archive
Message gang - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Message gang (/showthread.php?tid=674618)



Message gang - KamilPolska - 23.04.2020

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


Re: Message gang - SiM2hmoud - 23.04.2020

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.


Re: Message gang - KamilPolska - 23.04.2020

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);
	}
}



Re: Message gang - SiaReyes - 24.04.2020

if(GetPlayerTeam(p) == PlayerInfo[playerid][f_Member])


Re: Message gang - KamilPolska - 24.04.2020

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" ...


Re: Message gang - SiM2hmoud - 24.04.2020

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



Re: Message gang - KamilPolska - 24.04.2020

Please code: https://pastebin.com/zXdeTihL


Re: Message gang - Nero_3D - 25.04.2020

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);
        }
    }
}



Re: Message gang - KamilPolska - 25.04.2020

Thanks!