Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. COMMAND:admincode(playerid, params[])
  2. {
  3. if(PlayerStat[playerid][AdminLevel] < 1) return SendClientMessage(playerid, WHITE, "SERVER: Unknown Command.");
  4. if(PlayerStat[playerid][AdminLogged] == 1) return SendClientMessage(playerid, GREY, "You are already logged in as an Administrator.");
  5. new code[128], str[128];
  6. if(sscanf(params,"s[128]", code)) return SendClientMessage(playerid, GREY, "USAGE: /admincode [code]");
  7. else if(!strcmp(code,PlayerStat[playerid][AdminCode], false))
  8. {
  9. SendClientMessage(playerid, LIGHT_GREEN, "You have logged in as an administrator.");
  10. PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
  11. PlayerStat[playerid][AdminLogged] = 1;
  12. format(str, sizeof(str), "[SERVER] %s %s has logged in.", Getalvl(playerid), GetForumNameNC(playerid));
  13. SendAdminMessage(LIGHT_GREEN, str);
  14. PlayAdminSound(1062);
  15. return 1;
  16. }
  17. SendClientMessage(playerid, WHITE, "SERVER: Bad code.");
  18. AdminCodeTry[playerid]++;
  19. if(AdminCodeTry[playerid] >= 3)
  20. {
  21. 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));
  22. SendAdminMessage(RED, str);
  23. INI_Open(Accounts(playerid));
  24. INI_WriteInt("AdminLevel", 0);
  25. INI_Save();
  26. INI_Close();
  27. PlayerStat[playerid][AdminLevel] = 0;
  28. }
  29. if(AdminCodeTry[playerid] >= 2)
  30. {
  31. format(str, sizeof(str), "[WARNING] Account %s (Admin Name: %s) has attempted the second administrator login and failed.", GetOOCName(playerid), GetForumNameNC(playerid));
  32. SendAdminMessage(RED, str);
  33. PlayAdminSound(1058);
  34. }
  35. return 1;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement