· 9 years ago · Feb 10, 2017, 10:20 PM
1/**
2 * Copyright (c) 2015-2016 YBot MySQL Mode
3 *
4 * This program is free software: you can Ristribute it and/or modify it under the terms of the
5 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
6 * License, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with this program.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16
17 /*AUTHOR **********************
18 * @Yassine - SA-MP Scripter *
19 *******************************/
20
21#include <a_samp>
22#include <a_mysql>
23#include <zcmd>
24#include <sscanf2>
25#include <mapandreas>
26
27#define MYSQL_HOST "51.254.75.3"
28#define MYSQL_DATABASE "yaa"
29#define MYSQL_USER "yaa"
30#define MYSQL_PASSWORD "lypyaa123"
31
32#define YBot "YBot"
33
34#define FORUM "xxx.xxx.com"
35
36#define GRI "{C0C0C0}"
37#define R "{F81414}"
38#define W "{FFFFFF}"
39
40#define Major 1
41#define Minor 0
42
43#if !defined isnull
44 #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
45#endif
46
47forward YBot_FetchData(playerid);
48forward YBot_Announces();
49forward YBot_OnlineCount(playerid);
50forward YBot_Reply(playerid, text[], replyid);
51forward OnPlayerAirbreak(playerid);
52forward BanPlayer(playerid, reason[]);
53forward KickPlayer(playerid, reason[]);
54forward AirBreak();
55
56new
57 bool:SEEN_SYSTEM = true, // that enable saving mode
58 ANNOUNCE_TIME = 30 // in seconds
59;
60
61new joke[][] =
62{
63 "Why is 88 better than 69? Because you get ate twice.",
64 "I dreamt I was forced to eat a giant marshmallow. When I woke up, my pillow was gone",
65 "Two Elephants meet a totally naked guy. After a while one elephant says to the other: “I really don’t get how he can feed himself with that thing!â€",
66 "My dog used to chase people on a bike a lot. It got so bad, finally I had to take his bike away.",
67 "Police officer: Can you identify yourself, sir? Driver pulls out his mirror and says: Yes, it's me.",
68 "My wife’s cooking is so bad we usually pray after our food.",
69 "What do you get when you cross-breed a cow and a shark? I don’t know, but I wouldn't enjoy milking it.",
70 "I'd like to buy a new boomerang please. Also, can you tell me how to throw the old one away?",
71 "Crowded elevators have a different smell to children and midgets.",
72 "How can you tell you have a really bad case of acne? It’s when the blind try to read your face.",
73 "It is so cold outside I saw a politician with his hands in his own pockets.",
74 "I wanted to grow my own food but I couldn’t get bacon seeds anywhere.",
75 "Why do women live on average two years longer? Because the time they spend parking doesn’t count.",
76 "I can’t believe I forgot to go to the gym today. That’s 7 years in a row now.",
77 "Woke up with a dead leg this morning. I will not take out a loan with the mafia ever again.",
78 "A naked women robbed a bank. Nobody could remember her face.",
79 "How do you tell that a crab is drunk? It walks forwards.",
80 "I’m selling my talking parrot. Why? Because yesterday, the bastard tried to sell me.",
81 "A wife is like a hand grenade. Take off the ring and say good bye to your house.",
82 "I heard women love a man in uniform. Can’t wait to start working at McDonalds.",
83 "You’ll never believe who I bumped into on my way to the eye doctor! Everybody!",
84 "Which bees produce milk? The boo-bees!"
85};
86
87new RandomMessages[][] =
88{
89 "Not having friends is just as bad for your health as smoking a pack of cigarettes a day.",
90 "People who are distracted easily tend to be more creative & actually accomplish more during their lifetime.",
91 "There are currently over 7 billion people on earth today.",
92 "Scientists say, humans have a 95 percent chance of extinction over the next 9000 years.",
93 "Smarter people are more likely to suffer from anxiety and depression.",
94 "If a Google employee passes away, their spouse gets half of their pay for 10 years.",
95 "More than 12 men have stood on the moon, but only three have been to the deepest known spot in the ocean.",
96 "There are more stars in the sky than grains of sand on the earth.",
97 "Once you fall in love, you're more likely to lose two to three close friends.",
98 "There's an 82 percent chance that if you're 16 , older, you've already met the person you'll marry.",
99 "If you're one in a millionÅ There are 6,973 people just like you.",
100 "90 percent of the time, the first cigarette, beer and marijuana of every single person's life was not bought by their own money.",
101 "The average amount of time a woman can keep a secret is just 47 hours and 23 minutes.",
102 "No matter how hard you try, you can never remember how your dream started.",
103 "Bill Gates makes $290 per second.",
104 "If you had 1 billion dollars and spent $1,000 a day, it would take you 2,749 years to spend it all.",
105 "It takes the brain approximately 90 seconds to decide whether or not you like someone.",
106 "The only cells that survive from the time you are born until death are in your eye.",
107 "Apple makes about $436 million every day -- That's $18 million an hour, $300,000 a minute, $5,000 a second.",
108 "All the 13 minerals required to sustain human life can be found in beer.",
109 "Laughter is the best medicine, and marijuana makes you laugh. Therefore marijuana is the best medicine.",
110 "Being ignored can actually drive you slightly crazy.",
111 "About 160,000 people will die on the same day as you.",
112 "5 Minutes of exercise per day can add 3 years to your life.",
113 "The longest recorded marriage lasted 91 years and 12 days.",
114 "400,000 iPhones are sold daily. 350,000 people are born daily.",
115 "By the time you're a Senior in High School... You would've spent 17,000 hours of your life in school.",
116 "Relationships that start off as friendships are more likely to last longer."
117};
118
119new r8ball[][] =
120{
121 "Yes!",
122 "Well ask later",
123 "Never",
124 "NO!",
125 "i don't think so",
126 "......",
127 "Yep",
128 "i think",
129 "well stop asking me this questions",
130 "fk off",
131 "Nope",
132 "YEAH!"
133};
134
135new insultwords[][] =
136{
137 "Fuck you",
138 "fk you",
139 "fk off",
140 "motherfucker",
141 "idiot",
142 "Nigga",
143 "pussy",
144 "your mom",
145 "fking",
146 "fk youself",
147 "gay",
148 "fuck off",
149 "Idiots",
150 "fucker",
151 "7mar",
152 "kalb",
153 "nik",
154 "nikrabek",
155 "nikimak",
156 "ass",
157 "lick",
158 "dick",
159 "cunt",
160 "stupid",
161 "sucks",
162 "cum",
163 "sperm"
164};
165
166enum PlayerStats
167{
168 Hour,
169 Min,
170 Sec
171};
172
173new YBot_player[MAX_PLAYERS][PlayerStats];
174
175new YBot_Timer[MAX_PLAYERS];
176
177new YBot_ATimer;
178new YBot_XTimer;
179
180new warned[MAX_PLAYERS];
181
182new bool:CoolDown[MAX_PLAYERS];
183
184new
185 MySQL:ybot,
186 bool:Failed
187;
188
189
190stock YBot_GetName(playerid)
191{
192 new szName[MAX_PLAYER_NAME];
193 GetPlayerName(playerid, szName, sizeof(szName));
194 return szName;
195}
196
197public OnFilterScriptInit()
198{
199 new count = GetTickCount();
200 print(" [YBot]: Loading System...");
201 printf(" [YBot]: YBot System Version %d.%d", Major, Minor);
202 print(" [YBot]: Loading Configurations..");
203
204 if(SEEN_SYSTEM == true)
205 {
206
207 print(" [YBot]: MySQL Mode Loaded.");
208 print(" --------------------------");
209 print(" [YBot]: Connecting to MySQL Database....");
210
211 ybot = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
212
213 if(mysql_errno() != 0)
214 {
215 print("[ YBot]: there an error while loading YBot.");
216 print(" [YBot Erros]: 0x04521 -> Failed to connect using following info:");
217 printf(" [YBot Info]: Host: %s | User: %s | Database: %s | Password: ******* ", MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE);
218 print(" --------------------------");
219 Failed = true;
220 }
221 else
222 {
223 print(" [YBot]: Connected.");
224 print(" [YBot]: Creating Databases....");
225
226 mysql_query(ybot, "CREATE TABLE IF NOT EXISTS `YBot` (Name VARCHAR(24), YEAR INT(4), MONTH INT(2), DAY INT(2), HOUR INT(2), MIN INT(2), SEC INT(2))");
227
228 print(" [YBot]: Created. Starting the YBot.");
229 print(" [YBot]: YBot has been connected to main chat");
230
231 Failed = false;
232 }
233 }
234 if(!Failed)
235 {
236 print(" [YBot]: Starting the announces repeater...");
237 YBot_ATimer = SetTimer("YBot_Announces", ANNOUNCE_TIME * 1000, true);
238 print(" [YBot]: Success.");
239 print(" [YBot]: Enabling the anti airbreak...");
240 YBot_XTimer = SetTimer("AirBreak", 1000, true);
241 print(" [YBot]: Success.");
242 print(" --------------------------");
243 printf(" [YBot]: Time taken to start and setup the bot is %d seconds", (GetTickCount() - count)/1000);
244 print(" [YBot]: The bot connected and ready to use");
245 }
246 else
247 {
248 print(" [YBot]: Failed to load YBot due to some errors while loading");
249 }
250 return 1;
251}
252
253public OnFilterScriptExit()
254{
255 if(SEEN_SYSTEM == true)
256 {
257 mysql_close(ybot);
258 }
259 KillTimer(YBot_ATimer);
260 KillTimer(YBot_XTimer);
261 for(new i = 0; i < MAX_PLAYERS; i++)
262 {
263 KillTimer(YBot_Timer[i]);
264 }
265 print("->> YBot has been unloaded.");
266 return 1;
267}
268
269public OnPlayerConnect(playerid)
270{
271 if(SEEN_SYSTEM == true)
272 {
273 new query[80];
274 mysql_format(ybot, query, sizeof(query), "SELECT * FROM `YBot` WHERE Name = '%e'", YBot_GetName(playerid));
275 mysql_tquery(ybot, query, "YBot_FetchData", "i", playerid);
276 }
277 return 1;
278}
279
280public OnPlayerDisconnect(playerid, reason)
281{
282 if(SEEN_SYSTEM == true)
283 {
284 new year, month, day, hour, minu, sec, query[150];
285 getdate(year, month, day);
286 gettime(hour, minu, sec);
287
288 mysql_format(ybot, query, sizeof(query), "UPDATE `YBot` SET (YEAR = %d, MONTH = %d, DAY = %d, HOUR = %d, MIN = %d, SEC = %d) WHERE Name = '%s'", year, month, day, hour, minu, sec, YBot_GetName(playerid));
289 mysql_query(ybot, query);
290 KillTimer(YBot_Timer[playerid]);
291 }
292 return 1;
293}
294
295public OnPlayerText(playerid, text[])
296{
297 if(!Failed)
298 {
299 if(!strcmp(text, ".joke")) return YBot_Says(playerid, text, 10);
300 if(!strcmp(text, ".cmds")) return YBot_Says(playerid, text, 9);
301 if(!strcmp(text, ".register")) return YBot_Says(playerid, text, 8);
302 if(!strcmp(text, ".forum")) return YBot_Says(playerid, text, 7);
303 if(strfind(text, "How", true) != -1 && !CoolDown[playerid]) return YBot_Says(playerid, text, 6);
304 if(strfind(text, "Hello", true) != -1) return YBot_Says(playerid, text, 5);
305 if(strfind(text, "How are", true) != -1 || strfind(text, "sup", true) != -1) return YBot_Says(playerid, text, 4);
306 if(strfind(text, "Hacker", true) != -1 || strfind(text, "Hack", true) != -1 || strfind(text, "Hax", true) != -1 || strfind(text, "Hak", true) != -1) return YBot_Says(playerid, text, 3);
307 if(strfind(text, "Help", true) != -1) return YBot_Says(playerid, text, 2);
308
309 if(strfind(text, "fuck you admin", true) != -1) return YBot_Says(playerid, text, 0);
310 if(strfind(text, "admins sucks", true) != -1) return YBot_Says(playerid, text, 0);
311 if(strfind(text, "fu admin", true) != -1) return YBot_Says(playerid, text, 0);
312 if(strfind(text, "admin gay", true) != -1) return YBot_Says(playerid, text, 0);
313
314 for(new i = 0; i < sizeof(insultwords); i++)
315 {
316 if(strfind(text, insultwords[i], true) != -1) return YBot_Says(playerid, text, 1);
317 }
318 }
319 return 1;
320}
321
322public OnPlayerAirbreak(playerid)
323{
324 new str[50];
325 SendClientMessageToAll(-1, ""R""YBot"(0): "W"those hackers pff, airbreak not allowed see you");
326 format(str, sizeof(str), "YBot/Warned/%s.ybot", YBot_GetName(playerid));
327 if(fexist(str))
328 {
329 format(str, sizeof(str), "YBot/Banned/%s.ybot", YBot_GetName(playerid));
330 new File:file;
331 file = fopen(str, io_write);
332 fclose(file);
333 BanPlayer(playerid, "Airbreak");
334 }
335 else
336 {
337 format(str, sizeof(str), "YBot/Warned/%s.ybot", YBot_GetName(playerid));
338 new File:file;
339 file = fopen(str, io_write);
340 fclose(file);
341 KickPlayer(playerid, "Airbreak");
342 }
343}
344
345CMD:botsay(playerid, params[])
346{
347 new str[100];
348 if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, ""R""YBot"(0): "W"Hello. Thank you for joining FFS but you can't use this command atm, you need help ? use /ashley");
349 if(isnull(params)) return SendClientMessage(playerid, -1, ""R""YBot"(0): "W"Hi Admin, it's /botsay [text]");
350 format(str, sizeof(str), ""R""YBot"(0): "W"%s", params);
351 SendClientMessageToAll(-1, str);
352 return 1;
353}
354
355CMD:seen(playerid, params[])
356{
357 new name[24], str[100], bool:exists;
358 if(SEEN_SYSTEM == true)
359 {
360 format(name, sizeof(name), ".seen %s", params);
361 SendPlayerMessageToAll(playerid, name);
362 if(sscanf(params, "s[24]", name)) return SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello there a Synatax Error: .seen [Name]");
363 for(new i = 0; i < MAX_PLAYERS; i++)
364 {
365 if(IsPlayerConnected(i))
366 {
367 if(!strcmp(name, YBot_GetName(i)))
368 {
369 exists = true;
370 }
371 else
372 {
373 exists = false;
374 }
375 }
376 }
377 if(exists == true)
378 {
379 format(str, sizeof(str), ""R""YBot"(0): "W"Player %s is already online for %d hours, %d minutes and %d seconds", name, YBot_player[YBot_GetPlayerId(name)][Hour], YBot_player[YBot_GetPlayerId(name)][Min], YBot_player[YBot_GetPlayerId(name)][Sec]);
380 SendClientMessageToAll(-1, str);
381 }
382 else
383 {
384 new year, month, day, hour, minute, second;
385 if(YBot_GetLastOnline(name, year, month, day, hour, minute, second))
386 {
387 format(str, sizeof(str), ""R""YBot"(0): "W"Player %s was last online in %dth %s %d, %d:%d:%d", name, day, YBot_Month(month), year, hour, minute, second);
388 SendClientMessageToAll(-1, str);
389 }
390 else
391 {
392 SendClientMessageToAll(-1, ""R""YBot"(0): "W"Error: This nickname not exists in database");
393 }
394 }
395 }
396 return 1;
397}
398
399
400CMD:8ball(playerid, params[])
401{
402 new ex[24], str[50];
403 format(ex, sizeof(ex), ".8ball %s", params);
404 SendPlayerMessageToAll(playerid, ex);
405
406 if(sscanf(params, "s[24]", ex)) return SendClientMessageToAll(-1, ""R""YBot"(0): "W"Well i don't know what you means");
407 format(str, sizeof(str), ""R""YBot"(0): "W"%s", r8ball[random(sizeof(r8ball))]);
408 SendClientMessageToAll(-1, str);
409 return 1;
410}
411
412public YBot_Reply(playerid, text[], replyid)
413{
414 new str[150];
415 switch(replyid)
416 {
417 case 0:
418 {
419 SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello. Disrespecting admin not allowed. now STFU and cya");
420 format(str, sizeof(str), "YBot/Warned/%s.ybot", YBot_GetName(playerid));
421 if(fexist(str))
422 {
423 format(str, sizeof(str), "YBot/Banned/%s.ybot", YBot_GetName(playerid));
424 new File:file;
425 file = fopen(str, io_write);
426 fclose(file);
427 BanPlayer(playerid, "Disrespecting Admins");
428 }
429 else
430 {
431 format(str, sizeof(str), "YBot/Warned/%s.ybot", YBot_GetName(playerid));
432 new File:file;
433 file = fopen(str, io_write);
434 fclose(file);
435 KickPlayer(playerid, "Disrespecting Admins");
436 }
437 }
438 case 1:
439 {
440 if(warned[playerid] == 3) return KickPlayer(playerid, "Insulting");
441 SendClientMessageToAll(-1, ""R""YBot"(0): "W"well insulting is bad next time you will got kicked");
442 warned[playerid]++;
443 }
444 case 2: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello. do you need help? you can use /help or /commands");
445 case 3: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Oh COMON? Stop saying it in main chat just use /report or @ ids :/");
446 case 4:
447 {
448 if(CoolDown[playerid])
449 {
450 SendClientMessageToAll(-1, ""R""YBot"(0): "W"fine and you ?");
451 CoolDown[playerid] = false;
452 }
453 }
454 case 5:
455 {
456 SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello.");
457 CoolDown[playerid] = true;
458 }
459 case 6: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello. do you need help? you can use /help or /commands");
460 case 7: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello man. you are new here ? you can join us at the forum "FORUM"");
461 case 8: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Hello there. you are new here ? you can register using /register to make you stats saved");
462 case 9: SendClientMessageToAll(-1, ""R""YBot"(0): "W"Heya! you can highlight me using those words: .8ball .seen .cmds .forum .register .joke");
463 case 10:
464 {
465 format(str, sizeof(str), ""R""YBot"(0): "W"%s", joke[random(sizeof(joke))]);
466 SendClientMessageToAll(-1, str);
467 }
468 }
469 return 1;
470}
471
472public YBot_FetchData(playerid)
473{
474 new rows, query[150];
475
476 cache_get_row_count(rows);
477 if(rows)
478 {
479 SetTimerEx("YBot_OnlineCount", 1000, true, "i", playerid);
480 }
481 else
482 {
483 new year, month, day, hour, minu, sec;
484 getdate(year, month, day);
485 gettime(hour, minu, sec);
486
487 mysql_format(ybot, query, sizeof(query), "INSERT INTO `YBot` (Name, YEAR, MONTH, DAY, HOUR, MIN, SEC) VALUES ('%s', %d, %d, %d, %d, %d, %d)", YBot_GetName(playerid), year, month, day, hour, minu, sec);
488 mysql_query(ybot, query);
489
490 YBot_Timer[playerid] = SetTimerEx("YBot_OnlineCount", 1000, true, "i", playerid);
491 }
492 return 1;
493}
494
495public YBot_OnlineCount(playerid)
496{
497 YBot_player[playerid][Sec]++;
498 if(YBot_player[playerid][Sec] == 60)
499 {
500 YBot_player[playerid][Sec] = 0;
501 YBot_player[playerid][Min]++;
502 }
503 if(YBot_player[playerid][Min] == 60)
504 {
505 YBot_player[playerid][Min] = 0;
506 YBot_player[playerid][Hour]++;
507 }
508 return 1;
509}
510
511public YBot_Announces()
512{
513 new str[200];
514 format(str, sizeof(str), ""R""YBot"(0): "W"%s", RandomMessages[random(sizeof(RandomMessages))]);
515 SendClientMessageToAll(-1, str);
516 return 1;
517}
518
519stock YBot_Says(playerid, text[], replyid)
520{
521 return SetTimerEx("YBot_Reply", 2000, false, "isi", playerid, text, replyid);
522}
523
524stock YBot_GetPlayerId(playername[])
525{
526 for(new i = 0; i <= MAX_PLAYERS; i++)
527 {
528 if(IsPlayerConnected(i))
529 {
530 new playername2[MAX_PLAYER_NAME];
531 GetPlayerName(i, playername2, sizeof(playername2));
532 if(strcmp(playername2, playername, true, strlen(playername)) == 0)
533 {
534 return i;
535 }
536 }
537 }
538 return INVALID_PLAYER_ID;
539}
540
541stock YBot_Month(monthnumber)
542{
543 new str[10];
544
545 switch(monthnumber)
546 {
547 case 1: str = "January";
548 case 2: str = "February";
549 case 3: str = "March";
550 case 4: str = "April";
551 case 5: str = "May";
552 case 6: str = "June";
553 case 7: str = "July";
554 case 8: str = "August";
555 case 9: str = "September";
556 case 10: str = "October";
557 case 11: str = "November";
558 case 12: str = "December";
559 }
560 return str;
561}
562
563public BanPlayer(playerid, reason[])
564{
565 new str[50];
566 format(str, sizeof(str), ""R"*"GRI"%s (Id: %d) "R"has been banned by "GRI""YBot" "R"for "GRI"%s", YBot_GetName(playerid), playerid, reason);
567 SendClientMessageToAll(-1, str);
568 BanEx(playerid, reason);
569 return 1;
570}
571
572stock YBot_GetLastOnline(name[], &y, &mx, &d, &h, &m, &s)
573{
574 new Cache:GetCache, bool:exists;
575 new query[70];
576 if(SEEN_SYSTEM == true)
577 {
578 mysql_format(ybot, query, sizeof(query), "SELECT * FROM `YBot` WHERE Name = '%e'", name);
579 GetCache = mysql_query(ybot, query);
580 new rows;
581 cache_get_row_count(rows);
582
583 if(rows)
584 {
585 cache_get_value_name_int(0, "YEAR", y);
586 cache_get_value_name_int(0, "MONTH", mx);
587 cache_get_value_name_int(0, "DAY", d);
588 cache_get_value_name_int(0, "HOUR", h);
589 cache_get_value_name_int(0, "MIN", m);
590 cache_get_value_name_int(0, "SEC", s);
591 cache_delete(GetCache);
592
593 exists = true;
594 }
595 else
596 {
597 cache_delete(GetCache);
598 exists = false;
599 }
600 }
601 if(exists) return true;
602 else
603 return false;
604}
605
606public KickPlayer(playerid, reason[])
607{
608 new str[50];
609 format(str, sizeof(str), ""R"*"GRI"%s (Id: %d) "R"has been kicked by "GRI""YBot" "R"for "GRI"%s", YBot_GetName(playerid), playerid, reason);
610 SendClientMessageToAll(-1, str);
611 Kick(playerid);
612 return 1;
613}
614
615// Airbreak Detector ===============================================================================
616
617IsVehicleAir(playerid, vehicleid)
618{
619 vehicleid = GetPlayerVehicleID(playerid);
620 switch(GetVehicleModel(vehicleid))
621 {
622 case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 498, 563, 447, 469: return true;
623 }
624 return false;
625}
626
627public AirBreak()
628{
629 for(new i = 0; i < MAX_PLAYERS; i++)
630 {
631 if(!Spawned[i]) return 1;
632 new Float:X, Float:Y, Float:Z, Float:ZM, Float:difference;
633 GetPlayerPos(i,X,Y,Z); //Get the players position
634 MapAndreas_FindZ_For2DCoord(X,Y,ZM); //Gets the max Z cord
635 difference = Z-ZM;
636
637 if(!IsVehicleAir(i, GetPlayerVehicleID(i)))
638 {
639 if (difference > 100 && GetPlayerState(i) == PLAYER_STATE_PASSENGER || GetPlayerState(i) == PLAYER_STATE_DRIVER)
640 {
641 SetTimerEx("OnPlayerAirbreak", 1000, false, "i", i);
642 }
643 //If players Z cord is more than 100 meters above the ground
644 if(difference > 10 && GetPlayerState(i) == PLAYER_STATE_ONFOOT)
645 {
646 SetTimerEx("OnPlayerAirbreak", 1000, false, "i", i);
647 }
648 }
649 }
650}