cmds_veh.pwn 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. CMD:vrespawn(playerid, params[])
  2. {
  3. if (Players[playerid][pAdmin] < 2)
  4. {
  5. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  6. }
  7. else
  8. {
  9. if (IsPlayerInAnyVehicle(playerid))
  10. Dialog_Show(playerid, VehicleRespawn, DIALOG_STYLE_LIST, "{6688FF}Respawn vehicles", "Current vehicle\nAll vehicles\nNearby vehicles", "Select", "Cancel");
  11. else
  12. Dialog_Show(playerid, VehicleRespawn, DIALOG_STYLE_LIST, "{6688FF}Respawn vehicles", "All vehicles\nNearby vehicles", "Select", "Cancel");
  13. }
  14. return 1;
  15. }
  16. CMD:fvrespawn(playerid, params[])
  17. {
  18. new faction;
  19. if (Players[playerid][pAdmin] < 2 && !Players[playerid][pFactionMod])
  20. {
  21. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  22. }
  23. else if (sscanf(params, "i", faction))
  24. {
  25. return SendSyntaxMessage(playerid, "/deletefaction (faction ID)");
  26. }
  27. else if (!IsValidFactionID(faction))
  28. {
  29. return SendErrorMessage(playerid, "You have specified an invalid faction ID.");
  30. }
  31. else
  32. {
  33. foreach (new i : Player)
  34. {
  35. if (GetPlayerFactionID(i) == faction)
  36. {
  37. SendInfoMessage(i, "You have been kicked from your faction due to deletion.");
  38. ResetFactionInfo(i);
  39. }
  40. }
  41. ClearFactionGates(faction);
  42. ClearFactionVehicles(faction);
  43. format(gExecute, sizeof(gExecute), "DELETE FROM rp_factions WHERE `fcID` = %i", Factions[faction][fcID]);
  44. mysql_tquery(gConnection, gExecute);
  45. format(gExecute, sizeof(gExecute), "UPDATE rp_accounts SET FactionID = 0 WHERE FactionID = %i", Factions[faction][fcID]);
  46. mysql_tquery(gConnection, gExecute);
  47. ResetFaction(faction);
  48. SendAdminMessage(COLOR_RED, "Admin: %s has deleted faction %i.", ReturnNameEx(playerid, 0), faction);
  49. }
  50. return 1;
  51. }