cmds_teleport.pwn 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. CMD:tp(playerid, params[])
  2. {
  3. if (Players[playerid][pAdmin] < 1)
  4. {
  5. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  6. }
  7. else
  8. {
  9. Dialog_Show(playerid, Teleport, DIALOG_STYLE_LIST, "{6688FF}Teleports", "Teleport List\nStatic Buildings\nInteriors", "Select", "Cancel");
  10. }
  11. return 1;
  12. }
  13. CMD:goto(playerid, params[])
  14. {
  15. new targetid;
  16. if (Players[playerid][pAdmin] < 1)
  17. {
  18. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  19. }
  20. else if (sscanf(params, "u", targetid))
  21. {
  22. return SendSyntaxMessage(playerid, "/goto [playerid/name]");
  23. }
  24. else if (!IsPlayerConnected(targetid))
  25. {
  26. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  27. }
  28. else if (!IsPlayerLoggedIn(targetid))
  29. {
  30. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  31. }
  32. else if (!IsPlayerSpawned(targetid))
  33. {
  34. return SendErrorMessage(playerid, "The specified target is not spawned.");
  35. }
  36. else if (!Players[targetid][pSetupInfo])
  37. {
  38. return SendErrorMessage(playerid, "The specified target is setting up their character.");
  39. }
  40. else if (Players[targetid][pSpectate] != INVALID_PLAYER_ID)
  41. {
  42. return SendErrorMessage(playerid, "The specified target is currently spectating.");
  43. }
  44. else
  45. {
  46. TeleportToPlayer(playerid, targetid);
  47. SendInfoMessage(playerid, "You have warped to %s's location.", ReturnNameEx(targetid, 0));
  48. }
  49. return 1;
  50. }
  51. CMD:get(playerid, params[])
  52. {
  53. new targetid;
  54. if (Players[playerid][pAdmin] < 1)
  55. {
  56. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  57. }
  58. else if (sscanf(params, "u", targetid))
  59. {
  60. return SendSyntaxMessage(playerid, "/get [playerid/name]");
  61. }
  62. else if (!IsPlayerConnected(targetid))
  63. {
  64. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  65. }
  66. else if (IsPlayerNPC(targetid))
  67. {
  68. return SendErrorMessage(playerid, "You cannot use this command on a NPC.");
  69. }
  70. else if (!IsPlayerLoggedIn(targetid))
  71. {
  72. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  73. }
  74. else if (!IsPlayerSpawned(targetid))
  75. {
  76. return SendErrorMessage(playerid, "The specified target is not spawned.");
  77. }
  78. else if (Players[targetid][pAdmin] > Players[playerid][pAdmin])
  79. {
  80. return SendErrorMessage(playerid, "The specified target has a higher admin level.");
  81. }
  82. else
  83. {
  84. TeleportToPlayer(targetid, playerid);
  85. SendInfoMessage(playerid, "You have warped %s to your location.", ReturnNameEx(targetid, 0));
  86. }
  87. return 1;
  88. }
  89. CMD:sendspawn(playerid, params[])
  90. {
  91. new targetid;
  92. if (Players[playerid][pAdmin] < 2)
  93. {
  94. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  95. }
  96. else if (sscanf(params, "u", targetid))
  97. {
  98. return SendSyntaxMessage(playerid, "/sendspawn [playerid/name]");
  99. }
  100. else if (!IsPlayerConnected(targetid))
  101. {
  102. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  103. }
  104. else if (!IsPlayerLoggedIn(targetid))
  105. {
  106. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  107. }
  108. else if (Players[targetid][pJailType] != 0)
  109. {
  110. return SendErrorMessage(playerid, "The specified target is currently in jail.");
  111. }
  112. else if (!IsPlayerSpawned(targetid))
  113. {
  114. return SendErrorMessage(playerid, "The specified target is not spawned.");
  115. }
  116. else
  117. {
  118. SendToDefaultSpawn(targetid);
  119. SendInfoMessage(playerid, "You have sent %s to the default spawn.", ReturnNameEx(targetid, 0));
  120. SendInfoMessage(targetid, "You have been sent to the default spawn.");
  121. }
  122. return 1;
  123. }
  124. CMD:setworld(playerid, params[])
  125. {
  126. new targetid, vw;
  127. if (Players[playerid][pAdmin] < 2)
  128. {
  129. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  130. }
  131. else if (sscanf(params, "ui", targetid, vw))
  132. {
  133. return SendSyntaxMessage(playerid, "/setworld [playerid/name] [virtual]");
  134. }
  135. else if (!IsPlayerConnected(targetid))
  136. {
  137. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  138. }
  139. else if (IsPlayerNPC(targetid))
  140. {
  141. return SendErrorMessage(playerid, "You cannot use this command on a NPC.");
  142. }
  143. else if (!IsPlayerLoggedIn(targetid))
  144. {
  145. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  146. }
  147. else if (!IsPlayerSpawned(targetid))
  148. {
  149. return SendErrorMessage(playerid, "The specified target is not spawned.");
  150. }
  151. else
  152. {
  153. SetPlayerVirtualWorld(targetid, vw);
  154. SendInfoMessage(playerid, "You have set %s's virtual world to %i.", ReturnNameEx(targetid, 0), vw);
  155. }
  156. return 1;
  157. }
  158. CMD:setint(playerid, params[])
  159. {
  160. new targetid, interior;
  161. if (Players[playerid][pAdmin] < 2)
  162. {
  163. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  164. }
  165. else if (sscanf(params, "ui", targetid, interior))
  166. {
  167. return SendSyntaxMessage(playerid, "/setint [playerid/name] [interior]");
  168. }
  169. else if (!IsPlayerConnected(targetid))
  170. {
  171. return SendErrorMessage(playerid, "The specified target doesn't exist.");
  172. }
  173. else if (IsPlayerNPC(targetid))
  174. {
  175. return SendErrorMessage(playerid, "You cannot use this command on a NPC.");
  176. }
  177. else if (!IsPlayerLoggedIn(targetid))
  178. {
  179. return SendErrorMessage(playerid, "The specified target is not logged in yet.");
  180. }
  181. else if (!IsPlayerSpawned(targetid))
  182. {
  183. return SendErrorMessage(playerid, "The specified target is not spawned.");
  184. }
  185. else
  186. {
  187. SetPlayerInterior(targetid, interior);
  188. SendInfoMessage(playerid, "You have set %s's interior to %i.", ReturnNameEx(targetid, 0), interior);
  189. }
  190. return 1;
  191. }
  192. CMD:gotocoords(playerid, params[])
  193. {
  194. new Float:fX, Float:fY, Float:fZ, interior;
  195. // remove commas so we can copy paste coords without removing commas.
  196. for (new i = 0, l = strlen(params); i < l; i ++) {
  197. if (params[i] == ',') {
  198. strdel(params, i, i + 1);
  199. }
  200. }
  201. if (Players[playerid][pAdmin] < 2)
  202. {
  203. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  204. }
  205. else if (sscanf(params, "fffI(0)", fX, fY, fZ, interior))
  206. {
  207. return SendSyntaxMessage(playerid, "/gotocoords (x) (y) (z) [interior]");
  208. }
  209. else
  210. {
  211. SetPlayerPos(playerid, fX, fY, fZ);
  212. SetPlayerInterior(playerid, interior);
  213. SetCameraBehindPlayer(playerid);
  214. SendInfoMessage(playerid, "You have teleported to %.4f, %.4f, %.4f (interior: %i).", fX, fY, fZ, interior);
  215. }
  216. return 1;
  217. }
  218. CMD:vgoto(playerid, params[])
  219. {
  220. new vehicleid;
  221. if (Players[playerid][pAdmin] < 2)
  222. {
  223. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  224. }
  225. else if (sscanf(params, "i", vehicleid))
  226. {
  227. return SendSyntaxMessage(playerid, "/vgoto (vehicle)");
  228. }
  229. else if (!IsValidVehicle(vehicleid))
  230. {
  231. return SendErrorMessage(playerid, "The specified vehicle doesn't exist.");
  232. }
  233. else
  234. {
  235. new
  236. Float:x,
  237. Float:y,
  238. Float:z;
  239. GetVehiclePos(vehicleid, x, y, z);
  240. SetPlayerPos(playerid, x, y, z + 2);
  241. SetPlayerInterior(playerid, 0);
  242. SetPlayerVirtualWorld(playerid, GetVehicleVirtualWorld(vehicleid));
  243. SendInfoMessage(playerid, "You have warped to vehicle %i.", vehicleid);
  244. }
  245. return 1;
  246. }
  247. CMD:vget(playerid, params[])
  248. {
  249. new vehicleid;
  250. if (Players[playerid][pAdmin] < 2)
  251. {
  252. return SendErrorMessage(playerid, "You are not privileged to use this command.");
  253. }
  254. else if (sscanf(params, "i", vehicleid))
  255. {
  256. return SendSyntaxMessage(playerid, "/vget (vehicle)");
  257. }
  258. else if (!IsValidVehicle(vehicleid))
  259. {
  260. return SendErrorMessage(playerid, "The specified vehicle doesn't exist.");
  261. }
  262. else
  263. {
  264. new
  265. Float:x,
  266. Float:y,
  267. Float:z;
  268. GetPlayerPos(playerid, x, y, z);
  269. SetVehiclePos(vehicleid, x, y, z);
  270. SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
  271. LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
  272. SendInfoMessage(playerid, "You have warped vehicle %i to your position.", vehicleid);
  273. }
  274. return 1;
  275. }
  276. CMD:sendto(playerid, params[])
  277. {
  278. new playerb;
  279. if(Players[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  280. if(sscanf(params,"us[32]", playerb, params))
  281. {
  282. SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /sendto [playerid] [place]");
  283. SendClientMessage(playerid, COLOR_GREY, "PLACES: ls | sf | lv");
  284. return 1;
  285. }
  286. if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
  287. if(!strcmp(params, "ls", true))
  288. {
  289. SetPlayerInterior(playerb, 0);
  290. SetPlayerVirtualWorld(playerb, 0);
  291. SetPlayerPos(playerb,1529.6,-1691.2,13.3);
  292. SendClientMessage(playerb, COLOR_WHITE, " You have been teleported to Los Santos.");
  293. }
  294. else if(!strcmp(params, "sf", true))
  295. {
  296. SetPlayerInterior(playerb, 0);
  297. SetPlayerVirtualWorld(playerb, 0);
  298. SetPlayerPos(playerb,-2015.261108, 154.379516, 27.687500);
  299. SendClientMessage(playerb, COLOR_WHITE, " You have been teleported to San Fierro.");
  300. }
  301. else if(!strcmp(params, "lv", true))
  302. {
  303. SetPlayerInterior(playerb, 0);
  304. SetPlayerVirtualWorld(playerb, 0);
  305. SetPlayerPos(playerid,1699.2,1435.1, 10.7);
  306. SendClientMessage(playerb, COLOR_WHITE, " You have been teleported to Las Venturas.");
  307. }
  308. return 1;
  309. }