Messages - 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: Messages (
/showthread.php?tid=652982)
Messages -
Loinal - 23.04.2018
Hello, If player joined and he is an admin and i want to show the "Name has logged in as Admin level 999" but for all admins, How can i block the admin who joined from seeing this message?
Re: Messages -
Lokii - 23.04.2018
PHP код:
public OnPlayerConnect(playerid)
{
new name[24], str[45];
if(p_info[playerid][admin] > 0) //check if player admin
{
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "admin %s level %d", name, p_info[playerid][admin]);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) //loop
{
if(i == playerid || p_info[i][admin] < 1) continue; //if player the player is the one who connected or not admin we skip
SendClientMessage(i, -1, str); //send msg to all admins except the one who joined thats y we skip.
}
}
return 1;
}
Re: Messages -
UFF - 23.04.2018
try this its simple Under OnPlayerConnect
Код:
if(pAdmin[playerid] != 0) // check if the player is admin
{
{
new tmp3[25], str[200];
switch(pAdmin[playerid]) // switching admin level ranks
{
case 1: tmp3 = "Junior Administrator";
case 2: tmp3 = "Administrator";
//== Add all the ranks
}
format(str, sizeof(str), "%s %s(%i) has logged in!", tmp3, pName[playerid], playerid); // use your variables for playername and playerid
SendClientMessageToAll(-1, str);
}
}
You can also use for level
case 1: tmp3 = "Level 1";
case 2: tmp3 = "Level 2";
//===== More ranks
Re: Messages -
GTLS - 23.04.2018
Under OnPlayerConnect or under any other User Defined Function.
PHP код:
new name[MAX_PLAYER_NAME],str[128];
format(str, sizeof(str), "[SERVER] %s has logged in as Level %d Admin. ", GetPlayerName(playerid, name, sizeof(name)),PInfo[playerid][pAdmin]);
for(new i = 0;i < MAX_PLAYERS; i++) //For Optimising, you can use your own Total Connected player variable. I mean you should.
{
if(!IsPlayerConnected(i)) countine; //Just to make sure ID is correct or else SAMP will give error.
if(PInfo[i][pAdmin])
SendClientMessage(i, Color_RED, str);
}