Advertisement
Guest User

Untitled

a guest
Dec 8th, 2012
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. #include a_samp
  2. #include zcmd
  3. #include sscanf
  4.  
  5. #define MAX_TRAFI 200
  6.  
  7. //----------------------------------------SZÍNEK----------------------------------------//
  8. #define ZOLD 0x03b01aAA
  9. #define SARGA 0xeefa00AA
  10. #define NARANCSS 0xf0a400AA
  11. #define PIROS 0xe60000AA
  12.  
  13. enum tInfo
  14. {
  15. Van,
  16. Object,
  17. Birsag,
  18. Maxsebesseg,
  19. Gyorshajtasok,
  20. Float: PosX,
  21. Float: PosY,
  22. Float: PosZ,
  23. Float: Fordulas
  24. };
  25.  
  26. new TrafiInfo[MAX_TRAFI][tInfo];
  27.  
  28. forward TrafiEllenor();
  29.  
  30. public OnFilterScriptInit()
  31. {
  32. SetTimer("TrafiEllenor", 2000, true);
  33. return 1;
  34. }
  35.  
  36. CMD:tlerak(playerid, params[])
  37. {
  38. new string[128];
  39. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, PIROS, "Kocsiból nem rakhatod le.");
  40. if(sscanf(params, "dd", TrafiInfo[tInfo][Maxsebesseg], TrafiInfo[tInfo][Birsag])) return SendClientMessage(playerid, PIROS, "Használat: /tlerak [max sebesség] [bírság]");
  41. for(new trafi; trafi < MAX_TRAFI; trafi++)
  42. {
  43. if(TrafiInfo[trafi][Van] == 0)
  44. {
  45. GetPlayerPos(playerid, TrafiInfo[tInfo][PosX], TrafiInfo[tInfo][PosY], TrafiInfo[tInfo][PosZ]);
  46. GetPlayerFacingAngle(playerid, TrafiInfo[tInfo][Fordulas]);
  47. TrafiInfo[tInfo][Object] = CreateObject(2600, TrafiInfo[tInfo][PosX], TrafiInfo[tInfo][PosY], TrafiInfo[tInfo][PosZ]-1, 0.0, 0.0, TrafiInfo[trafi][Fordulas]);
  48. TrafiInfo[tInfo][Van] = 1;
  49. TrafiInfo[tInfo][Gyorshajtasok] = 0;
  50. format(string, sizeof(string), "Max sebesség: %d | Bírság: %d", TrafiInfo[tInfo][Maxsebesseg], TrafiInfo[tInfo][Birsag]);
  51. SendClientMessage(playerid, SARGA, "Leraktál egy trafipaxot.");
  52. SendClientMessage(playerid, ZOLD, string);
  53. break;
  54. }
  55. }
  56. return 1;
  57. }
  58.  
  59. CMD:tfelszed(playerid)
  60. {
  61. new string[128], Float:x, Float:y, Float:z;
  62. for(new trafi; trafi < MAX_TRAFI; trafi++)
  63. {
  64. if(TrafiInfo[trafi][Van] == 1)
  65. {
  66. GetObjectPos(TrafiInfo[tInfo][Object], x, y, z);
  67. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  68. {
  69. DestroyObject(TrafiInfo[trafi][Object]);
  70. format(string, sizeof(string), "ID: %d | Gyorshajtások: %d | Bírságok összege: $%d", trafi, TrafiInfo[trafi][Gyorshajtasok], TrafiInfo[trafi][Gyorshajtasok]*TrafiInfo[trafi][Birsag]);
  71. TrafiInfo[trafi][Van] = 0;
  72. TrafiInfo[trafi][PosX] = 0;
  73. TrafiInfo[trafi][PosY] = 0;
  74. TrafiInfo[trafi][PosZ] = 0;
  75. TrafiInfo[trafi][Fordulas] = 0;
  76. SendClientMessage(playerid, SARGA, "Felszedtél egy trafipaxot.");
  77. SendClientMessage(playerid, ZOLD, string);
  78. break;
  79. }
  80. }
  81. }
  82. return 1;
  83. }
  84.  
  85. CMD:tfelszedall(playerid)
  86. {
  87. for(new trafi; trafi < MAX_TRAFI; trafi++)
  88. {
  89. DestroyObject(TrafiInfo[tInfo][Object]);
  90. TrafiInfo[tInfo][Van] = 0;
  91. TrafiInfo[tInfo][PosX] = 0;
  92. TrafiInfo[tInfo][PosY] = 0;
  93. TrafiInfo[tInfo][PosZ] = 0;
  94. TrafiInfo[tInfo][Fordulas] = 0;
  95. }
  96. SendClientMessage(playerid, SARGA, "Felszedted az összes trafipaxot.");
  97. return 1;
  98. }
  99.  
  100. stock GetVehicleSpeed(vehicleid)
  101. {
  102. new Float:vSpeed[3];
  103. GetVehicleVelocity( vehicleid, vSpeed[0], vSpeed[1], vSpeed[2] );
  104.  
  105. new Float:vSpeed_Float;
  106. vSpeed_Float = floatsqroot( ((vSpeed[0] * vSpeed[0]) + (vSpeed[1] * vSpeed[1])) + (vSpeed[2] * vSpeed[2])) * 180.0;
  107.  
  108. new vSpeed_Int;
  109. vSpeed_Int = floatround( vSpeed_Float, floatround_round );
  110.  
  111. return vSpeed_Int;
  112. }
  113.  
  114. public TrafiEllenor()
  115. {
  116. new nev[MAX_PLAYER_NAME];
  117. new Float:x, Float:y, Float:z, string[128];
  118. for(new playerid; playerid < MAX_TRAFI; playerid++)
  119. {
  120. if(IsPlayerConnected(playerid))
  121. {
  122. GetPlayerName(playerid, nev, sizeof(nev));
  123. for(new trafi; trafi < MAX_TRAFI; trafi++)
  124. {
  125. if(TrafiInfo[tInfo][Van] == 1)
  126. {
  127. GetObjectPos(TrafiInfo[tInfo][Object], x, y, z);
  128. if(IsPlayerInRangeOfPoint(playerid, 30.0, x, y, z) && IsPlayerInAnyVehicle(playerid))
  129. {
  130. new vehicleid = GetPlayerVehicleID(playerid);
  131. if(GetVehicleSpeed(vehicleid) > TrafiInfo[tInfo][Maxsebesseg])
  132. {
  133. TrafiInfo[tInfo][Gyorshajtasok]++;
  134. GivePlayerMoney(playerid, -TrafiInfo[tInfo][Birsag]);
  135. format(string, sizeof(string), "%st lekapta a trafipax! Max sebesség: %d | Sebessége: %d | Bírság: $%d", nev, TrafiInfo[trafi][Maxsebesseg], GetVehicleSpeed(vehicleid), TrafiInfo[trafi][Birsag]);
  136. SendClientMessageToAll(SARGA, string);
  137. break;
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. return 1;
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement