OnPlayerTakeDamage & OnPlayerGiveDamage bug? - 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: OnPlayerTakeDamage & OnPlayerGiveDamage bug? (
/showthread.php?tid=649395)
OnPlayerTakeDamage & OnPlayerGiveDamage bug? -
Milak - 08.02.2018
I want to make custom damage system but I have an issue. I tried everything - I wanted to make player deathless from everyweapon. It works! But, weaponid 0 always take damage. Why?
Code:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
new Float:HP;
GetPlayerHealth(damagedid, HP);
SetPlayerHealth(damagedid, HP);
return 1;
}
Tried to make it with OnPlayerTakeDamage but it always first stolen player's HP and restored it back.
// Edit: Sorry, I forgot to say: I'm on lastest 0.3.8 SAMP Version.
Re: OnPlayerTakeDamage & OnPlayerGiveDamage bug? -
Mugala - 08.02.2018
try OnPlayerTakeDamage for only fist.
PHP Code:
public public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(weaponid == 0)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
SetPlayerHealth(playerid, HP);
}
return 1;
}
Re: OnPlayerTakeDamage & OnPlayerGiveDamage bug? -
Milak - 08.02.2018
I know! I just tested it! It's SAMP BUG! SetSpawnInfo does not work! Try it! Player will take damage to other players from same team! If I use command:
CMD
etteam (playerid, params[])
{
new tid, tm;
if(sscanf(params, "rd", tid, tm))
{
SendClientMessage(playerid, COLOR_WHITE, "/setteam [player] [team]");
return 1;
}
SetPlayerTeam(tid, tm);
return 1;
}
It works and weaponid 0 does not take any damage!