[Ajuda] /convidarf & /aceitarf
#1

Estб tudo certo o sistema de famнlia que fiz, chat funciona.
tudo certinho, porйm fiz baseado em uma organizaзгo.
na qual o lider tem /convidarf e /demitirf, e para o player entrar /aceitar convitef.

Problem: Quando convido alguem para qualquer famнlia o msm quando eu demito, ele ainda tem o convite e pode aceitar a hora que bem entender...

Creio que isso seja falta de algo no /aceitar, ou entгo como eu nгo fiz nenhuma hq para o player Spawnar, pode ser por isso tambйm ...(no OnPlayerSpawn).

Code's:

pawn Код:
if(strcmp(cmd, "/convidarf", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /convidarf [playerid/Parte-do-Nick]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLFamilia] == 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(PlayerInfo[para1][pFamilia] != 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Este player jб participa de uma Familia.");
                        return 1;
                    }
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* %s te convidou para entrar para a familia AmS (digite /aceitar convitef ) para aceitar.", PlayerName(playerid));
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Vocк convidou %s para sua Familia.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        InviteOfferf[para1] = playerid;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й dono da familia AmS para usar este comando");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/convidarf2", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /convidarf2 [playerid/Parte-do-Nick]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLFamilia] == 2)
            {
                if(IsPlayerConnected(para1))
                {
                    if(PlayerInfo[para1][pFamilia] != 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Este player jб participa de uma familia.");
                        return 1;
                    }
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* %s te convidou para entrar para a Familia Freeze (digite /aceitar convitef2 ) para aceitar.", PlayerName(playerid));
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Vocк convidou %s para sua Familia.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        InviteOfferf2[para1] = playerid;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й dono da familia Freeze para usar este comando");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/convidarf3", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /convidarf2 [playerid/Parte-do-Nick]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLFamilia] == 3)
            {
                if(IsPlayerConnected(para1))
                {
                    if(PlayerInfo[para1][pFamilia] != 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Este player jб participa de uma familia.");
                        return 1;
                    }
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* %s te convidou para entrar para a Familia Beats (digite /aceitar convitef3 ) para aceitar.", PlayerName(playerid));
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Vocк convidou %s para sua Familia.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        InviteOfferf3[para1] = playerid;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й dono da familia Beats para usar este comando");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/convidarf4", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /convidarf4 [playerid/Parte-do-Nick]");
                return 1;
            }
            new para1;
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLFamilia] == 4)
            {
                if(IsPlayerConnected(para1))
                {
                    if(PlayerInfo[para1][pFamilia] != 0)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Este player jб participa de uma familia.");
                        return 1;
                    }
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "* %s te convidou para entrar para a Familia sуqn (digite /aceitar convitef4 ) para aceitar.", PlayerName(playerid));
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Vocк convidou %s para sua Familia.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        InviteOfferf4[para1] = playerid;
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й dono da familia sуqn para usar este comando");
            }
        }
        return 1;
    }
e o code de /aceitar.

pawn Код:
if(strcmp(x_Emprego,"convitef",true) == 0)
            {
                if(InviteOfferf[playerid] < 999)
                {
                    if(IsPlayerConnected(InviteOfferf[playerid]))
                    {
                        PlayerInfo[playerid][pFamilia] = 1;
                        format(gstring, 128, "* %s Aceitou seu convite para entrar na sua Famнlia.", PlayerName(playerid));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, gstring);
                        SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк aceitou,agora faz parte da familia AmS");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    O jogador que lhe convidou nгo estб conectado.");
                        return true;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "Vocк nгo foi convidado para participar de uma familia");
                    return true;
                }
            }
            if(strcmp(x_Emprego,"convitef2",true) == 0)
            {
                if(InviteOfferf2[playerid] < 999)
                {
                    if(IsPlayerConnected(InviteOfferf2[playerid]))
                    {
                        PlayerInfo[playerid][pFamilia] = 2;
                        format(gstring, 128, "* %s Aceitou seu convite para entrar na sua Famнlia.", PlayerName(playerid));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, gstring);
                        SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк aceitou,agora faz parte da familia Freeze");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    O jogador que lhe convidou nгo estб conectado.");
                        return true;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "Vocк nгo foi convidado para participar de uma familia");
                    return true;
                }
            }
            if(strcmp(x_Emprego,"convitef3",true) == 0)
            {
                if(InviteOfferf3[playerid] < 999)
                {
                    if(IsPlayerConnected(InviteOfferf3[playerid]))
                    {
                        PlayerInfo[playerid][pFamilia] = 3;
                        format(gstring, 128, "* %s Aceitou seu convite para entrar na sua Famнlia.", PlayerName(playerid));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, gstring);
                        SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк aceitou,agora faz parte da familia Beats");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    O jogador que lhe convidou nгo estб conectado.");
                        return true;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "Vocк nгo foi convidado para participar de uma familia");
                    return true;
                }
            }
            if(strcmp(x_Emprego,"convitef4",true) == 0)
            {
                if(InviteOfferf4[playerid] < 999)
                {
                    if(IsPlayerConnected(InviteOfferf4[playerid]))
                    {

                        PlayerInfo[playerid][pFamilia] = 4;
                        format(gstring, 128, "* %s Aceitou seu convite para entrar na sua Famнlia.", PlayerName(playerid));
                        SendClientMessage(InviteOffer[playerid], COLOR_LIGHTBLUE, gstring);
                        SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк aceitou,agora faz parte da familia sуqn");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    O jogador que lhe convidou nгo estб conectado.");
                        return true;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "Vocк nгo foi convidado para participar de uma familia");
                    return true;
                }
            }
Reply
#2

Crie uma array para definir se caso o player estб sendo convidado ou nгo. Depois, adicione uma condiзгo no comando /aceitar, fazendo a verificaзгo da array.

Caso o valor dela for true: O comando continuarб e vocк deverб atribuir o valor false а array.
Case o valor dela for false: O comando retornarб uma mensagem avisando que o jogador nгo estб sendo convidado.

Exemplo:
pawn Код:
new bool:SendoConvidado[MAX_PLAYERS char];

//No comando /aceitar:

if(SendoConvidado{playerid}) {
    //Funзхes caso o player estiver sendo convidado
    SendoConvidado{playerid} = false;
} else {
    //Funзхes caso o player nгo estiver sendo convidado
}
Reply
#3

@Edit

Ficaria entгo ? algo parecido
pawn Код:
if(SendoConvidado{playerid})
{
     SendoConvidado{playerid} = false;
 }
else
{ //Funзхes caso o player nгo estiver sendo convidado
      SendoConvidado{playerid} = true;
      return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)