OnPlayerTakeDamage
#1

the player with id 0 fell out from high location so he died with Collision - the Collision ID is 54 - the amount of the Collision in this case is 1126498304 (although it is a high value but it's not the problem) - the body part that was hit is Torso, how issuer id took 65535 as input!!! please tell me!! - MAX_PLAYERS is 1000 - I do need to know how that happened to fix it.

How this even possible?

[code]
OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
OnPlayerTakeDamage (0, 65535, 1126498304, 54, 3)
[code]
Code:
[debug] Run time error 4: "Array index out of bounds"
[23:32:40] [debug]  Attempted to read/write array element at index 65535 in array of size 1000
[23:32:40] [debug] AMX backtrace:
[23:32:40] [debug] #0 0015ac54 in ?? (0, 65535, 1126498304, 54) in HS-RP.amx
[23:32:40] [debug] #1 00015ff8 in public OnPlayerTakeDamage (0, 65535, 1126498304, 54, 3) in HS-RP.amx
Reply
#2

Quote:
Originally Posted by AhmedMohamed
View Post
the player with id 0 fell out from high location so he died with Collision - the Collision ID is 54 - the amount of the Collision in this case is 1126498304 (although it is a high value but it's not the problem) - the body part that was hit is Torso, how issuer id took 65535 as input!!! please tell me!! - MAX_PLAYERS is 1000 - I do need to know how that happened to fix it.

How this even possible?

[code]
OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
OnPlayerTakeDamage (0, 65535, 1126498304, 54, 3)
[code]
Code:
[debug] Run time error 4: "Array index out of bounds"
[23:32:40] [debug]  Attempted to read/write array element at index 65535 in array of size 1000
[23:32:40] [debug] AMX backtrace:
[23:32:40] [debug] #0 0015ac54 in ?? (0, 65535, 1126498304, 54) in HS-RP.amx
[23:32:40] [debug] #1 00015ff8 in public OnPlayerTakeDamage (0, 65535, 1126498304, 54, 3) in HS-RP.amx
Better use with OnPlayerFall (download callbacks.inc and include it, then you can use OnPlayerFall)
or maybe its SA-MP bug :\

Here, try this => https://raw.githubusercontent.com/Ro...r/Opws_Fix.inc
Reply
#3

Quote:
Originally Posted by B3x7K
View Post
Better use with OnPlayerFall (download callbacks.inc and include it, then you can use OnPlayerFall)
or maybe its SA-MP bug :\

Here, try this => https://raw.githubusercontent.com/Ro...r/Opws_Fix.inc
Thanks for replying, but this inc is using OnPlayerTakeDamage with case collision in the definition of OnPlayerFall too.

Quote:
Originally Posted by Y_Less
View Post
What does the wiki say?
it says that the issuerid will be INVALID_PLAYER_ID if self-inflicted.
and that wasn't happened.
Reply
#4

This line is in a_samp.inc
Code:
#define     INVALID_PLAYER_ID    (0xFFFF)
Reply
#5

No explanation?
Reply
#6

what's the codec for? 1hit kill

do you use if(issuerid != INVALID_PLAYER_ID)?
Reply
#7

Quote:
Originally Posted by GeorgeLimit
View Post
what's the codec for? 1hit kill

do you use if(issuerid != INVALID_PLAYER_ID)?
I didn't but.. that may cause the problem that I am talking about?
Reply
#8

Hello, AhmedMohamed first of all, see what Y_Less has questioned you, "0xFFFF" is a hexadecimal value, that when turning into decimal stands for "65535", which is the "issuerid" of the function.

I've had this problem before, I do not know if there is another way to solve it, but I've done a function to call death to the player.
Just do something like this:

PHP Code:
     if(issuerid == INVALID_PLAYER_ID)
    {
        switch(
weaponid)
        {
            case 
54//Your switch weaponid, in this case, collision
            
{
                if(
amount 99.0//Here, check if amount is bigger then 99.0, that is the damage caused by a very large drop.
                
{
                    
//Here, you call your function to kill player.
                
}
                 else
                {
                    
//Here, just deal damage to the player.
                
}
            }
        }
    } 
Creating a function to specifically kill the player in this condition can help, with me it worked.
Reply
#9

You must verify if issuerid is a valid player. If it is not a valid player, issuerid will be INVALID_PLAYER_ID "0xFFFF (65536)".
Reply
#10

issuerid? what is that?
I know isuserid
Reply
#11

Quote:
Originally Posted by GeorgeLimit
View Post
issuerid? what is that?
I know isuserid
issuerid = something who cause damage, can be objectid, playerid, etc...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)