Players don't take damage
#1

When a player takes damage, his/her health/armour goes straight back up, I attempted to fix this but nothing worked, here's the necessary code;

pawn Код:
enum pInfo
{
    Float:Health,
    Float:Armour,
};

public OnPlayerShootPlayer(Float:HealthLost,Float:ArmourLost)

public OnPlayerUpdate(playerid)
{
    GetPlayerWeaponAmmo(playerid);
    new Float:health, Float:armour;
    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armour);
    if(health != Player[playerid][Health])
    {
        SetPlayerHealth(playerid, Player[playerid][Health]);
    }
    if(armour != Player[playerid][Armour])
    {
        SetPlayerArmour(playerid, Player[playerid][Armour]);
    }
        return 1;
}
Reply
#2

Right, not incomplete at all.
Reply
#3

Updated, accidentally missed some things out.
Reply
#4

Try this ...
Код:
#define FLOAT_INF	(Float:0x7F800000)

zcmd:god(const playerid, const params[])
{
	SetPlayerHealth(playerid, FLOAT_INF);
	SendClientMessage(playerid, -1, "God mode turned on");
	return 1;
}

zcmd:ungod(const playerid, const params[])
{
	SetPlayerHealth(playerid, 100.0);
	SendClientMessage(playerid, -1, "God mode turned off");
	return 1;
}
Reply
#5

Quote:
Originally Posted by Jessyy
Посмотреть сообщение
Try this ...
Код:
#define FLOAT_INF	(Float:0x7F800000)

zcmd:god(const playerid, const params[])
{
	SetPlayerHealth(giveid, FLOAT_INF);
	SendClientMessage(playerid, -1, "God mode turned on");
	return 1;
}

zcmd:ungod(const playerid, const params[])
{
	SetPlayerHealth(giveid, 100.0);
	SendClientMessage(playerid, -1, "God mode turned off");
	return 1;
}
Because that doesn't give you errors at all! (Yes, that was sarcasm and stop with the 'try this').

@ OP: First of all, there is a callback floating in the middle of your code.. second: I am totally unsure what you are trying to do. If it IS a /god command then just set the players health to 99999999.9 or god knows what high number and with an /ungod (can also be /heal) set it back to 100.0

If you are trying to do something else: EXPLAIN. WE ARE NOT WIZARDS!
Reply
#6

Just check if player HP/armour are less than X and if so, set it to 100.. Check that under OnPlayerUpdate.
Reply
#7

What the code I provided is meant to do is reduce a players health/armour when they're shot, or take damage etc. It doesn't work, the health just decreases and goes straight back up full again.
Reply
#8

do this
pawn Код:
public OnPlayerUpdate(playerid)
{
    GetPlayerWeaponAmmo(playerid);
    new Float:health, Float:armour;
    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armour);
    if(health != Player[playerid][Health])
    {
        Player[playerid][Health] = health;
    }
    if(armour != Player[playerid][Armour])
    {
        Player[playerid][Armour] = armour;
    }
        return 1;
}
Reply
#9

Quote:
Originally Posted by Luke_James
Посмотреть сообщение
What the code I provided is meant to do is reduce a players health/armour when they're shot, or take damage etc. It doesn't work, the health just decreases and goes straight back up full again.
So why do you even have that code? When someone is shot or take damage, their healt automatically decreases?
Reply
#10

SetPlayerTeam.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)