When I do /setadminname [ID] [ADMINNAME] It works then I do /aduty, it says I am on duty with my admin commands but my admin name does not show on the tab list or anywhere when I do /aduty again, it shuts down the server, I start it back up and my admin name appears and I have to register, why?
Aduty:
Setadminname
Aduty:
Code:
CMD:aduty(playerid, params[])
{
new str[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessage(playerid, COLOR_GREY, "You may not go on duty while injured, /giveup if emergency.");
if(AdminDuty[playerid] != 1)
{
AdminDutyCash[playerid] = PlayerInfo[playerid][pCash];
GetPlayerHealth(playerid, AdminDutyHealth[playerid]);
AdminDutyArmor[playerid] = PlayerInfo[playerid][pArmor];
if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
AdminDuty[playerid] = 1;
format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetNameEx(playerid), PlayerInfo[playerid][pAdmin]);
SendClientMessageToAdmins(-1, str, 1);
SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
}
else
{
waitcheck[playerid] = 2;
SetPVarInt(playerid, "SpecOff", 1);
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
AdminDuty[playerid] = 0;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerWeapons(playerid);
//SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
//SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
SetPlayerName(playerid, PlayerInfo[playerid][pName1]);
new backup[126];
format(backup, 126, "%s Old cash: %i - New cash: %i", GetNameEx(playerid), PlayerInfo[playerid][pCash], AdminDutyCash[playerid]);
Log("/logs/backup.txt", backup);
PlayerInfo[playerid][pCash] = AdminDutyCash[playerid];
SetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetNameEx(playerid));
SendClientMessageToAdmins(COLOR_YELLOW, str, 1);
SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
//spec[playerid] = -1;
SetPlayerWeaponsEx(playerid);
}
return 1;
}
Setadminname
Code:
CMD:setadminname(playerid, params[])
{
new giveplayerid, name[56], str[126];
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "us[56]", giveplayerid, name)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setadminname [playerid/partofname] [name]");
if(PlayerInfo[giveplayerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
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;
}
format(str, 126, "AdmCmd: %s has set %s's admin-name to %s.", GetNameEx(playerid), GetNameEx(giveplayerid), name);
SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
format(PlayerInfo[giveplayerid][pAName], 56, name);
return 1;
}
Aucun commentaire:
Enregistrer un commentaire