Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.07 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #include <a_mysql>
  4. #include <MapAndreas>
  5.  
  6. main() return 1;
  7. native gpci(playerid, serial[], len);
  8. #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  9.  
  10. enum weathers {
  11. EXTRASUNNY_LA = (0),
  12. SUNNY_LA,
  13. EXTRASUNNY_SMOG_LA,
  14. SUNNY_SMOG_LA,
  15. CLOUDY_LA,
  16. SUNNY_SF,
  17. EXTRASUNNY_SF,
  18. CLOUDY_SF,
  19. RAINY_SF,
  20. FOGGY_SF,
  21. SUNNY_VEGAS,
  22. EXTRASUNNY_VEGAS,
  23. CLOUDY_VEGAS,
  24. EXTRASUNNY_COUNTRYSIDE,
  25. SUNNY_COUNTRYSIDE,
  26. CLOUDY_COUNTRYSIDE,
  27. RAINY_COUNTRYSIDE,
  28. EXTRASUNNY_DESERT,
  29. SUNNY_DESERT,
  30. SANDSTORM_DESERT,
  31. UNDERWATER,
  32. }
  33.  
  34. enum dialogs {
  35. DIALOG_UNKNOWN = 1,
  36. DIALOG_LOGIN,
  37. DIALOG_REGISTER
  38. }
  39.  
  40. enum colors {
  41. COLOR_NOTICE = (0xE8DFB7FF),
  42. COLOR_MISSION = (0xCDDB86FF)
  43. }
  44.  
  45. enum modes {
  46. GAMEMODE_RACE,
  47. }
  48.  
  49. enum variables {
  50. GMmode,
  51. GMmodeEx,
  52. GMmodeRace,
  53. GMvehicle
  54. }
  55.  
  56. enum grCP {
  57. Float:cpX,
  58. Float:cpY,
  59. Float:cpZ,
  60. }
  61. new GameRaceCP[31][grCP];
  62.  
  63. new GameMode[variables];
  64.  
  65. #define MAX_RACES (1)
  66. #define MAX_CHAT_LINES (20)
  67. #define SERVER_VAR_HASH "-104*"
  68.  
  69. new MySQL:database;
  70.  
  71. public OnGameModeInit() {
  72. printf(" Game > Booting the server up..");
  73.  
  74. database = mysql_connect("localhost", "user", "test", "aioLG"),
  75. printf(" Game > Accessing the database securely.");
  76. if(mysql_errno(database)) {
  77. printf(" Game > Failed to access the database, shutting down the server."),
  78. SendRconCommand("exit");
  79. return 1;
  80. }
  81.  
  82. SetWeather(SANDSTORM_DESERT),
  83. printf(" Game > Setting the weather to %i", SANDSTORM_DESERT);
  84.  
  85. SetWorldTime(21),
  86. printf(" Game > Setting the world time to %i:00", 21);
  87.  
  88. DisableInteriorEnterExits(),
  89. printf(" Game > Disabling default interiors");
  90.  
  91. ManualVehicleEngineAndLights(),
  92. printf(" Game > Disabling default vehicle handlings");
  93.  
  94. MapAndreas_Init(MAP_ANDREAS_MODE_NONE),
  95. printf(" Game > Enabling Map Andreas under /SMALL/ mode");
  96.  
  97. CallRemoteFunction("OnGameModeChange", "i", GAMEMODE_RACE);
  98. return 1;
  99. }
  100.  
  101. public OnIncomingConnection(playerid, ip_address[], port) {
  102. printf(" Player > Receiving connection from (%s:%i)", ip_address, port);
  103. return 1;
  104. }
  105.  
  106. public OnPlayerConnect(playerid) {
  107. new name[MAX_PLAYER_NAME], ip_port[22];
  108. GetPlayerName(playerid, name, MAX_PLAYER_NAME),
  109. NetStats_GetIpPort(playerid, ip_port, 22),
  110. printf(" Player > Estabilished connection with %s (%s)", name, ip_port);
  111.  
  112. for(new id = 0; id <= MAX_CHAT_LINES; id++)
  113. SendClientMessage(playerid, 0xFFFFFF00, " ");
  114. printf(" Player > Clearing chat for %s(%i)", name, playerid),
  115. SendClientMessage(playerid, COLOR_NOTICE, " > The server is now trying to estabilish a connection, please wait.");
  116.  
  117. TogglePlayerSpectating(playerid, true),
  118. printf(" Player > Setting player's login camera for %s(%i)", name, playerid);
  119. SetTimerEx("OnPlayerEstabilishConnection", 1, false, "i", playerid);
  120. return 1;
  121. }
  122.  
  123. forward public OnPlayerEstabilishConnection(playerid);
  124. public OnPlayerEstabilishConnection(playerid) {
  125. new name[MAX_PLAYER_NAME], ip_port[22];
  126. GetPlayerName(playerid, name, MAX_PLAYER_NAME),
  127. NetStats_GetIpPort(playerid, ip_port, 22),
  128. printf(" Player > Server is now communicating with %s ((%i)%s)", name, playerid, ip_port);
  129.  
  130. InterpolateCameraPos(playerid, -2637.9307, -2827.2493, 18.8876, -2637.9307, -2827.2493, 18.8876, 2000, CAMERA_CUT);
  131. InterpolateCameraLookAt(playerid, -2638.8201, -2827.7161, 18.8723, -2638.8201, -2827.7161, 18.8723, 2000, CAMERA_CUT);
  132.  
  133. for(new id = 0; id <= MAX_CHAT_LINES; id++)
  134. SendClientMessage(playerid, 0xFFFFFF00, " ");
  135. printf(" Player > Clearing chat for %s(%i)", name, playerid),
  136. SendClientMessage(playerid, COLOR_NOTICE, " > The server has now estabilished a connection with you."),
  137. SendClientMessage(playerid, COLOR_NOTICE, " > Please wait for the server to check for banned IP's..");
  138.  
  139. new query[524], gpciAD[41], ip[32];
  140. gpci(playerid, gpciAD, 41);
  141. GetPlayerIp(playerid, ip, 32);
  142. mysql_format(database, query, 524, "SELECT * FROM bans WHERE type = 1 AND gpci = '%e' OR type = 2 AND ip = '%e' OR type = 3 AND username = '%e'", gpciAD, ip, name);
  143. mysql_tquery(database, query, "OnPlayerRequestBanRecords", "isss", playerid, gpciAD, ip, name);
  144. }
  145.  
  146. forward public OnPlayerRequestBanRecords(playerid, GPCI[], ip[], name[]);
  147. public OnPlayerRequestBanRecords(playerid, GPCI[], ip[], name[]) {
  148. if(cache_num_rows()) {
  149. new type;
  150. cache_get_value_name_int(0, "type", type);
  151. switch(type) {
  152. case 1: { // SAMP GPCI (not unique, rare ban)
  153. printf(" Player > GPCI banned computer (%s) is being kicked.", GPCI);
  154.  
  155. new dialog[1024];
  156. format(dialog, 1024, "{6B9C6F}Error! {C4C4C4}Banned GPCI address.\n \n\
  157. {D6D6D6}Your computer's GPCI address %s:(%s) is registered being banned.\n\
  158. {D6D6D6}This type of ban is extremely rare, and if you should /NOT/ be banned, please contact a staff member.\n \n\
  159. {E8DFB7} > In order to contact a staff member, visit:\n\
  160. {F1F1F1}http://lexus-gaming.pro", ip, GPCI);
  161. ShowPlayerDialog(playerid, DIALOG_UNKNOWN, DIALOG_STYLE_MSGBOX, "{D1E0D2}Something went wrong..", dialog, "Close", "");
  162. KickPlayer(playerid);
  163. }
  164. case 2: { // IP-Address perm. ban
  165. printf(" Player > IP banned user %s(%s) is being kicked.", name, ip);
  166.  
  167. new dialog[1024];
  168. format(dialog, 1024, "{6B9C6F}Error! {C4C4C4}Banned IP-address.\n \n\
  169. {D6D6D6}Your router's IP address (%s) is registered being banned.\n\
  170. {D6D6D6}This type of ban is permanently and can be appealed.\n \n\
  171. {E8DFB7} > In order to appeal this ban, visit:\n\
  172. {F1F1F1}http://lexus-gaming.pro", ip);
  173. ShowPlayerDialog(playerid, DIALOG_UNKNOWN, DIALOG_STYLE_MSGBOX, "{D1E0D2}Something went wrong..", dialog, "Close", "");
  174. KickPlayer(playerid);
  175. }
  176. case 3: { // Masteraccount ban
  177. printf(" Player > Masteraccount banned user %s(%i) is being kicked.", name, playerid);
  178.  
  179. new dialog[1024];
  180. format(dialog, 1024, "{6B9C6F}Error! {C4C4C4}Banned account.\n \n\
  181. {D6D6D6}This account (%s) has been registered being banned.\n\
  182. {D6D6D6}This type of ban is only appealable at our website, by filling a form.\n \n\
  183. {E8DFB7} > In order to appeal this ban, visit:\n\
  184. {F1F1F1}http://lexus-gaming.pro", name);
  185. ShowPlayerDialog(playerid, DIALOG_UNKNOWN, DIALOG_STYLE_MSGBOX, "{D1E0D2}Something went wrong..", dialog, "Close", "");
  186. KickPlayer(playerid);
  187. }
  188. }
  189. }
  190. else {
  191. printf(" Player > Player %s(%i) is not banned and is being looked up for a registration.");
  192.  
  193. SendClientMessage(playerid, COLOR_NOTICE, " > The server has run through the active bans and have /NOT/ found you on the list.");
  194. SendClientMessage(playerid, COLOR_NOTICE, " > Please hold on for the server to check if you're a registered player or not..");
  195.  
  196. new query[524];
  197. mysql_format(database, query, 524, "SELECT * FROM accounts WHERE username = '%e'", name);
  198. mysql_tquery(database, query, "OnPlayerRequestAccountRecords", "i", playerid);
  199. }
  200. }
  201.  
  202. forward public OnPlayerRequestAccountRecords(playerid);
  203. public OnPlayerRequestAccountRecords(playerid) {
  204. new name[MAX_PLAYER_NAME];
  205. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  206. if(cache_num_rows()) {
  207. printf(" Player > Player %s(%i) is registered in the database, requesting the client to log in.", name, playerid);
  208.  
  209. SendClientMessage(playerid, COLOR_NOTICE, " > This account has been registered at us, please enter the password to log in.");
  210.  
  211. for(new id = 0; id < cache_num_fields(); id++) {
  212. switch(cache_get_field_type(id)) {
  213. case MYSQL_TYPE_VARCHAR: {
  214. new string[256], fieldname[256];
  215. cache_get_field_name(id, fieldname, 256);
  216. cache_get_value_index(0, id, string, 256);
  217. SetPVarString(playerid, fieldname, string);
  218. printf("DEBUGGGGG: Field %s is: (%s), VARCHAR", fieldname, string);
  219. }
  220. case MYSQL_TYPE_INT24: {
  221. new int, fieldname[256];
  222. cache_get_field_name(id, fieldname, 256);
  223. cache_get_value_index_int(0, id, int);
  224. SetPVarInt(playerid, fieldname, int);
  225. printf("DEBUGGGGG: Field %s is: (%i), INTENGER24", fieldname, int);
  226. }
  227. }
  228. }
  229.  
  230. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{D1E0D2}Account login pop-up", "{6B9C6F}This account is registered in our database.\n \n\
  231. {D6D6D6}If you're the owner of this account, please enter its password.\n\
  232. {D6D6D6}If you are /NOT/ the owner of the account, please register another name.\n", "Submit", "Cancel");
  233. }
  234. else {
  235. printf(" Player > Player %s(%i) is not registered, requesting a password for registration.", name, playerid);
  236. SendClientMessage(playerid, COLOR_NOTICE, " > This account is not registered at us, please enter a password to register.");
  237. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{D1E0D2}Account registration pop-up", "{6B9C6F}This account is /NOT/ registered in our database.\n \n\
  238. {D6D6D6}If you're new to the server, please enter a password to register yourself.\n\
  239. {D6D6D6}But if you already have got an account registered, please use that one.\n", "Submit", "Cancel");
  240. }
  241. }
  242.  
  243. KickPlayer(playerid) return SetTimerEx("OnServerKickPlayer", GetPlayerPing(playerid), false, "i", playerid);
  244. forward public OnServerKickPlayer(playerid);
  245. public OnServerKickPlayer(playerid) Kick(playerid);
  246.  
  247. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  248. switch(dialogid) {
  249. case DIALOG_LOGIN: {
  250. if(response) {
  251. if(!isnull(inputtext)) {
  252. new password[256], input[256];
  253. GetPVarString(playerid, "password", password, 256);
  254. SHA256_PassHash(inputtext, SERVER_VAR_HASH, input, 256);
  255. if(!strcmp(inputtext, input)) {
  256. new name[MAX_PLAYER_NAME];
  257. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  258. SetPlayerColor(playerid, 0xF1F1F1FF),
  259. printf(" Player > %s(%i) has logged in, registered.", name, playerid);
  260. new query[524], gpciAD[22], ip[32];
  261. GetPlayerIp(playerid, ip, 32);
  262. gpci(playerid, gpciAD, 22);
  263. mysql_format(database, query, 524, "INSERT INTO connections SET username = '%e', ip = '%e', gpci = '%e', timestamp = %i", name, ip, gpciAD, gettime());
  264. mysql_tquery(database, query, "OnPlayerLogin", "i", playerid);
  265. }
  266. else
  267. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{D1E0D2}Account login pop-up", "{6B9C6F}This account is registered in our database.\n \n\
  268. {D6D6D6}If you're the owner of this account, please enter its password.\n\
  269. {D6D6D6}If you are /NOT/ the owner of the account, please register another name.\n \n\
  270. {BA686E}Error! {F1F1F1}The password don't match up.", "Submit", "Cancel");
  271. }
  272. else
  273. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{D1E0D2}Account login pop-up", "{6B9C6F}This account is registered in our database.\n \n\
  274. {D6D6D6}If you're the owner of this account, please enter its password.\n\
  275. {D6D6D6}If you are /NOT/ the owner of the account, please register another name.\n \n\
  276. {BA686E}Error! {F1F1F1}You must insert a valid password.", "Submit", "Cancel");
  277. }
  278. else {
  279. SendClientMessage(playerid, COLOR_NOTICE, " < You decided to quit the login panel and was kicked.");
  280. KickPlayer(playerid);
  281. }
  282. return 1;
  283. }
  284.  
  285. case DIALOG_REGISTER: {
  286. if(response) {
  287. if(!isnull(inputtext)) {
  288. new input[256];
  289. SHA256_PassHash(inputtext, SERVER_VAR_HASH, input, 256);
  290. SendClientMessage(playerid, COLOR_NOTICE, " > You have now registered your account, processing the information..");
  291. new query[524], name[MAX_PLAYER_NAME];
  292. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  293. mysql_format(database, query, 524, "INSERT INTO accounts SET username = '%e', password = '%e'", name, input);
  294. mysql_tquery(database, query, "OnPlayerRegister", "i", playerid),
  295. printf(" Player > Registering user (%s) - %i", name, playerid);
  296. }
  297. else
  298. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{D1E0D2}Account registration pop-up", "{6B9C6F}This account is /NOT/ registered in our database.\n \n\
  299. {D6D6D6}If you're new to the server, please enter a password to register yourself.\n\
  300. {D6D6D6}But if you already have got an account registered, please use that one.\n \n\
  301. {BA686E}Error! {F1F1F1}You must insert a valid password.", "Submit", "Cancel");
  302. }
  303. else {
  304. SendClientMessage(playerid, COLOR_NOTICE, " < You decided to quit the registration panel and was kicked.");
  305. KickPlayer(playerid);
  306. }
  307. return 1;
  308. }
  309. }
  310. return 0;
  311. }
  312.  
  313. forward public OnPlayerRegister(playerid);
  314. public OnPlayerRegister(playerid) {
  315. new query[524], name[MAX_PLAYER_NAME], gpciAD[22], ip[32];
  316. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  317. GetPlayerIp(playerid, ip, 32);
  318. gpci(playerid, gpciAD, 22);
  319. mysql_format(database, query, 524, "INSERT INTO connections SET username = '%e', ip = '%e', gpci = '%e', timestamp = %i", name, ip, gpciAD, gettime());
  320. mysql_tquery(database, query, "OnPlayerLogin", "i", playerid);
  321. printf(" Player > Registered player to the database, %s(%i)", name, playerid);
  322. }
  323.  
  324. forward public OnPlayerLogin(playerid);
  325. public OnPlayerLogin(playerid) {
  326. printf(" Player > Playerid (%i) has logged in, loading gamemode for player.", playerid);
  327. SendClientMessage(playerid, COLOR_NOTICE, " <> You've now logged in, requesting the server to spawn you..");
  328.  
  329.  
  330. }
  331.  
  332. public OnPlayerEnterRaceCheckpoint(playerid) {
  333. if(GameMode[GMmode] != _:GAMEMODE_RACE)
  334. return 0;
  335. switch(GameMode[GMmodeEx]) {
  336. case 1: {
  337. if(GetPVarInt(playerid, "race CP") == 2) {
  338. SendClientMessage(playerid, -1, "finished");
  339. }
  340. else if(GetPVarInt(playerid, "race CP") < 1) {
  341. SetPlayerRaceCheckpoint(playerid, 0, GameRaceCP[GetPVarInt(playerid, "race CP")][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")][cpZ], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpZ], 3.0);
  342. }
  343. else
  344. SetPlayerRaceCheckpoint(playerid, 1, GameRaceCP[GetPVarInt(playerid, "race CP")][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")][cpZ], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpZ], 3.0);
  345. }
  346. default: {
  347. if(GetPVarInt(playerid, "race CP") == 30) {
  348. SendClientMessage(playerid, -1, "finished");
  349. }
  350. else if(GetPVarInt(playerid, "race CP") < 29) {
  351. SetPlayerRaceCheckpoint(playerid, 0, GameRaceCP[GetPVarInt(playerid, "race CP")][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")][cpZ], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpZ], 3.0);
  352. }
  353. else
  354. SetPlayerRaceCheckpoint(playerid, 1, GameRaceCP[GetPVarInt(playerid, "race CP")][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")][cpZ], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpX], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpY], GameRaceCP[GetPVarInt(playerid, "race CP")+1][cpZ], 3.0);
  355. }
  356. }
  357. return 1;
  358. }
  359.  
  360. forward public OnGameModeChange(mode);
  361. public OnGameModeChange(mode) {
  362. switch(mode) {
  363. case GAMEMODE_RACE: {
  364. GameMode[GMmode] = mode;
  365. GameMode[GMmodeEx] = random(MAX_RACES);
  366. switch(GameMode[GMmodeEx]) {
  367. case 1: {
  368. GameMode[GMmodeRace] = 2;
  369. GameMode[GMvehicle] = 411;
  370.  
  371. MapAndreas_FindZ_For2DCoord(250, -116, GameRaceCP[1][cpZ]);
  372. GameRaceCP[1][cpX] = 250;
  373. GameRaceCP[1][cpY] = -116;
  374.  
  375. MapAndreas_FindZ_For2DCoord(257, 41, GameRaceCP[2][cpZ]);
  376. GameRaceCP[2][cpX] = 257;
  377. GameRaceCP[2][cpY] = 41;
  378. }
  379.  
  380. default: {
  381. GameMode[GMmodeRace] = 30;
  382. GameMode[GMvehicle] = 560;
  383.  
  384. MapAndreas_FindZ_For2DCoord(64, 785, GameRaceCP[1][cpZ]);
  385. GameRaceCP[1][cpX] = 64;
  386. GameRaceCP[1][cpY] = 785;
  387.  
  388. MapAndreas_FindZ_For2DCoord(156, 852, GameRaceCP[2][cpZ]);
  389. GameRaceCP[2][cpX] = 156;
  390. GameRaceCP[2][cpY] = 852;
  391.  
  392. MapAndreas_FindZ_For2DCoord(238, 855, GameRaceCP[3][cpZ]);
  393. GameRaceCP[3][cpX] = 238;
  394. GameRaceCP[3][cpY] = 855;
  395.  
  396. MapAndreas_FindZ_For2DCoord(360, 882, GameRaceCP[4][cpZ]);
  397. GameRaceCP[4][cpX] = 360;
  398. GameRaceCP[4][cpY] = 882;
  399.  
  400. MapAndreas_FindZ_For2DCoord(447, 887, GameRaceCP[5][cpZ]);
  401. GameRaceCP[5][cpX] = 447;
  402. GameRaceCP[5][cpY] = 887;
  403.  
  404. MapAndreas_FindZ_For2DCoord(514, 928, GameRaceCP[6][cpZ]);
  405. GameRaceCP[6][cpX] = 514;
  406. GameRaceCP[6][cpY] = 928;
  407.  
  408. MapAndreas_FindZ_For2DCoord(516, 975, GameRaceCP[7][cpZ]);
  409. GameRaceCP[7][cpX] = 516;
  410. GameRaceCP[7][cpY] = 975;
  411.  
  412. MapAndreas_FindZ_For2DCoord(510, 1019, GameRaceCP[8][cpZ]);
  413. GameRaceCP[8][cpX] = 510;
  414. GameRaceCP[8][cpY] = 1019;
  415.  
  416. MapAndreas_FindZ_For2DCoord(510, 1131, GameRaceCP[9][cpZ]);
  417. GameRaceCP[9][cpX] = 510;
  418. GameRaceCP[9][cpY] = 1131;
  419.  
  420. MapAndreas_FindZ_For2DCoord(593, 1215, GameRaceCP[10][cpZ]);
  421. GameRaceCP[10][cpX] = 593;
  422. GameRaceCP[10][cpY] = 1215;
  423.  
  424. MapAndreas_FindZ_For2DCoord(656, 1276, GameRaceCP[11][cpZ]);
  425. GameRaceCP[11][cpX] = 656;
  426. GameRaceCP[11][cpY] = 1276;
  427.  
  428. MapAndreas_FindZ_For2DCoord(669, 1314, GameRaceCP[12][cpZ]);
  429. GameRaceCP[12][cpX] = 669;
  430. GameRaceCP[12][cpY] = 1314;
  431.  
  432. MapAndreas_FindZ_For2DCoord(724, 1337, GameRaceCP[13][cpZ]);
  433. GameRaceCP[13][cpX] = 724;
  434. GameRaceCP[13][cpY] = 1337;
  435.  
  436. MapAndreas_FindZ_For2DCoord(1006, 1336, GameRaceCP[14][cpZ]);
  437. GameRaceCP[14][cpX] = 1006;
  438. GameRaceCP[14][cpY] = 1336;
  439.  
  440. MapAndreas_FindZ_For2DCoord(1063, 1320, GameRaceCP[15][cpZ]);
  441. GameRaceCP[15][cpX] = 1063;
  442. GameRaceCP[15][cpY] = 1320;
  443.  
  444. MapAndreas_FindZ_For2DCoord(1078, 1257, GameRaceCP[16][cpZ]);
  445. GameRaceCP[16][cpX] = 1078;
  446. GameRaceCP[16][cpY] = 1257;
  447.  
  448. MapAndreas_FindZ_For2DCoord(1101, 1173, GameRaceCP[17][cpZ]);
  449. GameRaceCP[17][cpX] = 1101;
  450. GameRaceCP[17][cpY] = 1173;
  451.  
  452. MapAndreas_FindZ_For2DCoord(1160, 1112, GameRaceCP[18][cpZ]);
  453. GameRaceCP[18][cpX] = 1160;
  454. GameRaceCP[18][cpY] = 1112;
  455.  
  456. MapAndreas_FindZ_For2DCoord(1308, 1079, GameRaceCP[19][cpZ]);
  457. GameRaceCP[19][cpX] = 1308;
  458. GameRaceCP[19][cpY] = 1079;
  459.  
  460. MapAndreas_FindZ_For2DCoord(1412, 967, GameRaceCP[20][cpZ]);
  461. GameRaceCP[20][cpX] = 1412;
  462. GameRaceCP[20][cpY] = 967;
  463.  
  464. MapAndreas_FindZ_For2DCoord(1431, 833, GameRaceCP[21][cpZ]);
  465. GameRaceCP[21][cpX] = 1431;
  466. GameRaceCP[21][cpY] = 833;
  467.  
  468. MapAndreas_FindZ_For2DCoord(1446, 639, GameRaceCP[22][cpZ]);
  469. GameRaceCP[22][cpX] = 1446;
  470. GameRaceCP[22][cpY] = 639;
  471.  
  472. MapAndreas_FindZ_For2DCoord(1438, 487, GameRaceCP[23][cpZ]);
  473. GameRaceCP[23][cpX] = 1438;
  474. GameRaceCP[23][cpY] = 487;
  475.  
  476. MapAndreas_FindZ_For2DCoord(1440, 308, GameRaceCP[24][cpZ]);
  477. GameRaceCP[24][cpX] = 1440;
  478. GameRaceCP[24][cpY] = 308;
  479.  
  480. MapAndreas_FindZ_For2DCoord(1381, 197, GameRaceCP[25][cpZ]);
  481. GameRaceCP[25][cpX] = 1381;
  482. GameRaceCP[25][cpY] = 197;
  483.  
  484. MapAndreas_FindZ_For2DCoord(1375, 33, GameRaceCP[26][cpZ]);
  485. GameRaceCP[26][cpX] = 1375;
  486. GameRaceCP[26][cpY] = 33;
  487.  
  488. MapAndreas_FindZ_For2DCoord(1366, -137, GameRaceCP[27][cpZ]);
  489. GameRaceCP[27][cpX] = 1366;
  490. GameRaceCP[27][cpY] = -137;
  491.  
  492. MapAndreas_FindZ_For2DCoord(1198, -177, GameRaceCP[28][cpZ]);
  493. GameRaceCP[28][cpX] = 1198;
  494. GameRaceCP[28][cpY] = -177;
  495.  
  496. MapAndreas_FindZ_For2DCoord(1038, -174, GameRaceCP[29][cpZ]);
  497. GameRaceCP[29][cpX] = 1038;
  498. GameRaceCP[29][cpY] = -174;
  499.  
  500. MapAndreas_FindZ_For2DCoord(870, -151, GameRaceCP[30][cpZ]);
  501. GameRaceCP[30][cpX] = 870;
  502. GameRaceCP[30][cpY] = -151;
  503. }
  504. }
  505.  
  506. SendClientMessageToAll(COLOR_MISSION, "The gamemode was randomly selected for.. vehicle racing!");
  507. SendClientMessageToAll(COLOR_MISSION, "The race will start in 10 seconds, get ready!");
  508.  
  509. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
  510. if(IsPlayerConnected(playerid) && GetPlayerColor(playerid) == 0xF1F1F1FF) {
  511. DisableRemoteVehicleCollisions(playerid, 1);
  512. SetPVarInt(playerid, "race vehicle", CreateVehicle(GameMode[GMvehicle], GameRaceCP[1][cpX], GameRaceCP[1][cpY], GameRaceCP[1][cpZ], random(360), random(140), random(140), -1, 0));
  513. PutPlayerInVehicle(playerid, GetPVarInt(playerid, "race vehicle"), 0);
  514. TogglePlayerControllable(playerid, false);
  515. }
  516. }
  517.  
  518. SetTimerEx("OnGameLaunchRace", 7*1000, false, "i", 0);
  519. }
  520. }
  521. }
  522.  
  523. forward public OnGameLaunchRace(stage);
  524. public OnGameLaunchRace(stage) {
  525. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
  526. if(IsPlayerConnected(playerid) && GetPlayerColor(playerid) == 0xF1F1F1FF && GetPlayerVehicleID(playerid) == 0) {
  527. DisableRemoteVehicleCollisions(playerid, 1);
  528. SetPVarInt(playerid, "race vehicle", CreateVehicle(GameMode[GMvehicle], GameRaceCP[1][cpX], GameRaceCP[1][cpY], GameRaceCP[1][cpZ], random(360), random(140), random(140), -1, 0));
  529. PutPlayerInVehicle(playerid, GetPVarInt(playerid, "race vehicle"), 0);
  530. TogglePlayerControllable(playerid, false);
  531. }
  532. }
  533.  
  534. switch(stage) {
  535. case 0: {
  536. GameTextForAll("Ready..", 999, 3);
  537. SetTimerEx("OnGameLaunchRace", 1000, false, "i", 1);
  538.  
  539. }
  540. case 1: {
  541. GameTextForAll("Set..", 999, 3);
  542. SetTimerEx("OnGameLaunchRace", 1000, false, "i", 2);
  543. }
  544. case 2: {
  545. GameTextForAll("~w~GO!", 999, 3);
  546. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
  547. if(IsPlayerConnected(playerid) && GetPlayerColor(playerid) == 0xF1F1F1FF && GetPlayerVehicleID(playerid) != 0) {
  548. TogglePlayerControllable(playerid, true);
  549. }
  550. }
  551. }
  552. }
  553. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement