23.04.2018, 11:42
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?
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;
}
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
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);
}