[Ajuda] Sistema de duelo
#1

eu envio duelo pra algum id mas so e teleportado e ganha armas o id que enviou o duelo (no caso o playerid)

pawn Код:
CMD:duelo(playerid,params[])
{
    new id,str[64];
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,cor_vermelho,"/duelo [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,cor_vermelho,"Erro: PlayerID desconectado!");

    SetPVarInt(playerid,"ID_DO_DUELADO",id);
    SetPVarInt(playerid,"ID_DO_PLAYER_Q_ENVIOU",playerid);

    format(str,sizeof(str),"Vocк desafiou %s para um duelo!\naguarde a resposta.",nome(id));
    ShowPlayerDialog(playerid,DIALOG_DUELO+24,DIALOG_STYLE_MSGBOX,"Duelo Enviado!",str,"Ok","");

    format(str,sizeof(str),"%s(%d) estб desafiando vocк para um duelo!",nome(playerid),playerid);
    ShowPlayerDialog(id,DIALOG_DUELO,DIALOG_STYLE_MSGBOX,"Duelo Recebido!",str,"Aceitar","Recusar");
    return 1;
}

if(dialogid == DIALOG_DUELO)
    {
        if(response)
        {
            ShowPlayerDialog(playerid,DIALOG_DUELO+35,DIALOG_STYLE_LIST,"Selecione as Armas","Deagle+Shotgun","Selecionar","");
        }
        else
        {
            SendClientMessage(GetPVarInt(playerid,"ID_DO_PLAYER_Q_ENVIOU"),cor_vermelho,"Seu duelo foi Recusado.");
            SendClientMessage(playerid,cor_vermelho,"Duelo Recusado.");
        }
    }

    if(dialogid == DIALOG_DUELO+35)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    if(DuelInfo[EmUso] == 1) return SendClientMessage(playerid,cor_vermelho,"Duel em uso.");
                    Duelar(playerid,GetPVarInt(playerid,"ID_DO_DUELADO"),24,25);
                }
            }
        }
    }

stock Duelar(p1,p2,wp1,wp2)
{
    SetPlayerPos(p1,1415.6921,-21.1801,1000.9258);
    SetPlayerFacingAngle(p1,87.5832);
    SetCameraBehindPlayer(p1);

    SetPlayerPos(p2,1362.2002,-20.9850,1000.9219);
    SetPlayerFacingAngle(p2,271.2359);
    SetCameraBehindPlayer(p2);

    GivePlayerWeapon(p1,wp1,999);
    GivePlayerWeapon(p1,wp2,999);
    GivePlayerWeapon(p2,wp1,999);
    GivePlayerWeapon(p2,wp2,999);
    return 1;
}
Reply
#2

Tente:

PHP код:
CMD:duelo(playerid,params[])
{
    new 
id,str[64];
    if(
sscanf(params,"u",id)) return SendClientMessage(playerid,cor_vermelho,"/duelo [playerid]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid,cor_vermelho,"Erro: PlayerID desconectado!");

    
SetPVarInt(playerid,"ID_DO_DUELADO",id);
    
SetPVarInt(id,"ID_DO_PLAYER_Q_ENVIOU",playerid);

    
format(str,sizeof(str),"Vocк desafiou %s para um duelo!\naguarde a resposta.",nome(id));
    
ShowPlayerDialog(playerid,DIALOG_DUELO+24,DIALOG_STYLE_MSGBOX,"Duelo Enviado!",str,"Ok","");

    
format(str,sizeof(str),"%s(%d) estб desafiando vocк para um duelo!",nome(playerid),playerid);
    
ShowPlayerDialog(id,DIALOG_DUELO,DIALOG_STYLE_MSGBOX,"Duelo Recebido!",str,"Aceitar","Recusar");
    return 
1;

Reply
#3

n deu.. voce so mudou avarint ID_DO_PLAYER_Q_ENVIOU isso nao ira resultar pq o problema e no ID_DO_DUELADO
Reply
#4

Quote:
Originally Posted by Lucas_HenryK
Посмотреть сообщение
n deu.. voce so mudou avarint ID_DO_PLAYER_Q_ENVIOU isso nao ira resultar pq o problema e no ID_DO_DUELADO
Se vocк sabe o problema, por que nгo resolve vocк mesmo? O.o Vocк ao menos testou o cуdigo? Atй porque isto nгo faz sentido algum:

PHP код:
SetPVarInt(playerid,"ID_DO_PLAYER_Q_ENVIOU",playerid); 
Pra que armazenar num jogador o playerid dele mesmo?

Troque a linha acima por esta e teste.

PHP код:
SetPVarInt(id,"ID_DO_PLAYER_Q_ENVIOU",playerid); 
@EDIT

Nгo tinha visto o cуdigo inteiro. ALЙM das alteraзхes acima, tambйm tente mudar esta linha:

PHP код:
Duelar(playerid,GetPVarInt(playerid,"ID_DO_DUELADO"),24,25); 
Por

PHP код:
Duelar(playerid,GetPVarInt(playerid,"ID_DO_PLAYER_Q_ENVIOU"),24,25); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)