Badyx

Sistema Camionero

Apr 26th, 2012
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. /* Sistema de Camioneros Creado por Badyx */
  2.  
  3. /* Includes */
  4. #include <a_samp>
  5.  
  6. /* Notas
  7.  
  8. La variable EstaEnCamion la dejo desactivada ya que yo no puedo saber que
  9. que ids tienes en tu gm. Tampoco hago que se creen los camiones por que
  10. correria las ids. Si lo necesitan activenlo. */
  11.  
  12.  
  13. /* Enums */
  14. new Float:gGarbagePoints[4][3] = {
  15. {2003.3517,-1730.5336,13.1080},
  16. {2243.8682,-1895.1603,13.1057},
  17. {2872.5264,-1507.8936,10.5887},
  18. {2083.6062,-1843.3563,13.1080}
  19. };
  20.  
  21. /* News */
  22. new EstaDeRuta[MAX_PLAYERS];
  23. /* Forwards */
  24. //forward EstaEnCamion(carid);
  25. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  26. /* Colores */
  27. #define COLOR_GREY 0xAFAFAFAA
  28.  
  29. #if defined FILTERSCRIPT
  30.  
  31. #else
  32.  
  33. main()
  34. {
  35. print("\n----------------------------------");
  36. print(" Sistema de camioneros by Badyx");
  37. print("----------------------------------\n");
  38. }
  39.  
  40. #endif
  41.  
  42. public OnPlayerConnect(playerid)
  43. {
  44. EstaDeRuta[playerid] = 0;
  45. return 1;
  46. }
  47.  
  48. public OnPlayerDeath(playerid, killerid, reason)
  49. {
  50. EstaDeRuta[playerid] = 0;
  51. return 1;
  52. }
  53.  
  54.  
  55. public OnPlayerCommandText(playerid, cmdtext[])
  56. {
  57. //new newcar = GetPlayerVehicleID(playerid);
  58. if (strcmp("/Ruta", cmdtext, true, 10) == 0)
  59. {
  60. //if(EstaEnCamion(newcar)) return SendClientMessage(playerid, COLOR_GREY, "No estas en un camion.");
  61. if(EstaDeRuta[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "Ya estas en una ruta.");
  62. if(PlayerToPoint(70.0, playerid, 2468.4919,-2092.9902,13.5469))
  63. {
  64. new Rutas;
  65. Rutas = random(sizeof(gGarbagePoints));
  66. SetPlayerCheckpoint(playerid, gGarbagePoints[Rutas][0], gGarbagePoints[Rutas][1], gGarbagePoints[Rutas][2], 5.0);
  67. SendClientMessage(playerid, COLOR_GREY, "Tu destino fue marcado en tu gps.");
  68. EstaDeRuta[playerid] = 1;
  69. return 1;
  70. }
  71. else SendClientMessage(playerid, COLOR_GREY, "No estas en el almacén.");
  72. return 1;
  73. }
  74. return 0;
  75. }
  76.  
  77. public OnPlayerEnterCheckpoint(playerid)
  78. {
  79. if(EstaDeRuta[playerid] == 1)
  80. {
  81. new string[128], Cantidad = random(100);
  82. PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  83. format(string, sizeof(string), "~w~Te pagaron~n~~g~$%d",Cantidad);
  84. GameTextForPlayer(playerid, string, 5000, 1);
  85. GivePlayerMoney(playerid, Cantidad);
  86. }
  87. return 1;
  88. }
  89.  
  90. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  91. {
  92. if(IsPlayerConnected(playerid))
  93. {
  94. new Float:oldposx, Float:oldposy, Float:oldposz;
  95. new Float:tempposx, Float:tempposy, Float:tempposz;
  96. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  97. tempposx = (oldposx -x);
  98. tempposy = (oldposy -y);
  99. tempposz = (oldposz -z);
  100. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  101. {
  102. return 1;
  103. }
  104. }
  105. return 0;
  106. }
  107. /*
  108. public EstaEnCamion(carid)
  109. {
  110. if((carid >= ID-Desde && carid <= ID-Hasta))
  111. {
  112. return 1;
  113. }
  114. return 0;
  115. }*/
Advertisement
Add Comment
Please, Sign In to add comment