Advertisement
Riotken

s

Sep 3rd, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.02 KB | None | 0 0
  1. //////////////////////////////////
  2. // jServers - Sumo Test Include ////////////
  3. // Allows test of basic map functionality //
  4. // v1.2 - RDL ///////
  5. // For the love of fuck, do not edit this file //
  6. /////////////////////////////////////////////////
  7. #include <a_samp>
  8. #pragma tabsize 0
  9. #define SKIN_ID 101
  10.  
  11. // WEATHERS
  12. #define SUNNY 18
  13. #define RAINY 8
  14. #define STORMY 8
  15. #define FOGGY 9
  16. #define SANDSTORM 19
  17. #define CLOUDY 15
  18.  
  19. // Gamemode - there used to be others, but currently only 1
  20. #define NORMAL 1
  21.  
  22. // variables
  23. new PlayerCount = 0;
  24. new UserVehicle;
  25. new ScriptInfo[];
  26. new AccountInfo[50][50];
  27. new Text3D:CSV[100];
  28.  
  29. // colors, we only need two.
  30. #define COLOR_AQUA 0x0AB084FF
  31. #define COLOR_GREY 0xAFAFAFAA
  32.  
  33. // define all the variables. Defaults entered are real world defaults for Sumo as of 3.7.0
  34. // These get changed by whats in your map, although not many of them are used in this test anyway.
  35. new Float:Z_FALLOFF = 0.0;
  36. new GAME_MODE_TYPE = 1;
  37. new WIN_TIME = 400;
  38. new MapTime = 12;
  39. new Weather = 2;
  40. new RED_IDENTIFY_TYPE = 1;
  41. new RESPAWN_DELAY = 15;
  42. new MAP_TIMEOUT = 2250;
  43. new GIVE_NITRO = 0;
  44. new RANDOM_MODDED_VEHICLES = 1;
  45. new MOD_ALL_VEHICLES = 0;
  46. new ELIMINATE_FLIP = 0;
  47. new FLIP_FLIPPED = 0;
  48. new ENABLE_NOT_MOVE_LOSE = 0;
  49. new NOT_MOVE_WARNINGS = 3;
  50. new ENABLE_REPAIR = 0;
  51. new REPAIR_INTERVAL = 60;
  52. new REPAIR_AMOUNT = 160;
  53. new REPAIR_X = 125;
  54. new MAX_ALLOWED_HEALTH = 2500;
  55. new ENABLE_FIRE_TRUCK_RESCUE = 1;
  56. new LIMIT_TOTAL_DUMPERS = 1;
  57. new ALLOW_RAMP_SPAWNING = 0;
  58. new LIMIT_TOTAL_HARVESTERS = 2;
  59. new LIMIT_TOTAL_DOZERS = 1;
  60. new LIMIT_TOTAL_BIKES = 3;
  61. new Float:MAX_Z = -0.1;
  62. new MAP_INCLUDES_WEAPONS = 0;
  63. new MAP_USES_SPEED_ALTERATION = 0;
  64. new AC_DISABLE_HEALTH_DETECTION = 0;
  65. new MAX_SPEED_ALLOWED = 125;
  66. new DISABLE_Z_DETECTION = 0;
  67. new ALLOW_EARLY_FINISH = 1;
  68. new DISABLE_BC5_CHECK = 1;
  69. new DISABLE_ACHIEVEMENTS = 0;
  70. new FORCE_DUEL_CAR = 0;
  71. new FIRE_TRUCK_RESCUE_AMT = 500;
  72. new SUDDEN_DEATH = 0;
  73. new LIMIT_TOTAL_SWAT = 1;
  74. new FORCE_RED_INVOLVEMENT = 0;
  75. new Float:FRI_DISTANCE = 50.0;
  76. // We don't use most of the above. So just tell the PAWN compiler this, else it'll shit out lots of warnings.
  77. #pragma unused LIMIT_TOTAL_BIKES, LIMIT_TOTAL_HARVESTERS
  78. #pragma unused LIMIT_TOTAL_DOZERS, LIMIT_TOTAL_DUMPERS, ENABLE_FIRE_TRUCK_RESCUE, REPAIR_AMOUNT, REPAIR_INTERVAL, ENABLE_REPAIR, NOT_MOVE_WARNINGS, ENABLE_NOT_MOVE_LOSE
  79. #pragma unused FLIP_FLIPPED, ELIMINATE_FLIP, MOD_ALL_VEHICLES, RANDOM_MODDED_VEHICLES, GIVE_NITRO, MAP_TIMEOUT, RESPAWN_DELAY
  80. #pragma unused RED_IDENTIFY_TYPE, WIN_TIME, GAME_MODE_TYPE, MAX_ALLOWED_HEALTH, ScriptInfo, PlayerCount
  81. #pragma unused DISABLE_BC5_CHECK, ALLOW_EARLY_FINISH, MAX_SPEED_ALLOWED, AC_DISABLE_HEALTH_DETECTION, LIMIT_TOTAL_SWAT
  82. #pragma unused MAP_INCLUDES_WEAPONS, MAP_USES_SPEED_ALTERATION, DISABLE_Z_DETECTION
  83. #pragma unused MAX_Z, FORCE_DUEL_CAR, DISABLE_ACHIEVEMENTS, FIRE_TRUCK_RESCUE_AMT, SUDDEN_DEATH
  84.  
  85. // Define some dud functions, just for compilation sake.
  86. stock IsVehicleValidForSettings(var){
  87. #pragma unused var
  88. return 1;
  89. }
  90.  
  91. stock FinalizeLoading(){
  92. SetWorldTime(MapTime); // We'll atleast set your map time
  93. SetWeather(Weather); // Also your weather. Ain't that nice of us?
  94. return 1;
  95. }
  96.  
  97. stock SpawnedFunction(playerid){
  98. TogglePlayerControllable(playerid,1);
  99. return 1;
  100. }
  101.  
  102. public OnPlayerConnect(playerid){
  103. #if defined OnPlayerConEx
  104. OnPlayerConEx(playerid); // Call the maps version of this too, incase you want to test something you put there.
  105. #endif
  106. TogglePlayerControllable(playerid,1);
  107. return 1;
  108. }
  109.  
  110. public OnPlayerUpdate(playerid){
  111. #if defined OnPlayerUpdateEx
  112. OnPlayerUpdateEx(playerid);
  113. #endif
  114. return 1;
  115. }
  116.  
  117. public OnPlayerDeath(playerid,killerid,reason){
  118. #if defined OnPlayerDeathEx
  119. OnPlayerDeathEx(playerid,killerid,reason); // Call the maps version of this too, incase you want to test something you put there.
  120. #endif
  121. return 1;
  122. }
  123.  
  124. public OnPlayerDisconnect(playerid,reason)
  125. {
  126. #if defined OnPlayerDisconnectEx
  127. OnPlayerDisconnectEx(playerid,reason); // Call the maps version of this too, incase you want to test something you put there.
  128. #endif
  129. return 1;
  130. }
  131. main(){}
  132.  
  133. // And now lets do some real functions. For the sake of testing the map.
  134. public OnPlayerCommandText(playerid, cmdtext[]){
  135. if(strcmp(cmdtext,"/help",true) ==0)
  136. {
  137. SendClientMessage(playerid,COLOR_GREY,"Hi. Thanks for making a map! This is the test script for your map. There are some commands, listed below.");
  138. SendClientMessage(playerid,COLOR_GREY,"To spawn all possible spawnplaces, to check for bad spawns - type /spawnall");
  139. SendClientMessage(playerid,COLOR_GREY,"To spawn using only small vehicles (A Landstalker is used for this) - type /spawnsmall");
  140. SendClientMessage(playerid,COLOR_GREY,"To spawn using only big vehicles (A Bus is used for this) - type /spawnbig.");
  141. SendClientMessage(playerid,COLOR_GREY,"To spawn using only huge vehicles (Dumpers & Harvesters are used for this) - type /spawnhuge.");
  142. SendClientMessage(playerid,COLOR_GREY,"To delete all vehicles (including any you're in) use /destroyall");
  143. SendClientMessage(playerid,COLOR_GREY,"To test if you're above or below the Z_LIMIT, type /zcheck");
  144. SendClientMessage(playerid,COLOR_GREY,"If you need to kill yourself. Type /kill");
  145. return 1;
  146. }
  147. if(strcmp(cmdtext,"/zcheck",true) == 0)
  148. {
  149. new Float:x, Float:y, Float:z;
  150. GetPlayerPos(playerid,x,y,z);
  151. if(MAX_Z != -0.1){
  152. if(z > MAX_Z) SendClientMessage(playerid,COLOR_GREY,"You're ABOVE the MAX_Z limit. You WOULD be eliminated here.");
  153. else if(z < MAX_Z) SendClientMessage(playerid,COLOR_GREY,"You're BELOW the MAX_Z limit. You would NOT be eliminated here.");
  154. else if(z == MAX_Z) SendClientMessage(playerid,COLOR_GREY,"You're exactly at the MAX_Z limit. You WOULD be eliminated here.");
  155. }
  156.  
  157. if(z > Z_FALLOFF) return SendClientMessage(playerid,COLOR_GREY,"You're ABOVE the z limit. You would NOT be eliminated here.");
  158. else if(z < Z_FALLOFF){ SendClientMessage(playerid,COLOR_GREY,"You're BELOW the z limit. You WOULD be eliminated here."); OnPlayerElimination(playerid,1,-1); return 1;}
  159. else if(z == Z_FALLOFF) return SendClientMessage(playerid,COLOR_GREY,"You're exactly at the z limit. You NOT be eliminated here.");
  160. SetPlayerHealth(playerid,0.0);
  161. return 1;
  162. }
  163. if(strcmp(cmdtext,"/spawnall",true) == 0)
  164. {
  165. SendClientMessage(playerid,COLOR_GREY,"Spawned all vehicles using random vehicles from your specified loadout.");
  166. SpawnAllVehicles(0);
  167. return 1;
  168. }
  169. if(strcmp(cmdtext,"/spawnbig",true) == 0)
  170. {
  171. SendClientMessage(playerid,COLOR_GREY,"Spawned all vehicles using a large vehicle.");
  172. SpawnAllVehicles(1);
  173. return 1;
  174. }
  175. if(strcmp(cmdtext,"/spawnsmall",true) == 0)
  176. {
  177. SendClientMessage(playerid,COLOR_GREY,"Spawned all vehicles using a small vehicle.");
  178. SpawnAllVehicles(2);
  179. return 1;
  180. }
  181. if(strcmp(cmdtext,"/spawnhuge",true) == 0)
  182. {
  183. SendClientMessage(playerid,COLOR_GREY,"Spawned all vehicles using a huge vehicle.");
  184. SpawnAllVehicles(3);
  185. return 1;
  186. }
  187. if(strcmp(cmdtext,"/destroyall",true) == 0)
  188. {
  189. SendClientMessage(playerid,COLOR_GREY,"Destroyed all vehicles.");
  190. SpawnAllVehicles(4);
  191. return 1;
  192. }
  193. if(strcmp(cmdtext,"/kill",true) == 0)
  194. {
  195. SetPlayerHealth(playerid,0.0);
  196. return 1;
  197. }
  198. return 0;
  199. }
  200.  
  201. stock SpawnAllVehicles(type){
  202. // type: 0 = normal, 1 = big only, 2 = small only, 3 = huge only, 4 = delete all
  203. for(new i = 0; i < 500; i++)
  204. {
  205. if(type != 4){ UserVehicleCreate(i,type); }
  206. else{
  207. Delete3DTextLabel(CSV[i]);
  208. DestroyVehicle(i);
  209. }
  210. }
  211. return 1;
  212. }
  213.  
  214. stock CreateSumoVehicle(playerid,model,Float:X,Float:Y,Float:Z,Float:A,void1=-1,void2=-1,void3=-1){
  215. #pragma unused void3
  216. CreateVehicle(model,Float:X,Float:Y,Float:Z,Float:A,void1,void2,5);
  217.  
  218. new string[50];
  219. format(string,sizeof(string),"PlayerID %d spawns here!",playerid);
  220. CSV[playerid] = Create3DTextLabel(string, 0xFFFFFFFF,X,Y,Z,180.0, 0, 0);
  221. return 1;
  222. }
  223.  
  224. enum DynSpawns // store dynamic things
  225. {
  226. Float:vX,
  227. Float:vY,
  228. Float:vZ,
  229. Float:vA
  230. };
  231. new DynamicSpawns[100][DynSpawns], totalDynSpawns;
  232.  
  233. AddDynamicSpawn(Float:X,Float:Y,Float:Z,Float:A)
  234. {
  235. DynamicSpawns[totalDynSpawns][vX] = X;
  236. DynamicSpawns[totalDynSpawns][vY] = Y;
  237. DynamicSpawns[totalDynSpawns][vZ] = Z;
  238. DynamicSpawns[totalDynSpawns][vA] = A;
  239. totalDynSpawns++;
  240. }
  241. stock UserVehicleCreate(playerid,type){
  242. new veid; // Get random vehicle from the allowed array you specified in loadout.
  243. if(type == 1) veid = 431; // Bus
  244. else if(type == 2) veid = 400; // Landstalker
  245. for(new i = 0; i < sizeof(totalDynSpawns); i++)
  246. {
  247. if(type == 3) { new r = random(2); if(r == 0) veid = 406; else veid = 532; } // Dumper / Harvester
  248. DynamicallySpawnPlayer(playerid,veid);
  249. }
  250. return 1;
  251. }
  252. stock DynamicallySpawnPlayer(playerid,model)
  253. {
  254. new thisid;
  255. thisid = CreateVehicle(model,DynamicSpawns[playerid][vX],DynamicSpawns[playerid][vY],DynamicSpawns[playerid][vZ],DynamicSpawns[playerid][vA],-1,-1,5);
  256. PutPlayerInVehicle(playerid,thisid,0);
  257. return thisid;
  258. }
  259.  
  260. stock GetRandomSkin(playerid)
  261. {
  262. #pragma unused playerid
  263. // nothing, placeholder
  264. }
  265.  
  266. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  267. {
  268. new Float:pX,Float:pY,Float:pZ,Float:pA; // Real sumo core deletes ramps after 3 to 5 seconds.
  269. if(ALLOW_RAMP_SPAWNING == 1 && IsPlayerInAnyVehicle(playerid)){
  270. if ((newkeys & KEY_LOOK_BEHIND ) && !(oldkeys & KEY_LOOK_BEHIND )) // MMB / 2
  271. {
  272. GetPlayerPos(playerid,pX,pY,pZ);
  273. GetPlayerFacingAngle(playerid,pA);
  274. GetXYInFrontOfPlayer(playerid,pX,pY,12.5);
  275. CreateObject(1245,pX,pY,pZ,pA,0.0,0.0,500);
  276. }
  277. }
  278. return 1;
  279. }
  280.  
  281. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  282. {
  283.  
  284. new Float:a;
  285.  
  286. GetPlayerPos(playerid, x, y, a);
  287. GetPlayerFacingAngle(playerid, a);
  288.  
  289. if (GetPlayerVehicleID(playerid)) {
  290. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  291. }
  292.  
  293. x += (distance * floatsin(-a, degrees));
  294. y += (distance * floatcos(-a, degrees));
  295. }
  296. // End of file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement