19.06.2013, 14:20
Hello, I have a aduty command and it only sends the message that the admin is on duty to other admins, how would I change this so it sends it to ALL players.
pawn Код:
CMD:aduty(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 2) {
if(strlen(PlayerInfo[playerid][pAdminName]) > 2 && strlen(PlayerInfo[playerid][pAdminName]) < 20) {
new
string[128];
if(AdminDuty[playerid] != 0) {
if(GetPlayerState(playerid) == PLAYER_STATE_WASTED)
return SendClientMessage(playerid, COLOR_GRAD2, "You can't do this while wasted.");
ResetPlayerWeapons(playerid);
SetPlayerArmedWeapon(playerid, 0);
if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 2) {
GettingSpectated[Spectate[playerid]] = 999;
Spectating[playerid] = 0;
Spectate[playerid] = 999;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
}
if(MP3Station[playerid] != 0) {
MP3Station[playerid] = 0;
StopAudioStreamForPlayer(playerid);
}
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmourEx(playerid, PlayerInfo[playerid][pArmor]);
format(string, sizeof(string), "%s (ID %d - %s) is now off-duty as a Level %d Admin.", PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
ABroadCast(COLOR_WHITE, string, 1);
if(PlayerInfo[playerid][pAdmin] == 1) {
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to your Level 1 Admin commands.");
} else if(PlayerInfo[playerid][pAdmin] > 1 && PlayerInfo[playerid][pAdmin] < 6) {
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, and only have access to /admins /check /jail /ban /sban /kick /skick /showflags /reports /nrn");
} else if(PlayerInfo[playerid][pAdmin] == 6) {
SendClientMessage(playerid, COLOR_YELLOW, "You're now off-duty as admin, but still have access to all of your commands since you're a Level 6 Admin.");
} else { }
SendClientMessage(playerid, COLOR_REALRED, "Please remember to turn off any hacks you may have (press F12 to disable ******).");
ResetPlayerVariables(playerid);
AttemptPlayerLogin(playerid, AdminRelogPassword[playerid]);
}
else
{
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 32);
GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SaveAccount(playerid);
if(IsValidDynamicObject(PlayerInfo[playerid][pWeedObject]))
{
DestroyDynamicObject(PlayerInfo[playerid][pWeedObject]);
}
PhoneOnline[playerid] = 1;
for(new i = 0; i < MAX_REPORTS; i++)
{
if(Reports[i][ReportFrom] == playerid)
{
Reports[i][ReportFrom] = 999;
Reports[i][BeingUsed] = 0;
Reports[i][TimeToExpire] = 0;
}
}
if(GotHit[playerid] > 0)
{
if(GetChased[playerid] < 999)
{
if(IsPlayerConnected(GetChased[playerid]))
{
SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Your hit has left the server.");
GoChase[GetChased[playerid]] = 999;
}
}
}
if(GoChase[playerid] < 999)
{
GetChased[GoChase[playerid]] = 999;
GotHit[GoChase[playerid]] = 999;
}
SetPVarInt(playerid, "TempName", 1);
new username[MAX_PLAYER_NAME];
GetPlayerName(playerid, username, sizeof(username));
SetPVarString(playerid, "TempNameName", username);
AdminDuty[playerid] = 1;
format(string, sizeof(string), "%s (ID %d - %s) is now on-duty as a Level %d Admin.",PlayerInfo[playerid][pAdminName], playerid, GetPlayerNameEx(playerid), PlayerInfo[playerid][pAdmin]);
ABroadCast(COLOR_WHITE, string, 1);
SendClientMessage(playerid, COLOR_YELLOW, "You're now on-duty as admin and have access to all your commands, see /ah.");
SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
}
}
else SendClientMessage(playerid, COLOR_WHITE, "You need an admin name to go on-duty. Contact a Level 5+ Admin to have your admin name set.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}