Need a bit help about OnPlayerDamage - 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: Need a bit help about OnPlayerDamage (
/showthread.php?tid=648677)
Need a bit help about OnPlayerDamage -
MBilal - 26.01.2018
Код:
[02:39:43] [debug] Run time error 4: "Array index out of bounds"
[02:39:43] [debug] AMX backtrace:
[02:39:43] [debug] #0 00021cc8 in AddRejectedHit (playerid=65535, damagedid=1, reason=19, weapon=49, i1=1111883777, i2=0, i3=0) at D:\Game\Samp\pawno\include\weapon-config.inc:5308
[02:39:43] [debug] #1 000120c0 in public OnPlayerTakeDamage (playerid=1, issuerid=65535, Float:amount=49.50000, weaponid=49, bodypart=3) at D:\Game\Samp\pawno\include\weapon-config.inc:3373
[02:39:55] __kake_
I'm using Weapon-config.inc it giving this errors I know why it giving
reason
https://github.com/oscar-broman/samp...nfig/issues/65
Код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID)
{
if(pInfo[playerid][GodMode])
{
return 0;
}
else if(pInfo[playerid][AdminDuty])
{
return 0;
}
else if(pInfo[playerid][JustSpawned])
{
return 0;
}
}
else
{
/*this is the area where issuerid id can be Invalid i am using this else because i want when player is in god or spawn protection or onduty he jump from high place he doesn't lose health What i need to do in this else statement to avoid those errors and also player doesn't get damage by weapon or even jumping from high place*/
if(pInfo[playerid][GodMode] || pInfo[playerid][JustSpawned] || pInfo[playerid][AdminDuty])return 0;
}
return 1;
}
Problem area might be this else statement
/*this is the area where issuerid id can be Invalid i am using this else because i want when player is in godmode or in spawn protection or onduty he jump from high place he doesn't lose health What i need to do in this else statement to avoid those errors and also player doesn't get damage by weapon or even jumping from high place*/
Re: Need a bit help about OnPlayerDamage -
N0FeaR - 28.01.2018
Still need help?