Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Need a bit help about OnPlayerDamage

$
0
0
Code:

[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

Code:

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*/

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>