[Pedido] Quando o player cai na agua morre!
#1

Bom...
Eu quero tipo assim...
Quando um player cai na agua ele й morto automaticamente pelo servidor!
Sу isso!

DESDE JБ MUITO OBRIGADO!!!
Reply
#2

pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(z == 0) return SetPlayerHealth(playerid, 0.0);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Rodney_Francalim
Посмотреть сообщение
pawn Код:
public OnPlayerUpdate(playerid)
{
    new x, y, z;
    GetPlayerPos(playerid, x, y, z);
    if(z == 0) return SetPlayerHealth(playerid, 0.0);
    return 1;
}
Codigo esta bom porem pode dar alguns bugs se o player chegar a uma certa latitude, mais tenta esse ai
Reply
#4

Use isto!

pawn Код:
public OnPlayerUpdate(playerid)
{
    static Float: vida;

    GetPlayerHealth( playerid,  vida );

    if(vida != 0.0) {

        static
            anime;
       
        anime = GetPlayerAnimationIndex(playerid) ;
       
        if ((anime== 1544) || (anime== 1250) || (anime== 1062) ||  ((anime>=  1538) && (anime<= 1542))) {
            SetPlayerHealth( playerid, 0.0 ) ;
        }
    }
    return true;
}
Provavelmente funcionarб



Quote:
Originally Posted by Claude_StreeT
Посмотреть сообщение
Codigo esta bom porem pode dar alguns bugs se o player chegar a uma certa latitude, mais tenta esse ai
Й "altitude". Usando este cуdigo caso o jogador estiver andando pela Pedreira, poderб morrer — pois chega a altura zero. Assim como nгo detectarб em lagos ou lagoas

Abraзos
Reply
#5

Hm! Qual a diferenзa entre usar
pawn Код:
new anime
ou
pawn Код:
static anime
?

@EDIT:

Usa esse, caso o jogador mergulhe em alguma piscina, sei lб.

pawn Код:
public OnPlayerUpdate(playerid)
{
    static Float: vida;

    GetPlayerHealth( playerid,  vida );

    if(vida != 0.0) {

        static
            anime;
       
        anime = GetPlayerAnimationIndex(playerid) ;

        static
            Float:pos[3];
   
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
       
        if (((anime== 1544) || (anime== 1250) || (anime== 1062) ||  ((anime>=  1538) && (anime<= 1542))) && pos[2] == 0) {
            SetPlayerHealth( playerid, 0.0 ) ;
        }
    }
    return true;
}
Reply
#6

Quote:
Originally Posted by Rodney_Francalim
Посмотреть сообщение
Hm! Qual a diferenзa entre usar
pawn Код:
new anime
ou
pawn Код:
static anime
?

@EDIT:

Usa esse, caso o jogador mergulhe em alguma piscina, sei lб.

pawn Код:
public OnPlayerUpdate(playerid)
{
    static Float: vida;

    GetPlayerHealth( playerid,  vida );

    if(vida != 0.0) {

        static
            anime;
       
        anime = GetPlayerAnimationIndex(playerid) ;

        static
            Float:pos[3];
   
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
       
        if (((anime== 1544) || (anime== 1250) || (anime== 1062) ||  ((anime>=  1538) && (anime<= 1542))) && pos[2] == 0) {
            SetPlayerHealth( playerid, 0.0 ) ;
        }
    }
    return true;
}
Literalmente vocк estragou o cуdigo do Bruno.

Sobre Static's:

Statics sгo variбveis que sгo permanentes, e ao vocк criar uma ela
nгo serб criada novamente, irб se permanecer o mesmo valor usado
nela.

pawn Код:
public OnFilterScriptInit(){

    Var();
    printf("\n\n");
    Var();
    return 1;
}

stock Var(){
    static lol;
    printf("Valor de LOL: %d", lol); // imprimirб o ъltimo valor dado hб variбvel LOL, no  caso += 1.
   
    lol += 50;
    printf("Valor de LOL: %d", lol);
    lol += 1;
    return 1;
}
=)
Reply
#7

Vocк estragou o cуdigo cara, pra que checar a posiзгo do jogador? Isto nгo vai funcionar se ele for em uma piscina, pois a altura da piscina pode ser maior que 0.

O que eu fiz foi detectar quando ele entra na бgua por animaзхes. Й e ficiente esempre funciona, em qualquer бgua!
Reply
#8

Quote:
Originally Posted by ipsBruno
Посмотреть сообщение
Vocк estragou o cуdigo cara, pra que checar a posiзгo do jogador? Isto nгo vai funcionar se ele for em uma piscina, pois a altura da piscina pode ser maior que 0.

O que eu fiz foi detectar quando ele entra na бgua por animaзхes. Й e ficiente esempre funciona, em qualquer бgua!
E Tbm se ele usar um Fly, ele morre nй kkkkkk
Reply
#9

Quote:
Originally Posted by paulor
Посмотреть сообщение
E Tbm se ele usar um Fly, ele morre nй kkkkkk
Pois й, tem ainda isto. Usando o cуdigo daquele jeito, andando de barco na бgua = morte.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)