SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/06/2012, 04:50 PM   #1
Saw®
Huge Clucker
 
Join Date: Sep 2011
Posts: 309
Reputation: 3
Default [PLEASE NEED HELP] What's wrong with this?

Hi , i made a bitting code , so i putted it in a command to test it on me
pawn Code:
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.
Saw® is offline   Reply With Quote
Old 21/06/2012, 05:58 PM   #2
Saw®
Huge Clucker
 
Join Date: Sep 2011
Posts: 309
Reputation: 3
Default Re: [PLEASE NEED HELP] What's wrong with this?

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..
Saw® is offline   Reply With Quote
Old 21/06/2012, 06:50 PM   #3
judothijs
Big Clucker
 
Join Date: Dec 2010
Location: The Netherlands
Posts: 112
Reputation: 10
Default Re: [PLEASE NEED HELP] What's wrong with this?

I do have a suspicion, but could you please post the code of the infectiontimer?
__________________
Code:
Filterscripts:
Area 51
Forum:
N/A
Server IP:
N/A Click to Play!
judothijs is offline   Reply With Quote
Old 21/06/2012, 07:59 PM   #4
Saw®
Huge Clucker
 
Join Date: Sep 2011
Posts: 309
Reputation: 3
Default Re: [PLEASE NEED HELP] What's wrong with this?

Sure :
pawn Code:
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;
}
Saw® is offline   Reply With Quote
Old 21/06/2012, 08:34 PM   #5
judothijs
Big Clucker
 
Join Date: Dec 2010
Location: The Netherlands
Posts: 112
Reputation: 10
Default Re: [PLEASE NEED HELP] What's wrong with this?

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

pawn Code:
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.
__________________
Code:
Filterscripts:
Area 51
Forum:
N/A
Server IP:
N/A Click to Play!
judothijs is offline   Reply With Quote
Old 21/06/2012, 08:45 PM   #6
Saw®
Huge Clucker
 
Join Date: Sep 2011
Posts: 309
Reputation: 3
Default Re: [PLEASE NEED HELP] What's wrong with this?

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...
Saw® is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong with this cps? Face9000 Scripting Help 6 14/01/2012 11:57 AM
What's wrong? Face9000 Scripting Help 0 13/01/2012 07:56 PM
showing wrong/wrong string TextDraws Voldemort Help Archive 5 22/02/2011 06:50 PM
where is wrong here?? iJumbo Help Archive 10 08/07/2010 02:03 PM


All times are GMT. The time now is 06:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.