Guest User

/siren command

a guest
Dec 29th, 2011
3,761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. new Siren[MAX_VEHICLES];
  2. new SirenObject[MAX_VEHICLES];
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. CMD:siren(playerid, params[])
  10. {
  11. if(IsACop(playerid))
  12. {
  13. new string[128], type;
  14. new VID = GetPlayerVehicleID(playerid);
  15. if(sscanf(params, "d", type))
  16. {
  17. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
  18. SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
  19. return 1;
  20. }
  21. switch(type)
  22. {
  23. case 1:
  24. {
  25. if(Siren[VID] == 1)
  26. {
  27. SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
  28. return 1;
  29. }
  30. new sendername[MAX_PLAYER_NAME];
  31. Siren[VID] = 1;
  32. GetPlayerName(playerid, sendername, sizeof(sendername));
  33. SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
  34. AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
  35. format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
  36. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  37. return 1;
  38. }
  39. case 2:
  40. {
  41. if(Siren[VID] == 1)
  42. {
  43. SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
  44. return 1;
  45. }
  46. Siren[VID] = 1;
  47. new sendername[MAX_PLAYER_NAME];
  48. GetPlayerName(playerid, sendername, sizeof(sendername));
  49. SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
  50. AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
  51. format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
  52. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  53. return 1;
  54. }
  55. case 3:
  56. {
  57. if(Siren[VID] == 0)
  58. {
  59. SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
  60. return 1;
  61. }
  62. Siren[VID] = 0;
  63. new sendername[MAX_PLAYER_NAME];
  64. GetPlayerName(playerid, sendername, sizeof(sendername));
  65. DestroyObject(SirenObject[VID]);
  66. format(string, sizeof(string), "* %s takes down the siren.", sendername);
  67. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  68. return 1;
  69. }
  70. default:
  71. {
  72. SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
  73. SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
  74. }
  75. }
  76. }
  77. else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
  78. return 1;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment