[PLEASE NEED HELP] What's wrong with this?
#1

Hi , i made a bitting code , so i putted it in a command to test it on me
pawn Код:
dcmd_bit(playerid, params[])
{
             new Float:Health, Float:a;
             GetPlayerArmour(playerid,a);
             if(a > 0)
             {
                SetPlayerArmour(playerid, a-10);
                GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits your ~g~armour ~w~!",2000,4);
             }
             else
             {
             if (IsInfected[playerid] == 0)
             {
                GetPlayerHealth(playerid,Health);
                SetPlayerHealth(playerid, Health-5);
                InfectionTime[playerid] = 0;
                StopTimer[playerid] = SetTimer("infectiontimer", 1000, true);//starts infection
                IsInfected[playerid] = 1;
                GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits you !",2000,4);
             }
             else
             {
             GetPlayerHealth(playerid,Health);
             SetPlayerHealth(playerid, Health-5);
             GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits you !",2000,4);
             }
             }
return 1;
}
So the problem , is whene the bitten player lose his armour , & i use /bit again , it gives him a new armour with more 100 resistence instead of making the player loose Health... i don't know what's wrong... i really need your Help Thanks.
Reply
#2

I will Explain :

This code will work whene i punch someone , so , whene i punch a player , if the player has an armour , then do for him : HISARMOUR-10 , else , causing damage of health(-5HP) + infection , the infection system make the player loose -6HP each 2 seconds ,
Whene the Zombie want to punch the player again , i don't want to start an other Timer ! i have already one started , so this is why i made a variable cheking if the player has been bitten before , then making him losing only -5(the last else)

The problem : is whene i bit all player's armour , & want to bit his health , a New ARMOUR is given to the bitten player (i don't know why).

NOTE : this system is working if the player doesn't have an armour , else it .....

I Really need your help Guys , any help..
Reply
#3

I do have a suspicion, but could you please post the code of the infectiontimer?
Reply
#4

Sure :
pawn Код:
forward infectiontimer();
public infectiontimer()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
    if(IsInfected[i] == 1)
    {
        if(!IsPlayerConnected(i)) continue;
        InfectionTime[i] ++;
        if(InfectionTime[i] == 2)
        {
            new Float:Health;
            GetPlayerHealth(i,Health);
            SetPlayerHealth(i, Health-6);
            SendClientMessage(i,COLOR_WHITE,"You Are infected ! go be cured by a Medic! or kill a Zombie!");
            InfectionTime[i] = 0;
        }
    }
    }

    return 1;
}
Reply
#5

How much armour does he get after you bit when his armour is gone?

pawn Код:
dcmd_bit(playerid, params[])
{
             new Float:Health, Float:a;
             GetPlayerArmour(playerid,a);
             if(a > 0)
             {
                SetPlayerArmour(playerid, a-10);
                GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits your ~g~armour ~w~!",2000,4);
             }
             else if(a > 0 && a < 10)
             {
                SetPlayerArmour(playerid, 0);
                GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits your ~g~armour, your armour is now gone! RUN! ~w~!",2000,4);
             }
             else if (IsInfected[playerid] == 0 && a <= 0)
             {
                GetPlayerHealth(playerid,Health);
                SetPlayerHealth(playerid, Health-5);
                InfectionTime[playerid] = 0;
                StopTimer[playerid] = SetTimer("infectiontimer", 1000, true);//starts infection
                IsInfected[playerid] = 1;
                GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits you !",2000,4);
             }
             else
             {
             GetPlayerHealth(playerid,Health);
             SetPlayerHealth(playerid, Health-5);
             GameTextForPlayer(playerid,"A ~r~zombie ~w~ hits you !",2000,4);
             }
}
return 1;
}
Try this.
Reply
#6

THank you for your help
but still not working , i have a remarque :

Whene the player spawns with 100 in armour , there is no problem so after armour is gone , it go to health bar , but if we have for ex 95 or 20 or... it gives him an armour with over 150 ammount

EDIT:

I think i just have to set players' Armour to 100 only...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)