Players don't take damage -
Luke_James - 09.09.2012
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;
}
Re: Players don't take damage -
KingHual - 09.09.2012
Right, not incomplete at all.
Re: Players don't take damage -
Luke_James - 09.09.2012
Updated, accidentally missed some things out.
Re: Players don't take damage -
Jessyy - 09.09.2012
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;
}
Re: Players don't take damage -
mamorunl - 09.09.2012
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!
Re : Players don't take damage -
ricardo178 - 09.09.2012
Just check if player HP/armour are less than X and if so, set it to 100.. Check that under OnPlayerUpdate.
Re: Players don't take damage -
Luke_James - 09.09.2012
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.
Re: Players don't take damage -
[HK]Ryder[AN] - 10.09.2012
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;
}
Re: Players don't take damage -
mamorunl - 10.09.2012
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?
Re: Players don't take damage -
ReVo_ - 10.09.2012
SetPlayerTeam.