Why not run!?
#1

Hi I am trying to make a chat for those who have the same surname, type I Antionio_Nunes the / fa Hi there everyone who has surname Nunes sees the message,
but not working when I use / fa hi out around 20 hi and who has the same last name as I do not see, can someone help?

pawn Код:
if(strcmp(cmd, "/familia", true) == 0 || strcmp(cmd, "/fa", true) == 0)
    {
        if(PlayerInfo[playerid][pMuted] == 1)
        {
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Vocк nгo pode falar, pois foi calado");
            return 1;
        }
        if(radio[playerid] == 0)
        {
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Vocк nгo tem um rбdio vб atй uma 24-7 (/gps)");
            return 1;
        }
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            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;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_R, "USE: (/fa)milia [radio chat]");
                return 1;
            }
            if(TentouDivulgar(result))
            {
                if(cdivulgar[playerid] >= 6)
                {
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Mano aque e o Seguinte vc nгo Divulga Server!");
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Seu servidor й uma merda, nгo divulgue-o aqui!");
                    SendClientMessage(playerid, COLOR_LIGHTBLUE,"Seu noob peguei esse IP e vou Derrubar ele HAHAHA");
                    PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
                    Kick(playerid);
                }
                GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
                format(string, 128, "AdmAviso: [%d]%s tentou divulgar: %s.",playerid,playername,result);
                ABroadCast(COLOR_YELLOW,string,1);
                DivulgouLog(string);
                cdivulgar[playerid] += 1;
                return 1;
            }
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(strcmp(GetPlayerLastName(i), GetPlayerLastName2(i), true) == 0)
                    {
                        format(string, sizeof(string), "** Familia %s: %s over. **", sendername, result);
                        SendClientMessage(playerid, COLOR_BLUE, string);
                    }
                }
                printf("%s", string);
                format(string, sizeof(string), "%s (rбdio): %s", sendername, result);
                ProxDetector(20.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
                return 1;
        }

        return 1;
    }
pawn Код:
stock GetPlayerLastName(playerid)
{
    new namestring[2][MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}
stock GetPlayerLastName2(playerid)
{
    new namestring[2][MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}
Reply
#2

Is not playerid, but i:

PHP код:
format(stringsizeof(string), "** Familia %s: %s over. **"sendernameresult);
SendClientMessage(/*playerid*/COLOR_BLUEstring); 
And:

GetPlayerLastName(i), GetPlayerLastName2(i)

What the difference between GetPlayerLastName(i) and GetPlayerLastName2(i) ? You must using i and playerid.
Reply
#3

I swapped, but still does not work, send 50 times (MAX_PLAYERS), and no one who has the same surname sees
Reply
#4

anyyyy?
Reply
#5

any help?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)