SA-MP Forums Archive
Help with sendclientmessage - 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: Help with sendclientmessage (/showthread.php?tid=422524)



Help with sendclientmessage - arathin - 14.03.2013

Alright what im wanting is for when you attack a gang zone it sends a client message to everyone like so "GANG has initiated a turf war with GANG" Anyway to do this here is the code im using note the first get gang part works"

Код:
            for(new t=0; t < sizeof(Teams); t++) // loop all teams
            {
                if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
                {
                    new string[128];
                    format(string,sizeof(string), "%s have initiated a gang war with %s",GetTeamName(playerid));
                    ZoneAttacker[i] = Teams[t];
                    ZoneAttackTime[i] = 0;
                    GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                    SendClientMessageToAll(COLOR_LIME, string);



Re: Help with sendclientmessage - DaTa[X] - 14.03.2013

you defined the teams ?


Re: Help with sendclientmessage - arathin - 14.03.2013

Yes, I need it to send a message to every telling them which Gang attacked which zone


Re: Help with sendclientmessage - Glad2BeHere - 14.03.2013

pawn Код:
for(new t=0; t < sizeof(Teams); t++) // loop all teams
            {
                if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
                {
                    new string[128];
                    format(string,sizeof(string), "%s have initiated a gang war with %s",GetTeamName(playerid));
                    ZoneAttacker[i] = Teams[t];
                    ZoneAttackTime[i] = 0;
                    GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                    SendClientMessageToAll(COLOR_LIME, string);
pawn Код:
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR)/*
u place the SendClientMessge to all under this.... so the only players seeing the message is the ones called under it*/
pawn Код:
// curious so it should like this
for(new t=0; t < sizeof(Teams); t++) // loop all teams
{
                if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
                {
                    new string[128];
                    format(string,sizeof(string), "%s have initiated a gang war with %s",GetTeamName(playerid));
                    ZoneAttacker[i] = Teams[t];
                    ZoneAttackTime[i] = 0;
                    GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                    SendClientMessageToAll(COLOR_LIME, string);
                  }
                  SendClientMessageToAll(COLOR_LIME, string);
}
secondly u have %s twice put only 1 value so u might wanna look at that
format(string,sizeof(string), "%s have initiated a gang war with %s",GetTeamName(playerid));