SA-MP Forums Archive
Player Health and Armour - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player Health and Armour (/showthread.php?tid=599107)



Player Health and Armour - Amunra - 21.01.2016

Hi,
I Have a problem with my server , Like If Player Shoot other player The Other Player Not get damage or They health is Full Like a God Mode!

Anyone Know to Fix That ?

REP++ For You !



Re: Player Health and Armour - Weponz - 21.01.2016

Show us some code? or shall I get my psychic on?


Re: Player Health and Armour - Amunra - 21.01.2016

Quote:
Originally Posted by Weponz
Посмотреть сообщение
Show us some code? or shall I get my psychic on?
I Dont Know from where this Problem , I Just Ask


Re: Player Health and Armour - Weponz - 21.01.2016

One needs to see some code before one can identify any bugs..


Re: Player Health and Armour - Amunra - 21.01.2016

Quote:
Originally Posted by Weponz
Посмотреть сообщение
One needs to see some code before one can identify any bugs..
Do you think From where?This Problem ? OnPlayerTakeDamage? or Etc.. Sorry I So Newbie


Re: Player Health and Armour - Weponz - 21.01.2016

Check all your SetPlayerHealth's for anything above 100.0(and remove it, or patch it) and THEN c/p your whole OnPlayerTakeDamage callback here so I can look at it.


Re: Player Health and Armour - Amunra - 21.01.2016

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(
kickback[issuerid] == 1)
    {
        if(
weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new 
Float:x,Float:y,Float:z,Float:angle;
            
GetPlayerFacingAngle(playerid,Float:angle);
            
GetPlayerVelocity(playerid,Float:x,Float:y,Float:z);
            
SetPlayerVelocity(playerid,Float:x+0.1,Float:y+0.1,Float:z+0.2);
            
SetPlayerFacingAngle(playerid,Float:angle);
        }
    }
    if(
damager[issuerid] == 1)
    {
        if(
weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new 
Float:Health,Float:Armour;
            
GetPlayerHealth(playerid,Health);
            
SetPlayerHealth(playerid,Health -30);
            
GetPlayerArmour(playerid,Armour);
            
SetPlayerArmour(playerid,Armour -30);
        }
    }
    return 
1;

Thats Right?


Re: Player Health and Armour - Weponz - 21.01.2016

I don't see anything maxing out health. Although I found some flaws, try this:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(kickback[issuerid] == 1)
    {
        if(weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new Float:x, Float:y, Float:z, Float:angle;
            GetPlayerFacingAngle(playerid, angle);
            GetPlayerVelocity(playerid, x, y, z);

            SetPlayerVelocity(playerid, x+0.1, y+0.1, z+0.2);
            SetPlayerFacingAngle(playerid, angle);
            //God knows what is happening here..but let's carry on..
        }
    }
    if(damager[issuerid] == 1)
    {
        if(weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new Float:Health, Float:Armour;
            GetPlayerHealth(playerid, Health);
            SetPlayerHealth(playerid, Health -30);

            GetPlayerArmour(playerid, Armour);
            SetPlayerArmour(playerid, Armour -30);
        }
    }
    return 1;
}



Re: Player Health and Armour - Amunra - 21.01.2016

Quote:
Originally Posted by Weponz
Посмотреть сообщение
I don't see anything maxing out health. Although I found some flaws, try this:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(kickback[issuerid] == 1)
    {
        if(weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new Float:x, Float:y, Float:z, Float:angle;
            GetPlayerFacingAngle(playerid, angle);
            GetPlayerVelocity(playerid, x, y, z);

            SetPlayerVelocity(playerid, x+0.1, y+0.1, z+0.2);
            SetPlayerFacingAngle(playerid, angle);
            //God knows what is happening here..but let's carry on..
        }
    }
    if(damager[issuerid] == 1)
    {
        if(weaponid == 30 || weaponid == 31 || weaponid == 29)
        {
            new Float:Health, Float:Armour;
            GetPlayerHealth(playerid, Health);
            SetPlayerHealth(playerid, Health -30);

            GetPlayerArmour(playerid, Armour);
            SetPlayerArmour(playerid, Armour -30);
        }
    }
    return 1;
}
Thanks For Help , BTW I Still Confused With This Problem


Re: Player Health and Armour - Weponz - 21.01.2016

If your players health is maxing out, this means a SetPlayerHealth(somewhere in the script) is setting it ABOVE 100.0(to 9999 or 99999). Find it and you will find your problem.