Advertisement
Guest User

[DYNAMIC] CCTV System - commands

a guest
Aug 26th, 2016
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. /*
  2. =============================================
  3. | CCTV SYSTEM |
  4. | (commands) |
  5. =============================================
  6. */
  7.  
  8. //cerca: ADMIN LEVEL HERE - da sostituire RCON con AdmLevel;
  9. //cerca: FACTION HERE - da sostuire con fazione del giocatore;
  10. //cerca: FACTION VEH HERE - da sostuire con veicolo di X fazione.
  11.  
  12. CMD:helpcctv(playerid, params[])
  13. {
  14. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  15. SendError(playerid, "Available commands:");
  16. SendClientMessage(playerid, -1, "/createcctv - /deletecctv - /editcctv - /rangecctv");
  17. SendClientMessage(playerid, -1, "/movecctv - /renamecctv - /factioncctv - /gotocctv");
  18. return 1;
  19. }
  20.  
  21. CMD:createcctv(playerid, params[])
  22. {
  23. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  24. new
  25. name[MAX_CCTV_NAME], factionid;
  26. if(sscanf(params, "ds[MAX_CCTV_NAME]", factionid, name)) return SendError(playerid, "/createcctv [factionid] [cctv_name]");
  27. new id = CreateCCTV(playerid, name, factionid);
  28. if(id == -1) return SendError(playerid, "You can not create more CCTV.");
  29. SendError(playerid, "AdmCmd: CCTV created successfully.");
  30. SendError(playerid, "[!] Remember to place the CCTV through the command /editcctv");
  31. return 1;
  32. }
  33.  
  34. CMD:deletecctv(playerid, params[])
  35. {
  36. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  37. new id;
  38. if(sscanf(params, "d", id)) return SendError(playerid, "/deletecctv [cctv_id]");
  39. DeleteCCTV(playerid, id);
  40. return 1;
  41. }
  42.  
  43. CMD:editcctv(playerid, params[])
  44. {
  45. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  46. new id;
  47. if(sscanf(params, "d", id)) return SendError(playerid, "/editcctv [cctv_id]");
  48. EditCCTV(playerid, id);
  49. return 1;
  50. }
  51.  
  52. CMD:movecctv(playerid, params[])
  53. {
  54. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  55. new id;
  56. if(sscanf(params, "d", id)) return SendError(playerid, "/movecctv [cctv_id]");
  57. MoveCCTV(playerid, id);
  58. return 1;
  59. }
  60.  
  61. CMD:renamecctv(playerid, params[])
  62. {
  63. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  64. new
  65. name[MAX_CCTV_NAME], id;
  66. if(sscanf(params, "ds[MAX_CCTV_NAME]", id, name)) return SendError(playerid, "/renamecctv [cctv_id] [name]");
  67. ChangeCCTVName(playerid, id, name);
  68. return 1;
  69. }
  70.  
  71. CMD:factioncctv(playerid, params[])
  72. {
  73. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  74. new
  75. id, factionid;
  76. if(sscanf(params, "dd", id, factionid)) return SendError(playerid, "/factioncctv [cctv_id] [factionid]");
  77. ChangeCCTVFaction(playerid, id, factionid);
  78. return 1;
  79. }
  80.  
  81. CMD:gotocctv(playerid, params[])
  82. {
  83. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  84. new id;
  85. if(sscanf(params, "d", id)) return SendError(playerid, "/gotocctv [cctv_id]");
  86. if(!Iter_Contains(CCTVIter, id)) return SendError(playerid, "The ID of the typed CCTV is nonexistent. (Use Server ID)");
  87. SetPlayerPos(playerid, CCTVInfo[id][cctv_X], CCTVInfo[id][cctv_Y], CCTVInfo[id][cctv_Z]);
  88. SetPlayerVirtualWorld(playerid, CCTVInfo[id][cctv_VW]);
  89. return 1;
  90. }
  91.  
  92. CMD:rangecctv(playerid, params[])
  93. {
  94. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command."); //ADMIN LEVEL HERE
  95. new
  96. exist, str[256];
  97. foreach(new i : CCTVIter)
  98. if(IsPlayerInRangeOfPoint(playerid, 10.0, CCTVInfo[i][cctv_X], CCTVInfo[i][cctv_Y], CCTVInfo[i][cctv_Z]))
  99. {
  100. exist = 1;
  101. format(str, sizeof str, "CCTV (#%d) - Name: %s - Faction ID: #%d");
  102. SendError(playerid, str);
  103. }
  104. if(!exist) return SendError(playerid, "There are CCTV near you. (RANGE: 10.0)");
  105. return 1;
  106. }
  107.  
  108. CMD:cctv(playerid, params[])
  109. {
  110. //FACTION HERE & ADMIN LEVEL HERE & FACTION VEH HERE
  111. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command.");
  112. if(inCCTV[playerid]) return SendError(playerid, "You are already viewing a CCTV. (/cctvoff).");
  113. ShowPlayerCCTVMenu(playerid);
  114. return 1;
  115. }
  116.  
  117. CMD:cctvoff(playerid, params[])
  118. {
  119. //FACTION HERE & ADMIN LEVEL HERE
  120. if(!IsPlayerAdmin(playerid)) return SendError(playerid, "You are not authorized to use this command.");
  121. if(!inCCTV[playerid]) return SendError(playerid, "You're viewing a CCTV.");
  122. PlayerCancelCCTV(playerid);
  123. return 1;
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement