SA-MP Forums Archive
[AJUDA]Ajuda Ae :)? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA]Ajuda Ae :)? (/showthread.php?tid=350157)



[AJUDA]Ajuda Ae :)? - Jake_Dunlapp - 11.06.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
             new Float:X, Float:Y, Float:Z,vida,vitima;
             GetPlayerPos(vitima,X,Y,Z);
             if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
             {
               SetPlayerHealth(vitima,vida -10);        
         }
        }
    } // WTF? AFF ta aparecendo " } " que nгo coloquei O_O
    return 1;
}
Problema da vez й quando aperto a key ao inves de tirar 10 ele mata o player que estб prox na hora pqp ne? como resolvo?


Re: [AJUDA]Ajuda Ae :)? - EditPawn - 11.06.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
             new Float:X, Float:Y, Float:Z,Float:vida,vitima;
             GetPlayerPos(vitima,X,Y,Z);
             GetPlayerHealth(vitima, vida);
             if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
             {
               SetPlayerHealth(vitima,vida -10);
         }
        }
    } // WTF? AFF ta aparecendo " } " que nгo coloquei O_O
    return 1;
}



Re: [AJUDA]Ajuda Ae :)? - Schocc - 11.06.2012

Ta sem GetPlayerHealth
@na mesma hora


Re: [AJUDA]Ajuda Ae :)? - leonardo1434 - 11.06.2012

eu Tinha esquecido de getplayerhealth, lol. isso dai deve funcionar .. cara tu sу faz merda, jб lhe mandei 2 cmd's funcional de morde e nгo funciona com vocк, vai usar a serras eletricas !

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
             new Float:X, Float:Y, Float:Z,Float:vida,vitima;
             GetPlayerPos(vitima,X,Y,Z);
             if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
             {
               GetPlayerHealth(vitima,vida);
               SetPlayerHealth(vitima,vida -10);        
             }
        }
    }
    return 1;
}



Re: [AJUDA]Ajuda Ae :)? - Jake_Dunlapp - 11.06.2012

Quote:
Originally Posted by EditPawn
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
             new Float:X, Float:Y, Float:Z,Float:vida,vitima;
             GetPlayerPos(vitima,X,Y,Z);
             GetPlayerHealth(vitima, vida);
             if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
             {
               SetPlayerHealth(vitima,vida -10);
         }
        }
    } // WTF? AFF ta aparecendo " } " que nгo coloquei O_O
    return 1;
}
Entгo quando aperto o botao agora quem perde hp sou eu e nao o cara que ta perto de mim O_O


Re: [AJUDA]Ajuda Ae :)? - EditPawn - 11.06.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
             new Float:X, Float:Y, Float:Z,vida,vitima;
             GetPlayerPos(vitima,X,Y,Z);
             if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
             {
               GetPlayerHealth(vitima,vida);
               SetPlayerHealth(vitima,vida -10);        
             }
        }
    }
    return 1;
}
eu acho que ta errado ai em...
porque a vida nao esta definida como Float:


Re: [AJUDA]Ajuda Ae :)? - EditPawn - 11.06.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
            new Float:X, Float:Y, Float:Z,Float:vida;
            GetPlayerPos(playerid,X,Y,Z);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerInRangeOfPoint(i,3.0,X,Y,Z))
                {
                    GetPlayerHealth(i, vida);
                    SetPlayerHealth(i,vida -10);
                }
            }
        }
    } // WTF? AFF ta aparecendo " } " que nгo coloquei O_O
    return 1;
}
tenta ae


Re: [AJUDA]Ajuda Ae :)? - Jake_Dunlapp - 11.06.2012

Quote:
Originally Posted by EditPawn
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys & KEY_SECONDARY_ATTACK)
   {
        if(Equipes[playerid] == 2)
        {
            new Float:X, Float:Y, Float:Z,Float:vida;
            GetPlayerPos(playerid,X,Y,Z);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
                {
                    GetPlayerHealth(i, vida);
                    SetPlayerHealth(i,vida -10);
                }
            }
        }
    } // WTF? AFF ta aparecendo " } " que nгo coloquei O_O
    return 1;
}
tenta ae
Aewwwwwwwww Ta funfando o unico problema e que eu e ele perdemos hp tem como corrigir isso?


Re: [AJUDA]Ajuda Ae :)? - ViniBorn - 11.06.2012

Nessa callback nгo tem nenhuma referкncia a outro jogador, no caso, toda vez vocк irб matar o jogador de ID 0
pawn Код:
if(playerid == i)
    continue;
Lembrando que pelo loop, pode acontecer de vocк tirar vida de mais de uma pessoa ao mesmo tempo


Re: [AJUDA]Ajuda Ae :)? - Jake_Dunlapp - 11.06.2012

Editpawn ve la o post que mandei ali em cima