SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/04/2020, 02:06 PM   #1
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 494
Reputation: 5
Default Message gang

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
KamilPolska is offline   Reply With Quote
Old 23/04/2020, 04:34 PM   #2
SiM2hmoud
Little Clucker
 
Join Date: Mar 2020
Location: Tunisia
Posts: 19
Reputation: 12
Flowers Re: Message gang

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.
SiM2hmoud is offline   Reply With Quote
Old 23/04/2020, 04:49 PM   #3
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 494
Reputation: 5
Default Re: Message gang

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);
	}
}
KamilPolska is offline   Reply With Quote
Old 24/04/2020, 02:33 AM   #4
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 618
Reputation: 57
Default Re: Message gang

if(GetPlayerTeam(p) == PlayerInfo[playerid][f_Member])
SiaReyes is offline   Reply With Quote
Old 24/04/2020, 03:08 AM   #5
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 494
Reputation: 5
Default Re: Message gang

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" ...
KamilPolska is offline   Reply With Quote
Old 24/04/2020, 01:04 PM   #6
SiM2hmoud
Little Clucker
 
Join Date: Mar 2020
Location: Tunisia
Posts: 19
Reputation: 12
Default Re: Message gang

Can you send some code?
The one that gets the player's gang & the one that send the message.
SiM2hmoud is offline   Reply With Quote
Old 24/04/2020, 05:06 PM   #7
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 494
Reputation: 5
Default Re: Message gang

Please code: https://pastebin.com/zXdeTihL
KamilPolska is offline   Reply With Quote
Old 25/04/2020, 02:46 AM   #8
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,853
Reputation: 689
Default Re: Message gang

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);
        }
    }
}
Nero_3D is offline   Reply With Quote
Old 25/04/2020, 01:46 PM   #9
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 494
Reputation: 5
Default Re: Message gang

Thanks!
KamilPolska is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gang zone message buzifej Help Archive 5 26/12/2010 09:40 PM
[AJUDA]Gang Zone DOminaveis ( o meu possui /gang criar) rene20 PortuguÍs/Portuguese 2 22/09/2010 05:55 PM
Gang Zone message ruckfules99 Help Archive 5 29/04/2010 11:26 AM
New gang problem - always show message and always respawn 100times at 1 SECOND!! buonggiorno Help Archive 8 19/01/2010 01:29 AM
Does anyone know how to gang gang shooting at gang war then not considered a cri uplovethai Help Archive 0 26/10/2009 01:39 AM


All times are GMT. The time now is 09:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.