SA-MP Forums Archive
SendDeathMessage in admin FS help - 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: SendDeathMessage in admin FS help (/showthread.php?tid=383843)



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(killeridplayeridreason);} 



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);
pawn Код:
Akilled[targeid] = 1;
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!