SendDeathMessage in admin FS help -
YoYo123 - 09.10.2012
So, I'm making my own admin system and I've got to the part where /akill comes in. I want the deathlist to show weapon #40 icon (
https://sampwiki.blast.hk/wiki/Weapons) so I added the following line in dcmd_akill:
Код:
SendDeathMessage(-1, id, 40);
The problem is that I also have SendDeathMessage in the gamemode script which makes it display this:
How can I fix it so only the first item in the list appears?
Re: SendDeathMessage in admin FS help -
park4bmx - 09.10.2012
remove it from the gamemode i guess.
or make a check in you gamemode to see what the reason is and if its
53 then dont display it.
Re: SendDeathMessage in admin FS help -
YoYo123 - 09.10.2012
I also want other icons to display depends on the reason, killer and all that so I won't just remove it from the gamemode script. i tried to add this to OnPlayerDeath:
Код:
if(reason != 53) // Also tried 47
SendDeathMessage(killerid, playerid, reason);
But it didn't affect anything.
Re: SendDeathMessage in admin FS help -
park4bmx - 09.10.2012
Quote:
Originally Posted by YoYo123
I also want other icons to display depends on the reason, killer and all that so I won't just remove it from the gamemode script. i tried to add this to OnPlayerDeath:
Код:
if(reason != 53) // Also tried 47
SendDeathMessage(killerid, playerid, reason);
But it didn't affect anything.
|
yes becosue your saying "!" which means "if Not", might not be good in that case.
PHP код:
if(reason == 53){}else{SendDeathMessage(killerid, playerid, reason);}
Re: SendDeathMessage in admin FS help -
YoYo123 - 09.10.2012
Still, no change..
Re: SendDeathMessage in admin FS help -
park4bmx - 09.10.2012
yeah, i just died with SetHealth(playerid,0); and it didn't call the reason for it under OnPlayerDeath.
so you might wanna printf under OnPlayerDeath see if it gets called, if it doesn't then there's a different DeathMessage somewhere.
Re: SendDeathMessage in admin FS help -
park4bmx - 09.10.2012
Quote:
Originally Posted by ******
That STILL means "not". There's no reason to use an "if/else" like that in regular code.
|
i know that's what i was aiming for,since the
if(reason != 53) return didn't work,told him to try this way.
but that didn't work either so its either that the reason on
OnPlayerDeath doesn't get called when you sue
SetPlayerHealth(playerid,0); or i don't know.
Re: SendDeathMessage in admin FS help -
YoYo123 - 09.10.2012
Here is my OnPlayerDeath callback:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
SetPlayerScore(killerid, GetPlayerScore(playerid) + 1);
GivePlayerMoney(playerid, -20000);
return 1;
}
What's wrong with it? I really wanna get rid of this problem
Re: SendDeathMessage in admin FS help -
Roel - 09.10.2012
Well it's because the SendDeathMessage is used twice, so the thing you can do is create a variable at the top of the script like:
pawn Код:
new Akilled[MAX_PLAYERS];
At the command /akill you set this ABOVE the setplayerhealth(playerid,0.0);
At onplayerdeath:
pawn Код:
if(Akilled[playerid] != 1)
{
SendDeathMessage(killerid, playerid, reason);
}
Akilled[playerid] = 0;
Re: SendDeathMessage in admin FS help -
YoYo123 - 09.10.2012
EDIT: nvm, it works!
Cheers!