SendDeathMessage in admin FS help
#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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);} 
Reply
#5

Still, no change..
Reply
#6

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.
Reply
#7

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.
Reply
#8

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
Reply
#9

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;
Reply
#10

EDIT: nvm, it works!

Cheers!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)