05.03.2014, 13:12
Hello,
I want to make it with client message instead of dialog. Example:
Online admins:
Name: level 2
Name: level 1
Name: level 5 etc.
This is my /admins cmd
Can someone help me with this?
Also i want to show the admin list only when the admins are on duty, it will say no admins online if they aren't on duty.
Admin duty script
I tried making If(APlayerData[playerid][OnDuty] == 1) on the admin list cmd to show only on duty admins but its showing for that player who is on duty, not for others. Please i need help asap!
I want to make it with client message instead of dialog. Example:
Online admins:
Name: level 2
Name: level 1
Name: level 5 etc.
This is my /admins cmd
pawn Code:
CMD:admins(playerid, params[])
{
new AdminList[500], Name[24];
SendAdminText(playerid, "/admins", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 199) return SendClientMessage(playerid, 0xFF0000FF, "» Admins are online but hidden. Use /ask to ask for help!");
for (new i; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, Name, sizeof(Name));
if (IsPlayerAdmin(i))
{
format(AdminList, 500, "%s{FFFFFF}%s: %s (id: %i) Level: %i [RCON Admin]\n{FFFFFF}", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
continue;
}
if (APlayerData[i][PlayerLevel] > 0)
{
format(AdminList, 500, "%s{FFFFFF}%s: %s (id: %i) Level: %i\n{FFFFFF}", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
}
}
}
if (strlen(AdminList) > 0)
ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_MSGBOX, "Online admins:", AdminList, "Close", "");
else
SendClientMessage(playerid, 0xFF0000FF, "~No admin online~");
}
else
return 0;
return 1;
}
Also i want to show the admin list only when the admins are on duty, it will say no admins online if they aren't on duty.
Admin duty script
pawn Code:
new Text3D:AdminLabel[MAX_PLAYERS];
new AdminSkin[MAX_PLAYERS];
CMD:duty(playerid,params[])
{
new string[128], pName[MAX_PLAYER_NAME];
SendAdminText(playerid, "/duty", params);
if(APlayerData[playerid][PlayerLevel] >= 1)
{
AdminSkin[playerid] = GetPlayerSkin(playerid);
if(APlayerData[playerid][OnDuty] == 1) return SendClientMessage(playerid, 0xFF0000FF,"» You are already on duty!");
GetPlayerName(playerid, pName, sizeof(pName));
SetPlayerSkin(playerid, DutySkin);
SetPlayerColor(playerid, AdminColor);
format(string,sizeof(string),"» Administrator %s(%d) is now on duty.", pName, playerid);
SendClientMessageToAll(0x00FF00FF,string);
SendClientMessage(playerid, 0x808080FF, "** Type /offduty to turn admin duty off.");
AdminLabel[playerid] = Create3DTextLabel("Admin",0x00FF00FF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(AdminLabel[playerid], playerid, 0.0, 0.0, 0.6);
APlayerData[playerid][OnDuty] = 1;
}
else
return 0;
return 1;
}
stock SetSkinOfPlayer(playerid)
{
switch (APlayerData[playerid][PlayerClass])
{
case ClassTruckDriver:
{
SetPlayerSkin(playerid, AdminSkin[playerid]);
}
case ClassPilot:
{
SetPlayerSkin(playerid, AdminSkin[playerid]);
}
case ClassPolice:
{
SetPlayerSkin(playerid, AdminSkin[playerid]);
}
case ClassAssistance:
{
SetPlayerSkin(playerid, AdminSkin[playerid]);
}
}
}
stock SetColorOfPlayer(playerid)
{
switch (APlayerData[playerid][PlayerClass])
{
case ClassTruckDriver:
{
SetPlayerColor(playerid, ColorClassTruckDriver);
}
case ClassPilot:
{
SetPlayerColor(playerid, ColorClassPilot);
}
case ClassPolice:
{
SetPlayerColor(playerid, ColorClassPolice);
}
case ClassAssistance:
{
SetPlayerColor(playerid, ColorClassAssistance);
}
}
}
CMD:offduty(playerid,params[])
{
new string[128], pName[MAX_PLAYER_NAME];
SendAdminText(playerid, "/offduty", params);
if(APlayerData[playerid][PlayerLevel] >= 1)
{
if(APlayerData[playerid][OnDuty] == 0) return SendClientMessage(playerid, 0xFF0000FF,"» You are not on duty!");
GetPlayerName(playerid, pName, sizeof(pName));
SetSkinOfPlayer(playerid);
SetColorOfPlayer(playerid);
format(string,sizeof(string),"» Administrator %s(%d) is no longer on duty.", pName, playerid);
SendClientMessageToAll(0xFF0000FF,string);
Delete3DTextLabel(AdminLabel[playerid]);
APlayerData[playerid][OnDuty] = 0;
}
else
return 0;
return 1;
}