ABroadCast Bug
#1

Why when I Give wanted to somebody appear 2 times on ABroadCast , if we are 2 players 2 times , 3-4 players 3-4 times , Why?

Screen ; CLICK HERE

The Code :
pawn Код:
format(string1, sizeof(string), "%s has gave wanted %d to %s", sendername, money, giveplayer);
                                    WantedLog(string1);
                                    ABroadCast(COLOR_YELLOW,string1,1);
Maybe because we are 2 admins online?

+rep
Reply
#2

Give us the Function...
Reply
#3

forward ABroadCast(color,const string[],level);
Reply
#4

Not that, public ABroadCast... and all code between { and }.
Reply
#5

The Callback, lol...
Something like:
pawn Код:
public ABroadCast(color,const string[],level)
{
    // Code
}
EDIT: 1 min difference...
Reply
#6

ow , sorry my fault

pawn Код:
public ABroadCast(color,const string[],level)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if (PlayerInfo[i][pAdmin] >= level)
            {
                SendClientMessage(i, color, string);
                printf("%s", string);
            }
        }
    }
    return 1;
}
Reply
#7

That function looks alright, show us the rest of the code, near
Код:
format(string1, sizeof(string), "%s has gave wanted %d to %s", sendername, money, giveplayer);
                                    WantedLog(string1);
                                    ABroadCast(COLOR_YELLOW,string1,1);
And WantedLog function.
Reply
#8

pawn Код:
//----------------------------------[SetCrim]-----------------------------------------------
      if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (IsACop(playerid))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        result[0] = toupper(result[0]);
                        if(!strlen(result)) return SendClientMessage(playerid, -1, "USAGE: /(su)spect [PlayerID/PartOfName] [WantedLevel] [Reason]");
                        //if (gTeam[playa] == 2 || IsACop(playa)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "You can't suspect a cop");
                        if(money > 10) return SendClientMessage(playerid, COLOR_GRAD1, "Maximum wanted level is 10!");
                        if(money == 0) return SendClientMessage(playerid, COLOR_GRAD1, "Minimum wanted level is 0!");
                        if(WantedLevel[playa] == 10) return SendClientMessage(playerid, COLOR_GRAD1, "That player already have wanted level 10");
                        if(WantedLevel[playa] + money > 10) { WantedLevel[playa] = 10; } else { WantedLevel[playa] += money; }
                        SetPlayerWantedLevel(playa, WantedLevel[playa]);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "You've commited a Crime ( %s )[+%d]. Reporter: %s.",result,money,sendername);
                        SendClientMessage(playa, COLOR_LIGHTRED, string);
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "HQ: All units APB: Reporter: %s",sendername);
                                    SendClientMessage(i, COLOR_DBLUE, string);
                                    format(string, sizeof(string), "HQ: Crime: %s[+%d] , Suspect: %s .",result,money,giveplayer);
                                    SendClientMessage(i, COLOR_DBLUE, string);
                                    format(string1, sizeof(string), "%s has gave wanted %d to %s", sendername, money, giveplayer);
                                    WantedLog(string1);
                                    ABroadCast(COLOR_YELLOW,string1,1);


                               }
                            }
                        }
                    }
                }
            } else return SendClientMessage(playerid, COLOR_GREY, "You aren't part of an cop organization.");
        }
        return 1;
    }
    if(strcmp(cmd, "/store", true) == 0)
wantedLog
pawn Код:
public WantedLog(string[])
{
    new entry[256];
    format(entry, sizeof(entry), "%s\n",string);
    new File:hFile;
    hFile = fopen("logs/wanted.log", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}
Reply
#9

Bump , please help
Reply
#10

try

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "HQ: All units APB: Reporter: %s",sendername);
                                    SendClientMessage(i, COLOR_DBLUE, string);
                                    format(string, sizeof(string), "HQ: Crime: %s[+%d] , Suspect: %s .",result,money,giveplayer);
                                    SendClientMessage(i, COLOR_DBLUE, string);
                                    format(string1, sizeof(string), "%s has gave wanted %d to %s", sendername, money, giveplayer);
                                    WantedLog(string1);
                                    


                               }
                            }
                        }
ABroadCast(COLOR_YELLOW,string1,1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)