jamesmith

Edit By James Made with rootcause

Aug 11th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #include <a_samp>
  2. native IsValidVehicle(vehicleid);
  3.  
  4. new
  5. ShipObject[MAX_VEHICLES] = {INVALID_OBJECT_ID, ...};
  6.  
  7. public OnFilterScriptExit()
  8. {
  9. for(new i; i < MAX_VEHICLES; ++i)
  10. {
  11. if(IsValidVehicle(i) && IsValidObject(ShipObject[i]))
  12. {
  13. DestroyVehicle(i);
  14. DestroyObject(ShipObject[i]);
  15. ShipObject[i] = INVALID_OBJECT_ID;
  16. }
  17. }
  18.  
  19. return 1;
  20. }
  21.  
  22. public OnPlayerCommandText(playerid, cmdtext[])
  23. {
  24. if(!strcmp(cmdtext, "/ufo"))
  25. {
  26. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}Only RCON admins can use this command.");
  27. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}You can't use this command if you're in a vehicle.");
  28. if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}You can't use this command if you're in an interior.");
  29. new Float: x, Float: y, Float: z, Float: a;
  30. GetPlayerPos(playerid, x, y, z);
  31. GetPlayerFacingAngle(playerid, a);
  32. new id = CreateVehicle(520, x, y, z, a, 1, 1, -1);
  33. LinkVehicleToInterior(id, 1);
  34. ShipObject[id] = CreateObject(18846, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  35. AttachObjectToVehicle(ShipObject[id], id, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  36. PutPlayerInVehicle(playerid, id, 0);
  37. return 1;
  38. }
  39.  
  40. if(!strcmp(cmdtext, "/removeufo"))
  41. {
  42. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}Only RCON admins can use this command.");
  43. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}You can't use this command if you're not in a vehicle.");
  44. if(!IsValidObject(ShipObject[ GetPlayerVehicleID(playerid) ])) return SendClientMessage(playerid, 0xC0392BFF, "ERROR: {FFFFFF}You're not flying a UFO.");
  45. new id = GetPlayerVehicleID(playerid);
  46. DestroyVehicle(id);
  47. DestroyObject(ShipObject[id]);
  48. ShipObject[id] = INVALID_OBJECT_ID;
  49. return 1;
  50. }
  51.  
  52. return 0;
  53. }
  54.  
  55. public OnVehicleDeath(vehicleid, killerid)
  56. {
  57. if(IsValidObject(ShipObject[vehicleid]))
  58. {
  59. DestroyVehicle(vehicleid);
  60. DestroyObject(ShipObject[vehicleid]);
  61. ShipObject[vehicleid] = INVALID_OBJECT_ID;
  62. }
  63.  
  64. return 1;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment