[Ajuda] Sistema de medico
#1

PHP код:
         if(strcmp(cmd"/reanimar",true)==0)
    {
        if(
PlayerInfo[playerid][Emprego] == 2)
        {
            if(
GetPlayerSkin(playerid) == 274 || GetPlayerSkin(playerid) == 275 || GetPlayerSkin(playerid) == 276 || GetPlayerSkin(playerid) == 308)
            {
                for(new 
iMAX_PLAYERSi++)
                {
                    new 
FloatxFloatyFloatz;
                    if(
PlayerSolicitoMedico[i] == true)
                    {
                        
GetPlayerPos(ixyz);
                        if(
PlayerToPoint(1.0playeridxyz))
                        {
                            
PlayerASerCurado[playerid] = i;
                             
SendClientMessage(PlayerASerCurado[playerid], -1"O mйdico estб tentando reanima-lo fazendo massagem cardнaca.");
                            
SendClientMessage(playerid, -1"Vocк estб tentando reanimar a vitima fazendo massagem cardнaca");
                            
ApplyAnimation(playerid,"MEDIC","CPR",4.1,0,1,1,1,1);
                            
Controle(playerid0);
                            
PlayerSolicitoMedico[PlayerASerCurado[playerid]] = false;
                            
SetTimerEx("LevaPacAmbulancia"75000"i"playerid);
                            return 
true;
                        } else return 
SendClientMessage(playerid, -1"Vocк nгo estб perto de nenhuma vitima.");
                    } else return 
SendClientMessage(playerid, -1"Nгo tem nenhuma vitima no momento.");
                }
            } else return 
SendClientMessage(playerid, -1"Vocк nгo estб em serviзo.");
        } else return 
SendClientMessage(playerid, -1"Vocк nгo й Mйdico.");
    } 
este comando estava funcionando perfeitamente ai do nada nгo quer entrar na funзгo so estб me retornando "Nгo tem nenhuma vitima no momento.", nгo quer entrar no if(PlayerSolicitoMedico[i] == true) sendo que esta tudo correto e esta verdadeiro a condiзгo mais nгo entra

OBS: Fiz o teste e estб funcionando com um player e com o outro retorna esta mensagem "Nгo tem nenhuma vitima no momento."
Reply
#2

Verifique se ao solicitar um mйdico a variбvel fica verdadeira.
Reply
#3

Fica sim, tanto que para o player id 1 funciona quando o player id 0 faz nгo entra naquela condiзгo
Reply
#4

Faзa um debug no sistema.
Reply
#5

Encontrei o problema. Seu sistema possui redundвncias. Utilize o laзo apenas para encontrar o jogador, depois faзa o restante fora dele. O que estб acontencendo й que se o ID 0 nгo for o solicitante, etc, o sistema vai ignorar o restante dos jogadores. Faзa o seguinte:

PHP код:
PlayerASerCurado[playerid] = -1
for(new 
iMAX_PLAYERSi++) 

    new 
FloatxFloatyFloatz
    if(
PlayerSolicitoMedico[i] == true
    { 
        
GetPlayerPos(ixyz); 
        if(
PlayerToPoint(1.0playeridxyz)) 
        { 
            
PlayerASerCurado[playerid] = i
            break;
        } 
    }
}
// aqui vocк faz as verificaзхes
// por ex
if(PlayerASerCurado[playerid] == -1)
    return 
SendClientMessage(playerid,-1,"Nгo hб jogadores prox querendo medico");
    
// agora possui um PlayerASerCurado[playerid] querendo mйdico e estб prox
// curar, aplicar animaзгo, etc... 
Espero ter ajudado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)