SA-MP Forums Archive
How to send death messages to only admins. - 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: How to send death messages to only admins. (/showthread.php?tid=426903)



How to send death messages to only admins. - total3clipse - 30.03.2013

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.


Re: How to send death messages to only admins. - Richie© - 30.03.2013

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.


Re: How to send death messages to only admins. - kamzaf - 30.03.2013

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.


Re: How to send death messages to only admins. - Konstantinos - 30.03.2013

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;
}



Re: How to send death messages to only admins. - total3clipse - 30.03.2013

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


Re: How to send death messages to only admins. - total3clipse - 30.03.2013

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.


Re: How to send death messages to only admins. - Konstantinos - 30.03.2013

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


Re: How to send death messages to only admins. - total3clipse - 30.03.2013

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?


Re: How to send death messages to only admins. - Basssiiie - 30.03.2013

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.


Re: How to send death messages to only admins. - total3clipse - 30.03.2013

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.