cmds_fac.pwn 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. CMD:resetordertime(playerid, params[])
  2. {
  3. new targetid;
  4. if (Players[playerid][pAdmin] < 5)
  5. {
  6. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  7. }
  8. else if (sscanf(params, "u", targetid))
  9. {
  10. return SendSyntaxMessage(playerid, "/resetordertime [playerid/name]");
  11. }
  12. else if (!IsPlayerConnected(targetid))
  13. {
  14. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  15. }
  16. else if (!IsPlayerLoggedIn(targetid))
  17. {
  18. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  19. }
  20. else
  21. {
  22. Players[targetid][pPackageTime] = 0;
  23. SendInfoMessage(playerid, "You have reset %s's package order time. They can now /orderpackage again.", ReturnNameEx(targetid, 0));
  24. }
  25. return 1;
  26. }
  27. CMD:copfix(playerid,params[])
  28. {
  29. new targetid;
  30. if(Players[playerid][pAdmin] < 2)
  31. {
  32. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  33. }
  34. else if (sscanf(params,"u",targetid))
  35. {
  36. return SendSyntaxMessage(playerid, "/copfix [playerid/name]");
  37. }
  38. else if (GetPlayerFactionType(targetid) != FACTION_LEO)
  39. {
  40. return SendErrorMessage(playerid, "The specified target is not in a law enforcement faction.");
  41. }
  42. else if (!IsPlayerConnected(targetid))
  43. {
  44. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  45. }
  46. else if (IsPlayerNPC(targetid))
  47. {
  48. return SendErrorMessage(playerid,"You cannot use this command on a NPC.");
  49. }
  50. else if (!IsPlayerLoggedIn(targetid))
  51. {
  52. return SendErrorMessage(playerid,"The specified target is not logged in yet.");
  53. }
  54. else
  55. {
  56. if(Players[playerid][pAdmin] < 6)
  57. {
  58. SendAdminMessage(COLOR_RED, "Admin: %s has copfixed %s.", ReturnNameEx(playerid), ReturnNameEx(targetid));
  59. }
  60. ShowLockerMenu(targetid);
  61. SendInfoMessage(targetid,"%s has copfixed you.",ReturnNameEx(playerid));
  62. SendInfoMessage(playerid,"You have copfixed %s.",ReturnNameEx(targetid));
  63. new log[128];
  64. format(log, sizeof(log), "%s has copfixed %s", ReturnName(playerid), ReturnName(targetid));
  65. CreateLog("admin", log);
  66. }
  67. return 1;
  68. }
  69. CMD:deletefaction(playerid, params[])
  70. {
  71. new faction;
  72. if (Players[playerid][pAdmin] < 5 && !Players[playerid][pFactionMod])
  73. {
  74. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  75. }
  76. else if (sscanf(params, "i", faction))
  77. {
  78. return SendSyntaxMessage(playerid, "/deletefaction (faction ID)");
  79. }
  80. else if (!IsValidFactionID(faction))
  81. {
  82. return SendErrorMessage(playerid, "You have specified an invalid faction ID.");
  83. }
  84. else
  85. {
  86. foreach (new i : Player)
  87. {
  88. if (GetPlayerFactionID(i) == faction)
  89. {
  90. SendInfoMessage(i, "You have been kicked from your faction due to deletion.");
  91. ResetFactionInfo(i);
  92. }
  93. }
  94. ClearFactionGates(faction);
  95. ClearFactionVehicles(faction);
  96. format(gExecute, sizeof(gExecute), "DELETE FROM rp_factions WHERE `fcID` = %i", Factions[faction][fcID]);
  97. mysql_tquery(gConnection, gExecute);
  98. format(gExecute, sizeof(gExecute), "UPDATE rp_accounts SET FactionID = 0 WHERE FactionID = %i", Factions[faction][fcID]);
  99. mysql_tquery(gConnection, gExecute);
  100. mysql_format(gConnection, gExecute, sizeof(gExecute), "DELETE FROM rp_factionequipment WHERE itemFactionID = %i", Factions[faction][fcID]);
  101. mysql_tquery(gConnection, gExecute);
  102. mysql_format(gConnection, gExecute, sizeof(gExecute), "DELETE FROM rp_factionaccessories WHERE accessoryFactionID = %i", Factions[faction][fcID]);
  103. mysql_tquery(gConnection, gExecute);
  104. ResetFaction(faction);
  105. SendAdminMessage(COLOR_RED, "Admin: %s has deleted faction %i.", ReturnNameEx(playerid, 0), faction);
  106. }
  107. return 1;
  108. }