Player Health and Armour
#1

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 !
Reply
#2

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

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
Reply
#4

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

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
Reply
#6

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.
Reply
#7

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?
Reply
#8

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;
}
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)