12.04.2014, 09:07
When i /aduty and then Timeout / Leave the server , server gets crashed afterwards , then when i fix the server and log in again typing /aduty it says I'am no longer on admin duty lol.
I really need scripters's help, i tried everything.
I really need scripters's help, i tried everything.
Код:
forward AcmdLog(string2[]); public AcmdLog(string2[]) { new entry[128]; format(entry, sizeof(entry), "%s\n",string2); new File:hFile; hFile = fopen("logs/Admin_CMDs.log", io_append); if(hFile) { fwrite(hFile, entry); fclose(hFile); } } ""on line 223"" I can't see any problem here } CMD:adminduty(playerid, params[]) { return cmd_aduty(playerid, params); } CMD:aduty(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { new AdminTagTimer[MAX_PLAYERS]; strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME); new alevel[25]; new logstring[128]; new year, month, day, hour, minute, second; getdate(year, month, day); gettime(hour, minute, second); if(PlayerInfo[playerid][pAdmin] == 2) { alevel = "Junior Administrator"; } if(PlayerInfo[playerid][pAdmin] == 3) { alevel = "General Administrator"; } if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pAdmin] <= 1336) { alevel = "Senior Administrator"; } if(PlayerInfo[playerid][pAdmin] >= 1337 && PlayerInfo[playerid][pAdmin] <= 99998) { alevel = "Head Administrator"; } if(PlayerInfo[playerid][pAdmin] == 99999) { alevel = "Executive Administrator"; } if(PlayerInfo[playerid][pAdmin] == 100000) { alevel = "Community Director"; } if(PlayerInfo[playerid][pAdminDuty] == 0) { for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false); SetPlayerHealth(playerid, 500000); SetPlayerArmour(playerid, 500000); SetPlayerColor(playerid, 0x660000FF); PlayerInfo[playerid][pAdminDuty] = 1; format(string, sizeof(string), "*{FF0000}AdmWarning{FFFFFF} %s %s is now on admin duty!", alevel, sendername); format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] %s %s is now on admin duty!", day, month, year, hour, minute, second, alevel, sendername); SendAdminMessage(0xFFFFFFFF, string); format(string, sizeof(string), "B-RP Administrator\n{FFFFFF}%s\n{0072FF}%s", PlayerRPName(playerid), alevel); Admintag[playerid] = Create3DTextLabel(string, COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0, 0); Attach3DTextLabelToPlayer(Admintag[playerid], playerid, 0.0, 0.0, 0.2); AcmdLog(logstring); AdminTagTimer[playerid] = SetTimerEx("AdminTag", 30000, true, "i", playerid); } else if(PlayerInfo[playerid][pAdminDuty] == 1) { SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]); SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]); PlayerInfo[playerid][pAdminDuty] = 0; SetPlayerToTeamColor(playerid); KillTimer(AdminTagTimer[playerid]); for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true); Delete3DTextLabel(Admintag[playerid]); format(string, sizeof(string), "*{FF0000}AdmWarning{FFFFFF}: %s %s is no longer on admin duty!", alevel, sendername); format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] %s %s is no longer on admin duty!", day, month, year, hour, minute, second, alevel, sendername); SendAdminMessage(0xFFFFFFFF, string); AcmdLog(logstring); } } return 1;