SendDeathMessage to admin's only??
#1

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

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

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

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

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

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

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)