28.01.2015, 09:04
And when the player goes on duty, The admin last position was saved when he was off duty and after he typed /aduty. When when he goes off duty, Admin position should be respawn on the last position he goes on duty.
---------------------------
Like this i recovered from my old friend rp script
---------------------------
Like this i recovered from my old friend rp script
pawn Код:
CMD:setadminname(playerid, params[])
{
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "YOU ARE NOT LOGGED IN!!");
if(PlayerInfo[playerid][pAdmin] > 99998)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new giveplayerid, name[32];
if(sscanf(params, "us[32]", giveplayerid, name))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadminname [playerid/partofname] [name]");
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
return 1;
}
if(PlayerInfo[giveplayerid][pAdminDuty] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
return 1;
}
new length = strlen(name);
if(length < 3 || length > 20)
{
SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters.");
return 1;
}
if(strfind(name, "_", true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name.");
return 1;
}
if(strcmp(name, "AAS", true) == 0 && PlayerInfo[playerid][pAdmin] < 6) {
SendClientMessage(playerid, COLOR_WHITE, "AAS");
return 1;
}
new string[128];
new str[128];
format(str, sizeof(str), "Adminstrator %s has setted your admin name to '%s' you may now go /aduty", GetPlayerNameEx(playerid), name);
format(string, sizeof(string), "AdmCmd: %s has set %s's admin name to '%s'.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), name);
ABroadCast(COLOR_LIGHTRED, string, 1);
SendClientMessage(giveplayerid, COLOR_WHITE, str);
PlayerInfo[giveplayerid][pAdminNameSet] = 1;
format(PlayerInfo[giveplayerid][pAdminName], 32, name);
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}