Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COMMAND:admincode(playerid, params[])
- {
- if(PlayerStat[playerid][AdminLevel] < 1) return SendClientMessage(playerid, WHITE, "SERVER: Unknown Command.");
- if(PlayerStat[playerid][AdminLogged] == 1) return SendClientMessage(playerid, GREY, "You are already logged in as an Administrator.");
- new code[128], str[128];
- if(sscanf(params,"s[128]", code)) return SendClientMessage(playerid, GREY, "USAGE: /admincode [code]");
- else if(!strcmp(code,PlayerStat[playerid][AdminCode], false))
- {
- SendClientMessage(playerid, LIGHT_GREEN, "You have logged in as an administrator.");
- PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
- PlayerStat[playerid][AdminLogged] = 1;
- format(str, sizeof(str), "[SERVER] %s %s has logged in.", Getalvl(playerid), GetForumNameNC(playerid));
- SendAdminMessage(LIGHT_GREEN, str);
- PlayAdminSound(1062);
- return 1;
- }
- SendClientMessage(playerid, WHITE, "SERVER: Bad code.");
- AdminCodeTry[playerid]++;
- if(AdminCodeTry[playerid] >= 3)
- {
- format(str, sizeof(str), "[WARNING] Account %s (Admin Name: %s) has attempted the third administrator login and failed, his powers have been taken.", GetOOCName(playerid), GetForumNameNC(playerid));
- SendAdminMessage(RED, str);
- INI_Open(Accounts(playerid));
- INI_WriteInt("AdminLevel", 0);
- INI_Save();
- INI_Close();
- PlayerStat[playerid][AdminLevel] = 0;
- }
- if(AdminCodeTry[playerid] >= 2)
- {
- format(str, sizeof(str), "[WARNING] Account %s (Admin Name: %s) has attempted the second administrator login and failed.", GetOOCName(playerid), GetForumNameNC(playerid));
- SendAdminMessage(RED, str);
- PlayAdminSound(1058);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement