[Duda]Con checkvida
#1

Hola a todos!Soy -[R]hysi- y estoy haciendo un gm de cero pero me surgio un problema.Al agregar un sistema de vida siempre estoy herido y nunca sale el mensaje ni me deja en crack ni nada =/

en ongamemodeinit

pawn Код:
VidaTimer = SetTimer("Checkvida", 7000, 1);
este new arriba de todo
pawn Код:
new VidaTimer;
en GameModeExitFunc

pawn Код:
KillTimer(VidaTimer);
y el callback con su forward

pawn Код:
forward CheckVida();
public CheckVida()
{
    new Float:Life;
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerHealth(i,Life);
            if(Life < 15.1 && First_Spawn[i] == 0)
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    GetPlayerHealth(i, Life);
                    SetPlayerHealth(i, Life-1.0);
                    if(!IsPlayerInAnyVehicle(i)) ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                }
                if(MensajeMuriendo[i]==0 && Logueado[i] == 1)
                {
                    if(!IsPlayerInAnyVehicle(i))
                    {
                    // ShowPlayerDialog(i,MURIENDO, DIALOG_STYLE_LIST, "Estas muy herido selecciona una de las dos opciones.","Llamar medico\nResignarse y morir","Elegir","");

                        SendClientMessage(i,ROJO_CLARO,"Tu estado actual es crнtico. Te estбs muriendo!");
                        SendClientMessage(i,ROJO_CLARO,"Ojalб alguien pueda llamar a una ambulancia, y rбpido!");
                        SendClientMessage(i,ROJO_CLARO,"Si no es asн, morirбs en poco tiempo!");
                        ApplyAnimation(i, "CRACK", "crckdeth1", 2.5, 1, 0, 1, 0, 0);
                        GetPlayerPos(i,MedicX,MedicY,MedicZ);
                        MensajeMuriendo[i]=1;
                        if(MsgL4L[i] == 0)
                        {
                            if(Life < 16 && Life > 12) { Left4Life[i] = 180; }
                            if(Life < 13 && Life > 8) { Left4Life[i] = 149; }
                            if(Life <  9) { Left4Life[i] = 99; }
                            MsgL4L[i] = 1;
                        }
                    }
                    if(IsPlayerInAnyVehicle(i))
                    {
                //     ShowPlayerDialog(i,MURIENDO, DIALOG_STYLE_LIST, "Estas muy herido selecciona una de las dos opciones.","Llamar medico\nResignarse y morir","Elegir","");
                        SendClientMessage(i,ROJO_CLARO,"Tu estado actual es crнtico. Te estбs muriendo!");
                        SendClientMessage(i,ROJO_CLARO,"Si sigues en el coche tu vida disminuairб mбs rapido!");
                        SendClientMessage(i,ROJO_CLARO,"Intenta bajar inmediatamente!");
                        MensajeMuriendo[i]=1;
                    }
                }
            }
            else{MensajeMuriendo[i]=0; ForbidHandsUp[i] = 0; MsgL4L[i] = 0; Left4Life[i] = 0;}
        }
    }
}
Saludos y gracias de antemano
Reply
#2

ya agregastes en OnPlayerSpawn esto? First_Spawn[i] = 0;
Reply
#3

Jjajaajaj que torpe soy. Agrege eso en onplayerspawn y ya funciono. Muchas gracias
Reply
#4

Quote:
Originally Posted by -[R]hysi-
Посмотреть сообщение
Jjajaajaj que torpe soy. Agrege eso en onplayerspawn y ya funciono. Muchas gracias
LOL...
Reply
#5

Es que lo habia agregado pero en onplayerconnect .. me habia equivocado por eso.Cuando lo puse en onplayerspawn si funciono
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)