SA-MP Forums Archive
SendDeathMessage to admin's only?? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendDeathMessage to admin's only?? (/showthread.php?tid=69044)



SendDeathMessage to admin's only?? - Delused - 15.03.2009

Is there a way to SendDeathMessage only to specific id's?


Re: SendDeathMessage to admin's only?? - Pyrokid - 15.03.2009

Try this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(IsPlayerAdmin(i))
        {
          SendDeathMessage(killerid,playerid,reason);
        }
    }
    return 1;
}



Re: SendDeathMessage to admin's only?? - CracK - 15.03.2009

Read this: https://sampwiki.blast.hk/wiki/Function:SendDeathMessage
Quote:
Originally Posted by [Fackin'
Pyro ]
Try this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(IsPlayerAdmin(i))
        {
          SendDeathMessage(killerid,playerid,reason);
        }
    }
    return 1;
}
This will send messages only when admins exist and as many times as the amount of admins.
Like if there are 2 admins message will be shown twice...


Re: SendDeathMessage to admin's only?? - Weirdosport - 15.03.2009

I think the only solution would be to use GameText's or SendClientMessages, and you'd get a hell of alot of spam!

There are several second chat boxes around, might be worth using one of those for the death messages? Not quite sure why you'd only want specific people to see deaths though


Re: SendDeathMessage to admin's only?? - Pyrokid - 15.03.2009

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
            if(IsPlayerAdmin(i))
            {
              SendDeathMessage(killerid,playerid,reason);
            }
        }
    }
    return 1;
}
I forgot to add IsPlayerConnected.

No CracK, I'm pretty sure the above code will check if anyone online is an admin and only send the message to them.


Re: SendDeathMessage to admin's only?? - Delused - 15.03.2009

Quote:
Originally Posted by [Fackin'
Pyro ]
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
            if(IsPlayerAdmin(i))
            {
              SendDeathMessage(killerid,playerid,reason);
            }
        }
    }
    return 1;
}
I forgot to add IsPlayerConnected.

No CracK, I'm pretty sure the above code will check if anyone online is an admin and only send the message to them.
It sends to everyone because you can't put an id in to tell it who to send it to so I was wondering if there is any other way you can do it...


Re: SendDeathMessage to admin's only?? - Weirdosport - 15.03.2009

If you send a death message at any point, everyone on the server sees it. That's why making a death message command only takes a single line. By using a loop, if will display the message as many times as there are admins. 5 admins, and the death message will appear 5 times.


Re: SendDeathMessage to admin's only?? - MenaceX^ - 15.03.2009

So many useless replies. I know it has no sence, between the topic name to what he wrote.
He meant to SPECIFIC ID
not to admins.


Re: SendDeathMessage to admin's only?? - Pyrokid - 15.03.2009

Isn't death message integrated into SA-MP now? My latest script doesn't have SendDeathMessage and they still show. So if it was integrated, what you want is pointless unless you can disable them.


Re: SendDeathMessage to admin's only?? - Weirdosport - 15.03.2009

Quote:
Originally Posted by MenaceX^
So many useless replies. I know it has no sence, between the topic name to what he wrote.
He meant to SPECIFIC ID
not to admins.
Menace did you even read the title? I'll put it below for you.

Quote:

Re: SendDeathMessage to admin's only??

Quote:
Originally Posted by [Fackin'
Pyro ]
Isn't death message integrated into SA-MP now? My latest script doesn't have SendDeathMessage and they still show. So if it was integrated, what you want is pointless unless you can disable them.
I don't think it is integrated, as when I run a blank server the deaths don't appear. Check this for more information: SendDeathMessage