OnPlayerTakeDamage -
AhmedMohamed - 19.01.2019
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
Re: OnPlayerTakeDamage -
B3x7K - 19.01.2019
Quote:
Originally Posted by AhmedMohamed
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
Re: OnPlayerTakeDamage -
AhmedMohamed - 19.01.2019
Quote:
Originally Posted by B3x7K
|
Thanks for replying, but this inc is using OnPlayerTakeDamage with case collision in the definition of OnPlayerFall too.
Quote:
Originally Posted by Y_Less
What does the wiki say?
|
it says that the issuerid will be INVALID_PLAYER_ID if self-inflicted.
and that wasn't happened.
Re: OnPlayerTakeDamage -
AhmedMohamed - 19.01.2019
This line is in a_samp.inc
Code:
#define INVALID_PLAYER_ID (0xFFFF)
Re: OnPlayerTakeDamage -
AhmedMohamed - 19.01.2019
No explanation?
Re: OnPlayerTakeDamage -
GeorgeLimit - 19.01.2019
what's the codec for? 1hit kill
do you use if(issuerid != INVALID_PLAYER_ID)?
Re: OnPlayerTakeDamage -
AhmedMohamed - 19.01.2019
Quote:
Originally Posted by GeorgeLimit
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?
Re: OnPlayerTakeDamage -
ApolloScripter - 19.01.2019
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.
Re: OnPlayerTakeDamage -
Undef1ned - 19.01.2019
You must verify if issuerid is a valid player. If it is not a valid player, issuerid will be INVALID_PLAYER_ID "0xFFFF (65536)".
Re: OnPlayerTakeDamage -
GeorgeLimit - 19.01.2019
issuerid? what is that?
I know isuserid
Re: OnPlayerTakeDamage -
B3x7K - 19.01.2019
Quote:
Originally Posted by GeorgeLimit
issuerid? what is that?
I know isuserid
|
issuerid = something who cause damage, can be objectid, playerid, etc...