How to send death messages to only admins.
#1

When a player dies and you choose to senddeathmessage it then it sends it to the whole server, but how would I make it send to only admins as you can't do the for(new I=0; I<MAX_PLAYERS; I++) a there is no space to put I in the SendDeathMessage and I want the pictures, so I don't really want to do this by doing SendClientMessage.

Thanks in advance to anyone who can help me.
Reply
#2

I think the death messages is only global (for everyone to see).
You can send only to admins with SendClientMessage or using textdraws that only shows for admins.
Reply
#3

lets take a look at SendDeathMessage.

pawn Код:
SendDeathMessage(playerid /* the player who got killed*/, killerid /*the person who killed the player*/, reason /*how did he die*/);
In that I dont see a way you could possibly send a message to admins only as this is a native function by samp embedded already in the inc somewhere.
Reply
#4

It's possible!
pawn Код:
stock SendDeathMessageToAdmins(killerid, playerid, reason)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendDeathMessage(killerid, playerid, reason);
    }
    return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessageToAdmins(killerid, playerid, reason);
    return 1;
}
Reply
#5

Okay then, thank you for helping me Kamzaf and Richie.
Reply
#6

Quote:
Originally Posted by Dwane
Посмотреть сообщение
It's possible!
pawn Код:
stock SendDeathMessageToAdmins(killerid, playerid, reason)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendDeathMessage(killerid, playerid, reason);
    }
    return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessageToAdmins(killerid, playerid, reason);
    return 1;
}
I will try it pal.
Reply
#7

It shows the death message at the right side of the screen only to RCON admins.
Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
It shows the death message at the right side of the screen only to RCON admins.
If I change the rcon admin thing to my enum thing like if(p_data[i][AdminLevel] >= 1)... It would still work?
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
It's possible!
pawn Код:
stock SendDeathMessageToAdmins(killerid, playerid, reason)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i)) SendDeathMessage(killerid, playerid, reason);
    }
    return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessageToAdmins(killerid, playerid, reason);
    return 1;
}
This won't work. It will spam the Death Message list, depending on how many admins are online. If there are 3 admins online, it will show each death 3 times in the list. You can't show the list only for admins, you should try SendClientMessage or something like that, if you want to report deaths only to admins.
Reply
#10

Quote:
Originally Posted by Basssiiie
Посмотреть сообщение
This won't work. It will spam the Death Message list, depending on how many admins are online. If there are 3 admins online, it will show each death 3 times in the list. You can't show the list only for admins, you should try SendClientMessage or something like that, if you want to report deaths only to admins.
Okay then will do mate, but sometimes when I want a message to only send to admins it only sends to the person with ID 0 if they are an admin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)