Guest User

script

a guest
Mar 2nd, 2010
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.32 KB | None | 0 0
  1. #include <a_samp>
  2. #include <core>
  3. #include <float>
  4. #include <dprop>
  5. #include <vstream>
  6. #include <float>
  7. #include <time>
  8. #include <dini>
  9. #include "../include/gl_common.inc"
  10. //#include "../include/gl_spawns.inc"
  11.  
  12. #pragma tabsize 0
  13.  
  14. //----------------------------------------------------------
  15.  
  16. #define COLOR_WHITE 0xFFFFFFFF
  17. #define COLOR_NORMAL_PLAYER 0xFF4444FF
  18.  
  19. #define CITY_LOS_SANTOS 0
  20. #define CITY_SAN_FIERRO 1
  21. #define CITY_LAS_VENTURAS 2
  22.  
  23. // Class selection globals
  24. new gPlayerCitySelection[MAX_PLAYERS];
  25. new gPlayerHasCitySelected[MAX_PLAYERS];
  26. new gPlayerLastCitySelectionTick[MAX_PLAYERS];
  27.  
  28. new Text:txtClassSelHelper;
  29. new Text:txtLosSantos;
  30. new Text:txtSanFierro;
  31. new Text:txtLasVenturas;
  32.  
  33. #define LOGINMENU 3
  34. #define FIGHTMENU 4
  35.  
  36. #define BRITISH_GENERAL 5
  37. #define BRITISH_SOLDIER 6
  38. #define BRITISH_MEDIC 7
  39. #define TEAM_BRITISH 8
  40.  
  41. #define FRANCE_GENERAL 9
  42. #define FRANCE_SOLDIER 10
  43. #define FRANCE_MEDIC 11
  44. #define TEAM_FRANCE 12
  45.  
  46. #define COLOR_GREY 0xAFAFAFAA
  47. #define COLOR_RED 0xAA3333AA
  48. #define COLOR_YELLOW 0xFFFF00AA
  49. #define COLOR_BLUE 0x0000BBAA
  50. #define COLOR_DARKRED 0x660000AA
  51. #define COLOR_ORANGE 0xFF9900AA
  52. #define COLOR_BRIGHTRED 0xFF0000AA
  53. #define COLOR_INDIGO 0x4B00B0AA
  54. #define COLOR_VIOLET 0x9955DEEE
  55. #define COLOR_LIGHTRED 0xFF99AADD
  56. #define COLOR_SEAGREEN 0x00EEADDF
  57. #define COLOR_GRAYWHITE 0xEEEEFFC4
  58. #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
  59. #define COLOR_GREENISHGOLD 0xCCFFDD56
  60. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  61. #define COLOR_NEUTRALBLUE 0xABCDEF01
  62. #define COLOR_LIGHTCYAN 0xAAFFCC33
  63. #define COLOR_LEMON 0xDDDD2357
  64. #define COLOR_MEDIUMBLUE 0x63AFF00A
  65. #define COLOR_NEUTRAL 0xABCDEF97
  66. #define COLOR_BLACK 0x00000000
  67. #define COLOR_NEUTRALGREEN 0x81CFAB00
  68. #define COLOR_DARKGREEN 0x12900BBF
  69. #define COLOR_DARKBLUE 0x300FFAAB
  70. #define COLOR_BLUEGREEN 0x46BBAA00
  71. #define COLOR_DARKRED 0x660000AA
  72. #define COLOR_ORANGE 0xFF9900AA
  73. #define COLOR_PURPLE 0x800080AA
  74. #define COLOR_GRAD1 0xB4B5B7FF
  75. #define COLOR_GRAD2 0xBFC0C2FF
  76. #define COLOR_RED1 0xFF0000AA
  77. #define COLOR_GREY 0xAFAFAFAA
  78. #define COLOR_GREEN 0x33AA33AA
  79. #define COLOR_RED 0xAA3333AA
  80. #define COLOR_YELLOW 0xFFFF00AA
  81. #define COLOR_CYAN 0x99FFFFAA
  82. #define COLOR_TAN 0xFFFFCCAA
  83. #define COLOR_KHAKI 0x999900AA
  84. #define COLOR_LIME 0x99FF00AA
  85. #define COLOR_SYSTEM 0xEFEFF7AA
  86. #define COLOR_GRAD2 0xBFC0C2FF
  87. #define COLOR_GRAD4 0xD8D8D8FF
  88. #define COLOR_GRAD6 0xF0F0F0FF
  89. #define COLOR_GRAD2 0xBFC0C2FF
  90. #define COLOR_GRAD3 0xCBCCCEFF
  91. #define COLOR_GRAD5 0xE3E3E3FF
  92. #define COLOR_GRAD1 0xB4B5B7FF
  93. #define ADMIN_RED 0xFB0000FF
  94. #define YELLOW 0xFFFF00FF
  95. #define ORANGE 0xF97804FF
  96. #define LIGHTRED 0xFF8080FF
  97. #define LIGHTBLUE 0x00C2ECFF
  98. #define PURPLE 0xB360FDFF
  99. #define LIGHTGREEN 0x38FF06FF
  100. #define DARKPINK 0xE100E1FF
  101. #define NICESKY 0x99FFFFAA
  102. #define GRAY 0xCECECEFF
  103. #define NONE 0xFFFFFF00
  104. #define COLOR_GREEN 0x33AA33AA
  105. #define COLOR_PURPLE 0x800080AA
  106. #define COLOR_DARKRED 0x660000AA
  107. #define COLOR_YELLOW 0xFFFF00AA
  108. #define COLOR_BLUE 0x0000BBAA
  109. #define COLOR_ORANGE 0xFF9900AA
  110. #define COLOR_DARKBROWN 0x80400096
  111. #define COLOR_GOLD 0xB8860BAA
  112. #define red 0xFF0000AA
  113. #define Skater_grey 0x7F7F7FDE
  114. #define Worker_green 0x096616DB
  115. #define ProxDetector
  116. #define COLOR_RED 0xAA3333AA
  117. #define COLOR_AQUA 0xF0F8FFAA
  118. #define COLOR_SPRINGGREEN 0x00FF7FAA
  119. #define COLOR_GREY 0xAFAFAFAA
  120. #define ADMIN_RED 0xFB0000FF
  121. #define YELLOW 0xFFFF00FF
  122. #define ORANGE 0xF97804FF
  123. #define LIGHTRED 0xFF8080FF
  124. #define LIGHTBLUE 0x00C2ECFF
  125. #define PURPLE 0xB360FDFF
  126. #define LIGHTGREEN 0x38FF06FF
  127. #define DARKPINK 0xE100E1FF
  128. #define NICESKY 0x99FFFFAA
  129. #define GRAY 0xCECECEFF
  130. #define NONE 0xFFFFFF00
  131. #pragma unused ret_memcpy
  132. #define MAX_TEAMKILLS_FORJAIL 2
  133. #define MAX_TEAMKILLS 3
  134. #define JAIL_TIME 300000
  135. new gPlayerClass[MAX_PLAYERS];
  136. forward OnPlayerRegister(playerid, password[]);
  137. forward OnPlayerLogin(playerid,password[]);
  138. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  139. forward Bomb();
  140. forward ArmyCap(playerid);
  141. forward IraqCap(playerid);
  142. forward Encrypt(string[]);
  143. forward SetPlayerRandomSpawn(playerid);
  144. forward Stats(playerid,targetid);
  145. forward ini_GetValue( line[] );
  146. forward ini_GetKey( line[] );
  147. forward SaveStats(playerid);
  148. forward ArmyTimer();
  149. new VehicleNames[][] =
  150. {
  151. "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster",
  152. "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  153. "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer",
  154. "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach",
  155. "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow",
  156. "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair",
  157. "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic",
  158. "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton",
  159. "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher",
  160. "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick",
  161. "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher",
  162. "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt", "Tanker", "Roadtrain",
  163. "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck",
  164. "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan",
  165. "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder",
  166. "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster", "Monster",
  167. "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  168. "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30",
  169. "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  170. "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car", "Police Car", "Police Car",
  171. "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs",
  172. "Boxville", "Tiller", "Utility Trailer"
  173. };
  174. new Text:CreatorTextDraw;
  175.  
  176. enum pInfo
  177. {
  178. pKills,// Kills
  179. pTeam, // Team Captures
  180. pJoins, // When someone rejoins, it will +1
  181. pKey,
  182. pDeaths // Deaths
  183. };
  184. new PlayerInfo[MAX_PLAYERS][pInfo];
  185. new gPlayerAccount[MAX_PLAYERS];
  186.  
  187. #pragma dynamic 8192
  188. #pragma tabsize 0
  189. #define SLOTS 200
  190. #define MAX_PLAYERS_ 40
  191. #define COLOR_TEAMORANGE 0xFF990078
  192. #define COLOR_TEAMRED 0xAA33336E
  193. #define COLOR_TEAMBLUE 0x006BD774
  194. #define COLOR_TEAMYELLOW 0xFFFF0085
  195. #define COLOR_TEAMGREEN 0x33AA3372
  196. #define COLOR_DEADCONNECT 0x808080AA
  197. #define COLOR_LIGHTGREEN 0xAAD36B96
  198. #define COLOR_LIGHTBLUE 0x46C2FF96
  199. #define COLOR_BROWN 0xBAAA5096
  200. #define COLOR_ERROR 0xD2691EAA
  201. #define COLOR_CCTV 0x6D925C96
  202. #define COLOR_CUSTARD 0xF3D15C96
  203. #define COLOR_PINK 0xF94F9B96
  204.  
  205. new rannum;
  206. new rGun;
  207. new rAmmo;
  208. new Text:Forum2;
  209. new players = 0;
  210.  
  211. new gTeam[MAX_PLAYERS];
  212.  
  213. forward Players1();
  214. forward Float:GetDistanceBetweenPlayers(p1,p2);
  215. forward GMX();
  216. forward update_zones(playerid);
  217. forward AdvertMsg();
  218. forward RanNumTimer();
  219.  
  220.  
  221. new AdvertMessage[13][100] = // [5] = amount of messages, [100] = amount of characters to give
  222. {
  223. {"*>> ss"},
  224. {"*>> If you belive someone is hacking or breaking the rules. Use /report"},
  225. {"*>> s"},
  226. {"*>> s"},
  227. {"*>> s!"},
  228. {"*>> Need help? Ask the Admins!"},
  229. {"*>> Having fun here? Visit our forums s"},
  230. {"*>> s"},
  231. {"*>> Rule: Hacking / Cheating is not allowed and equals in a instant ban"},
  232. {"*>> Rule: Racial Comments against other users is a ban!"},
  233. {"*>> s"},
  234. {"*>> s"},
  235. {"*>> s."}
  236. };
  237.  
  238. // ZONES
  239. enum zoneinfo {
  240. zone_name[27],
  241. Float:zone_minx,
  242. Float:zone_miny,
  243. Float:zone_minz,
  244. Float:zone_maxx,
  245. Float:zone_maxy,
  246. Float:zone_maxz
  247. }
  248. new Float:zones[][zoneinfo] = {
  249. { "France", -1213.90, -2892.90, -242.90, 44.60, -768.00, 900.00},
  250. { "British", -2997.40, -2892.90, -242.90, -1213.90, -1115.50, 900.00}};
  251.  
  252.  
  253. new zoneupdates[MAX_PLAYERS_];
  254. new player_zone[MAX_PLAYERS_];
  255. new zoneupdate;
  256. public update_zones() {
  257. new line1[10];
  258. new line2[10];
  259.  
  260. for(new i=0; i<MAX_PLAYERS_; i++) {
  261. if(IsPlayerConnected(i) && zoneupdates[i] == 1) {
  262. if(IsPlayerInZone(i,player_zone[i])) { }
  263. else {
  264.  
  265. new player_zone_before;
  266. player_zone_before = player_zone[i];
  267. player_zone[i] = -1;
  268.  
  269.  
  270. for(new j=0; j<sizeof(zones);j++) {
  271. if(IsPlayerInZone(i,j) && player_zone[i] == -1) {
  272.  
  273. if(player_zone_before == -1) GameTextForPlayer(i,zones[j][zone_name],1500,1);
  274. else if(strcmp(zones[j][zone_name],zones[player_zone_before][zone_name],true) != 0) GameTextForPlayer(i,zones[j][zone_name],1500,1);
  275.  
  276. player_zone[i] = j;
  277. format(line1,10,"p%dzone",i);
  278. format(line2,10,"%d",j);
  279. PropertySet(line1,line2);
  280.  
  281.  
  282. }
  283. }
  284.  
  285.  
  286.  
  287. if(player_zone[i] == -1) player_zone[i] = player_zone_before;
  288. }
  289.  
  290.  
  291. }
  292. }
  293.  
  294. }
  295.  
  296. IsPlayerInZone(playerid, zoneid) {
  297. if(zoneid == -1) return 0;
  298. new Float:x, Float:y, Float:z;
  299. GetPlayerPos(playerid,x,y,z);
  300. if(x >= zones[zoneid][zone_minx] && x < zones[zoneid][zone_maxx]
  301. && y >= zones[zoneid][zone_miny] && y < zones[zoneid][zone_maxy]
  302. && z >= zones[zoneid][zone_minz] && z < zones[zoneid][zone_maxz]
  303. && z < 900.0) return 1;
  304. return 0;
  305. }
  306.  
  307.  
  308. #if defined GAMEMODE
  309. #else
  310.  
  311. #endif
  312.  
  313.  
  314.  
  315.  
  316. //----------------------------------------------------------
  317. /*
  318. public OnPlayerConnect(playerid)
  319. {
  320. GameTextForPlayer(playerid,"~w~Grand Larceny",3000,4);
  321. SendClientMessage(playerid,COLOR_WHITE,"Welcome to Grand Larceny");
  322.  
  323. // class selection init vars
  324. gPlayerCitySelection[playerid] = -1;
  325. gPlayerHasCitySelected[playerid] = 0;
  326. gPlayerLastCitySelectionTick[playerid] = GetTickCount();
  327.  
  328. //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
  329.  
  330. return 1;
  331. }
  332. */
  333. //----------------------------------------------------------
  334. /*
  335. public OnPlayerSpawn(playerid)
  336. {
  337. if(IsPlayerNPC(playerid)) return 1;
  338.  
  339. new randSpawn = 0;
  340.  
  341. SetPlayerInterior(playerid,0);
  342. TogglePlayerClock(playerid,0);
  343. ResetPlayerMoney(playerid);
  344. GivePlayerMoney(playerid, 30000);
  345.  
  346. // if they ever return to class selection make them city
  347. // select again first
  348. gPlayerHasCitySelected[playerid] = 0;
  349.  
  350. if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
  351. randSpawn = random(sizeof(gRandomSpawns_LosSantos));
  352. SetPlayerPos(playerid,
  353. gRandomSpawns_LosSantos[randSpawn][0],
  354. gRandomSpawns_LosSantos[randSpawn][1],
  355. gRandomSpawns_LosSantos[randSpawn][2]);
  356. SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]);
  357. }
  358. else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
  359. randSpawn = random(sizeof(gRandomSpawns_SanFierro));
  360. SetPlayerPos(playerid,
  361. gRandomSpawns_SanFierro[randSpawn][0],
  362. gRandomSpawns_SanFierro[randSpawn][1],
  363. gRandomSpawns_SanFierro[randSpawn][2]);
  364. SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]);
  365. }
  366. else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
  367. randSpawn = random(sizeof(gRandomSpawns_LasVenturas));
  368. SetPlayerPos(playerid,
  369. gRandomSpawns_LasVenturas[randSpawn][0],
  370. gRandomSpawns_LasVenturas[randSpawn][1],
  371. gRandomSpawns_LasVenturas[randSpawn][2]);
  372. SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]);
  373. }
  374.  
  375. //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER);
  376.  
  377. SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200);
  378. SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200);
  379. SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200);
  380. SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200);
  381. SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200);
  382. SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200);
  383. SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200);
  384. SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200);
  385. SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200);
  386. SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200);
  387. SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);
  388.  
  389. GivePlayerWeapon(playerid,WEAPON_COLT45,100);
  390. //GivePlayerWeapon(playerid,WEAPON_MP5,100);
  391. //TogglePlayerClock(playerid, 1);
  392.  
  393. return 1;
  394. }
  395. */
  396. //----------------------------------------------------------
  397. /*
  398. public OnPlayerDeath(playerid, killerid, reason)
  399. {
  400. new playercash;
  401.  
  402. if(killerid == INVALID_PLAYER_ID) {
  403. ResetPlayerMoney(playerid);
  404. } else {
  405. playercash = GetPlayerMoney(playerid);
  406. if(playercash > 0) {
  407. GivePlayerMoney(killerid, playercash);
  408. ResetPlayerMoney(playerid);
  409. }
  410. }
  411. return 1;
  412. }
  413. */
  414. //----------------------------------------------------------
  415.  
  416. ClassSel_SetupCharSelection(playerid)
  417. {
  418. if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
  419. SetPlayerInterior(playerid,11);
  420. SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
  421. SetPlayerFacingAngle(playerid,0.0);
  422. SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
  423. SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
  424. }
  425. else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
  426. SetPlayerInterior(playerid,3);
  427. SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516);
  428. SetPlayerFacingAngle(playerid,181.0);
  429. SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516);
  430. SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516);
  431. }
  432. else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
  433. SetPlayerInterior(playerid,3);
  434. SetPlayerPos(playerid,349.0453,193.2271,1014.1797);
  435. SetPlayerFacingAngle(playerid,286.25);
  436. SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875);
  437. SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797);
  438. }
  439.  
  440. }
  441.  
  442. //----------------------------------------------------------
  443. // Used to init textdraws of city names
  444.  
  445. ClassSel_InitCityNameText(Text:txtInit)
  446. {
  447. TextDrawUseBox(txtInit, 0);
  448. TextDrawLetterSize(txtInit,1.25,3.0);
  449. TextDrawFont(txtInit, 0);
  450. TextDrawSetShadow(txtInit,0);
  451. TextDrawSetOutline(txtInit,1);
  452. TextDrawColor(txtInit,0xEEEEEEFF);
  453. TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
  454. }
  455.  
  456. //----------------------------------------------------------
  457.  
  458. ClassSel_InitTextDraws()
  459. {
  460. // Init our observer helper text display
  461. txtLosSantos = TextDrawCreate(10.0, 380.0, "Los Santos");
  462. ClassSel_InitCityNameText(txtLosSantos);
  463. txtSanFierro = TextDrawCreate(10.0, 380.0, "San Fierro");
  464. ClassSel_InitCityNameText(txtSanFierro);
  465. txtLasVenturas = TextDrawCreate(10.0, 380.0, "Las Venturas");
  466. ClassSel_InitCityNameText(txtLasVenturas);
  467.  
  468. // Init our observer helper text display
  469. txtClassSelHelper = TextDrawCreate(10.0, 415.0,
  470. " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
  471. TextDrawUseBox(txtClassSelHelper, 1);
  472. TextDrawBoxColor(txtClassSelHelper,0x222222BB);
  473. TextDrawLetterSize(txtClassSelHelper,0.3,1.0);
  474. TextDrawTextSize(txtClassSelHelper,400.0,40.0);
  475. TextDrawFont(txtClassSelHelper, 2);
  476. TextDrawSetShadow(txtClassSelHelper,0);
  477. TextDrawSetOutline(txtClassSelHelper,1);
  478. TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
  479. TextDrawColor(txtClassSelHelper,0xFFFFFFFF);
  480. }
  481.  
  482. //----------------------------------------------------------
  483.  
  484. ClassSel_SetupSelectedCity(playerid)
  485. {
  486. if(gPlayerCitySelection[playerid] == -1) {
  487. gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
  488. }
  489.  
  490. if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
  491. SetPlayerInterior(playerid,0);
  492. SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
  493. SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
  494.  
  495. TextDrawShowForPlayer(playerid,txtLosSantos);
  496. TextDrawHideForPlayer(playerid,txtSanFierro);
  497. TextDrawHideForPlayer(playerid,txtLasVenturas);
  498. }
  499. else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
  500. SetPlayerInterior(playerid,0);
  501. SetPlayerCameraPos(playerid,-1300.8754,68.0546,129.4823);
  502. SetPlayerCameraLookAt(playerid,-1817.9412,769.3878,132.6589);
  503.  
  504. TextDrawHideForPlayer(playerid,txtLosSantos);
  505. TextDrawShowForPlayer(playerid,txtSanFierro);
  506. TextDrawHideForPlayer(playerid,txtLasVenturas);
  507. }
  508. else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
  509. SetPlayerInterior(playerid,0);
  510. SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390);
  511. SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275);
  512.  
  513. TextDrawHideForPlayer(playerid,txtLosSantos);
  514. TextDrawHideForPlayer(playerid,txtSanFierro);
  515. TextDrawShowForPlayer(playerid,txtLasVenturas);
  516. }
  517. }
  518.  
  519. //----------------------------------------------------------
  520.  
  521. ClassSel_SwitchToNextCity(playerid)
  522. {
  523. gPlayerCitySelection[playerid]++;
  524. if(gPlayerCitySelection[playerid] > CITY_LAS_VENTURAS) {
  525. gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
  526. }
  527. PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
  528. gPlayerLastCitySelectionTick[playerid] = GetTickCount();
  529. ClassSel_SetupSelectedCity(playerid);
  530. }
  531.  
  532. //----------------------------------------------------------
  533.  
  534. ClassSel_SwitchToPreviousCity(playerid)
  535. {
  536. gPlayerCitySelection[playerid]--;
  537. if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) {
  538. gPlayerCitySelection[playerid] = CITY_LAS_VENTURAS;
  539. }
  540. PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
  541. gPlayerLastCitySelectionTick[playerid] = GetTickCount();
  542. ClassSel_SetupSelectedCity(playerid);
  543. }
  544.  
  545. //----------------------------------------------------------
  546.  
  547. ClassSel_HandleCitySelection(playerid)
  548. {
  549. new Keys,ud,lr;
  550. GetPlayerKeys(playerid,Keys,ud,lr);
  551.  
  552. if(gPlayerCitySelection[playerid] == -1) {
  553. ClassSel_SwitchToNextCity(playerid);
  554. return;
  555. }
  556.  
  557. // only allow new selection every ~500 ms
  558. if( (GetTickCount() - gPlayerLastCitySelectionTick[playerid]) < 500 ) return;
  559.  
  560. if(Keys & KEY_FIRE) {
  561. gPlayerHasCitySelected[playerid] = 1;
  562. TextDrawHideForPlayer(playerid,txtClassSelHelper);
  563. TextDrawHideForPlayer(playerid,txtLosSantos);
  564. TextDrawHideForPlayer(playerid,txtSanFierro);
  565. TextDrawHideForPlayer(playerid,txtLasVenturas);
  566. TogglePlayerSpectating(playerid,0);
  567. return;
  568. }
  569.  
  570. if(lr > 0) {
  571. ClassSel_SwitchToNextCity(playerid);
  572. }
  573. else if(lr < 0) {
  574. ClassSel_SwitchToPreviousCity(playerid);
  575. }
  576. }
  577.  
  578. //----------------------------------------------------------
  579. /*
  580. public OnPlayerRequestClass(playerid, classid)
  581. {
  582. if(IsPlayerNPC(playerid)) return 1;
  583.  
  584. if(gPlayerHasCitySelected[playerid]) {
  585. ClassSel_SetupCharSelection(playerid);
  586. return 1;
  587. } else {
  588. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
  589. TogglePlayerSpectating(playerid,1);
  590. TextDrawShowForPlayer(playerid, txtClassSelHelper);
  591. gPlayerCitySelection[playerid] = -1;
  592. }
  593. }
  594.  
  595. return 0;
  596. }
  597. */
  598. //----------------------------------------------------------
  599. /*
  600. public OnGameModeInit()
  601. {
  602.  
  603.  
  604. ShowNameTags(1);
  605. SetNameTagDrawDistance(40.0);
  606. EnableStuntBonusForAll(0);
  607. DisableInteriorEnterExits();
  608. SetWeather(2);
  609.  
  610. //LimitGlobalChatRadius(300.0);
  611.  
  612. ClassSel_InitTextDraws();
  613.  
  614. // Player Class
  615.  
  616.  
  617.  
  618.  
  619. return 1;
  620. }*/
  621.  
  622. //----------------------------------------------------------
  623. /*
  624. public OnPlayerUpdate(playerid)
  625. {
  626. if(!IsPlayerConnected(playerid)) return 0;
  627.  
  628. // changing cities by inputs
  629. if( !gPlayerHasCitySelected[playerid] &&
  630. GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
  631. ClassSel_HandleCitySelection(playerid);
  632. return 1;
  633. }
  634.  
  635. // No weapons in interiors
  636. if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
  637. SetPlayerArmedWeapon(playerid,0); // fists
  638. return 0; // no syncing until they change their weapon
  639. }
  640.  
  641. // Don't allow minigun
  642. if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) {
  643. Kick(playerid);
  644. return 0;
  645. }
  646.  
  647. // No jetpacks allowed
  648. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
  649. Kick(playerid);
  650. return 0;
  651. }
  652.  
  653. return 1;
  654. }*/
  655.  
  656. public OnVehicleSpawn(vehicleid)
  657. {
  658. tAxI_OnVehicleSpawn(vehicleid);
  659. return 1;
  660. }
  661.  
  662. public OnVehicleDeath(vehicleid, killerid)
  663. {
  664. tAxI_OnVehicleDeath(vehicleid);
  665. return 1;
  666. }
  667.  
  668. public Players1()
  669. {
  670. for(new x; x < GetMaxPlayers(); x++)
  671. {
  672. if(IsPlayerConnected(x))
  673. {
  674. new string[128];
  675. format(string,sizeof(string),"",players,GetMaxPlayers());
  676. TextDrawSetString(Forum2,string);
  677. TextDrawShowForPlayer(x,Forum2);
  678. }
  679. }
  680. }
  681.  
  682. stock CheckPing(playerid)
  683. {
  684. new ping = GetPlayerPing(playerid);
  685. if(ping > 750)
  686. {
  687. Kick(playerid);
  688. SendClientMessage(playerid,COLOR_PINK, "*[Kick] You have been kicked because your ping exeeds the limit of [750] (Kick To Prevent Lag)");
  689. }
  690. }
  691.  
  692. public GMX()
  693. {
  694. SendRconCommand("gmx");
  695. return 1;
  696. }
  697.  
  698.  
  699. public OnPlayerText(playerid, text[])
  700. {
  701. if(rannum > 0)
  702. {
  703. if(strval(text) == rannum) // or you can use strcmp i guess
  704. {
  705. new name[MAX_PLAYER_NAME], string[128];
  706. new weaponName[65];
  707. new weapon = GetWeaponName(rGun, weaponName, 64);
  708. GetPlayerName(playerid, name, sizeof(name));
  709. format(string, sizeof(string), "Congratulations %s for winning a %s in the reaction test!", name,weapon);
  710. SendClientMessageToAll(COLOR_TEAMYELLOW, string);
  711. GivePlayerWeapon(playerid, rGun, 100);
  712. SetPlayerAmmo(playerid,rGun,rAmmo);
  713. rannum = 0;
  714.  
  715.  
  716. return 0;
  717. }
  718. }
  719.  
  720. if(text[0] == '*' && IsPlayerAdmin(playerid)) //This will only work for RCON admins
  721. {
  722. GameTextForAll(text[1], 5000, 0);
  723. return false;
  724. }
  725. if(text[0] == '!')
  726. {
  727. new string[128]; GetPlayerName(playerid, string, sizeof(string));
  728. format(string, sizeof(string), "[*May Day!] %s: %s", string, text[1]);
  729. printf("%s", string);
  730.  
  731. if(gTeam[playerid] == FRANCE_GENERAL || gTeam[playerid] == FRANCE_SOLDIER || gTeam[playerid] == FRANCE_MEDIC)
  732. {
  733. for(new i; i<MAX_PLAYERS; i++)
  734. {
  735. if(IsPlayerConnected(i))
  736. {
  737. if(gTeam[i] == FRANCE_GENERAL || gTeam[i] == FRANCE_SOLDIER || gTeam[i] == FRANCE_MEDIC)
  738. {
  739. SendClientMessage(i,COLOR_GREEN, string);
  740. }
  741. }
  742. }
  743. }
  744.  
  745. if(gTeam[playerid] == BRITISH_GENERAL || gTeam[playerid] == BRITISH_SOLDIER || gTeam[playerid] == BRITISH_MEDIC)
  746. {
  747. for(new i; i<MAX_PLAYERS; i++)
  748. {
  749. if(IsPlayerConnected(i))
  750. {
  751. if(gTeam[i] == BRITISH_GENERAL || gTeam[i] == BRITISH_SOLDIER || gTeam[i] == BRITISH_MEDIC)
  752. {
  753. SendClientMessage(i,COLOR_GREEN, string);
  754. }
  755. }
  756. }
  757. }
  758. return 0;
  759. }
  760. return 1;
  761. }
  762.  
  763.  
  764. public Float:GetDistanceBetweenPlayers(p1,p2){
  765. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  766. if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
  767. return -1.00;
  768. }
  769. GetPlayerPos(p1,x1,y1,z1);
  770. GetPlayerPos(p2,x2,y2,z2);
  771. return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  772. }
  773.  
  774.  
  775. public AdvertMsg() return SendClientMessageToAll(COLOR_LIGHTBLUE, AdvertMessage[random(sizeof(AdvertMessage))][0]);
  776.  
  777. randarg(...) { return getarg(random(numargs())); }
  778.  
  779. public RanNumTimer()
  780. {
  781. new string[128];
  782. rannum = random(999999) + 100000;
  783.  
  784. rGun=randarg(14, 16, 24, 26, 27, 34, 35, 37, 38, 42);
  785.  
  786. rAmmo= random(150);
  787.  
  788. new weaponName[65];
  789. new weapon = GetWeaponName(rGun, weaponName, 64);
  790.  
  791. format(string, sizeof(string), "Are you fast?! First to type %d wins %s with %d ammo", rannum,weapon,rAmmo);
  792. SendClientMessageToAll(COLOR_TEAMYELLOW, string);
  793. }
  794.  
  795.  
  796.  
  797. main()
  798. {
  799. print("|_______________________________|");
  800. print(" lol server");
  801. print("|_______________________________|");
  802. }
  803.  
  804. public OnGameModeInit()
  805. {
  806. SetTimer("ArmyTimer", 8000, 1);
  807. tAxI_OnGameModeInit();
  808. AllowInteriorWeapons(1);
  809. UsePlayerPedAnims();
  810. ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
  811. ShowNameTags(1);
  812. SetNameTagDrawDistance(40.0);
  813. EnableStuntBonusForAll(0);
  814. DisableInteriorEnterExits();
  815. SetWeather(2);
  816.  
  817. //LimitGlobalChatRadius(300.0);
  818.  
  819. ClassSel_InitTextDraws();
  820. SetGameModeText("lol");
  821.  
  822.  
  823. //================================== [0 British General ] ===================================================================
  824. AddPlayerClass(68,1787.853,-1365.913,15.75781,90, 7, 500, 33, 250, 24, 250);
  825. //================================== [1 British sodlier] ====================================================================
  826. AddPlayerClass(61,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
  827. //================================== [2 British medic] ====================================================================
  828. AddPlayerClass(287,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
  829. //================================== [3 France general ] ===================================================================
  830. AddPlayerClass(68,1787.853,-1365.913,15.75781,90, 7, 500, 33, 250, 24, 250);
  831. //================================== [4 France soldier] ====================================================================
  832. AddPlayerClass(61,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
  833. //================================== [5 France medic] ====================================================================
  834. AddPlayerClass(287,863.4913,-1638.3412,14.9521,176.9822, 8, 500, 33, 25, 32, 250);
  835.  
  836.  
  837. return 1;
  838. }
  839.  
  840.  
  841. public OnPlayerUpdate(playerid)
  842. {
  843. if(!IsPlayerConnected(playerid)) return 0;
  844. // changing cities by inputs
  845. if( !gPlayerHasCitySelected[playerid] &&
  846. GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
  847. ClassSel_HandleCitySelection(playerid);
  848. return 1;
  849. }
  850.  
  851. // No weapons in interiors
  852. if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
  853. SetPlayerArmedWeapon(playerid,0); // fists
  854. return 0; // no syncing until they change their weapon
  855. }
  856.  
  857. // Don't allow minigun
  858. if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) {
  859. Kick(playerid);
  860. return 0;
  861. }
  862.  
  863. // No jetpacks allowed
  864. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
  865. Kick(playerid);
  866. return 0;
  867. }
  868.  
  869. return 1;
  870. }
  871.  
  872. public OnPlayerRequestClass(playerid, classid)
  873. {
  874. if(IsPlayerNPC(playerid)) return 1;
  875.  
  876. if(gPlayerHasCitySelected[playerid]) {
  877. ClassSel_SetupCharSelection(playerid);
  878. return 1;
  879. } else {
  880. if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) {
  881. TogglePlayerSpectating(playerid,1);
  882. TextDrawShowForPlayer(playerid, txtClassSelHelper);
  883. gPlayerCitySelection[playerid] = -1;
  884. }
  885. }
  886.  
  887. gPlayerClass[playerid] = classid;
  888. switch (classid) {
  889. case 0:
  890. {
  891. GameTextForPlayer(playerid, "~w~General", 500, 6);
  892. {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
  893. SetPlayerFacingAngle(playerid, 357.3909);
  894. SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
  895. SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
  896. gTeam[playerid] = BRITISH_GENERAL;
  897. CreateExplosion(354.4405,2030.4860,23.8750, 12, 2); }
  898. }
  899. case 1:
  900. {
  901. GameTextForPlayer(playerid, "~w~Soldier", 500, 6);
  902. {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
  903. SetPlayerFacingAngle(playerid, 357.3909);
  904. SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
  905. SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
  906. gTeam[playerid] = BRITISH_SOLDIER;
  907. CreateExplosion(354.4405,2030.4860,23.8750, 12, 2);}
  908.  
  909. }
  910. case 2:
  911. {
  912. GameTextForPlayer(playerid, "~w~British Army Soldier", 500, 6);
  913. {SetPlayerPos(playerid,354.4405,2030.4860,23.8750);
  914. SetPlayerFacingAngle(playerid, 357.3909);
  915. SetPlayerCameraPos(playerid, 354.4252,2032.4153,24.0223);
  916. SetPlayerCameraLookAt(playerid, 354.4405,2030.4860,23.8750);
  917. gTeam[playerid] = BRITISH_MEDIC;
  918. CreateExplosion(354.4405,2030.4860,23.8750, 12, 2); }
  919. }
  920. case 3:
  921. {
  922. GameTextForPlayer(playerid, "~b~general", 500, 6);
  923. {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
  924. SetPlayerFacingAngle(playerid, 298.3950);
  925. SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
  926. SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
  927. gTeam[playerid] = FRANCE_GENERAL;
  928. CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
  929. }
  930. case 4:
  931. {
  932. GameTextForPlayer(playerid, "~b~Soldier", 500, 6);
  933. {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
  934. SetPlayerFacingAngle(playerid, 298.3950);
  935. SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
  936. SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
  937. gTeam[playerid] = FRANCE_SOLDIER;
  938. CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
  939. }
  940. case 5:
  941. {
  942. GameTextForPlayer(playerid, "~b~medic", 500, 6);
  943. {SetPlayerPos(playerid, 358.4248,2434.5625,17.0588);
  944. SetPlayerFacingAngle(playerid, 298.3950);
  945. SetPlayerCameraPos(playerid, 361.6220,2436.0774,16.7443);
  946. SetPlayerCameraLookAt(playerid, 358.4248,2434.5625,17.0588);
  947. gTeam[playerid] = FRANCE_MEDIC;
  948. CreateExplosion(358.4248,2434.5625,17.0588, 12, 2); }
  949. }
  950.  
  951.  
  952. }
  953. return 1;
  954. }
  955. public OnPlayerConnect(playerid)
  956. {
  957. gPlayerCitySelection[playerid] = -1;
  958. gPlayerHasCitySelected[playerid] = 0;
  959. gPlayerLastCitySelectionTick[playerid] = GetTickCount();
  960.  
  961.  
  962. new Pname[24];
  963. SetPlayerColor(playerid,COLOR_DEADCONNECT);
  964. players++;
  965. zoneupdates[playerid] = 0;
  966. player_zone[playerid] = -1;
  967. GetPlayerName(playerid, Pname, 24);
  968. new plname[MAX_PLAYER_NAME];
  969. new playername4[MAX_PLAYER_NAME];
  970. new string[160];
  971. SendClientMessage(playerid, LIGHTBLUE, "|| Welcome ! ||");
  972. SendClientMessage(playerid,COLOR_BRIGHTRED, "|| Hacking/Cheating , Glitching , and ect aren't allowed here ||");
  973. SendClientMessage(playerid,COLOR_BRIGHTRED, "|| If doing so , it will result as ban or kick . ||");
  974. SendClientMessage(playerid, LIGHTBLUE, "|| /cmds to view commands to use. ||");
  975. TextDrawShowForPlayer(playerid, CreatorTextDraw );
  976. GameTextForPlayer(playerid,"~g~Welcome",4500,1);
  977. GetPlayerName(playerid, playername4, sizeof(playername4));
  978. format(string, sizeof(string), "*[JOINED] %s ", playername4);
  979. SendClientMessageToAll(COLOR_YELLOW, string);
  980. gPlayerAccount[playerid] = 0;
  981. PlayerInfo[playerid][pJoins] += 1;
  982. GetPlayerName(playerid, plname, sizeof(plname));
  983. format(string, sizeof(string), "%s.ini", plname);
  984. if(fexist(string))
  985. {
  986. gPlayerAccount[playerid] = 1;
  987. new loginstring[128];
  988. new loginname[64];
  989. GetPlayerName(playerid,loginname,sizeof(loginname));
  990. format(loginstring,sizeof(loginstring),"Welcome. \n \nThat name is registered. please enter your password below:");
  991. ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
  992. }
  993. else
  994. {
  995. gPlayerAccount[playerid] = 0;
  996. new regstring[128];
  997. new regname[64];
  998. GetPlayerName(playerid,regname,sizeof(regname));
  999. format(regstring,sizeof(regstring),"Welcome. \n \nPlease register your account by typing the password below:");
  1000. ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
  1001. }
  1002. return 1;
  1003. }
  1004.  
  1005. public OnPlayerDisconnect(playerid, reason)
  1006. {
  1007. players--;
  1008. zoneupdates[playerid] = 0;
  1009. player_zone[playerid] = -1;
  1010. SetPlayerColor(playerid,COLOR_DEADCONNECT);
  1011.  
  1012. SaveStats(playerid);
  1013. new playername4[MAX_PLAYER_NAME];
  1014. GetPlayerName(playerid, playername4, sizeof(playername4));
  1015. new pName[MAX_PLAYER_NAME], string[128];
  1016. GetPlayerName(playerid, pName, sizeof(pName));
  1017. // format(string, sizeof(string), "%s has left the server.", pName);
  1018. SendClientMessageToAll(0xA9A9A9AA, string);
  1019. SendDeathMessage(playerid, playerid, 201);
  1020.  
  1021. return 1;
  1022.  
  1023. }
  1024.  
  1025. public OnPlayerSpawn(playerid)
  1026. {
  1027. if(IsPlayerNPC(playerid)) return 1;
  1028.  
  1029. // new randSpawn = 0;
  1030.  
  1031. SetPlayerInterior(playerid,0);
  1032. TogglePlayerClock(playerid,0);
  1033. ResetPlayerMoney(playerid);
  1034. GivePlayerMoney(playerid, 30000);
  1035.  
  1036. // if they ever return to class selection make them city
  1037. // select again first
  1038. gPlayerHasCitySelected[playerid] = 0;
  1039. /*
  1040. if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) {
  1041. i dont remember waht was here
  1042. }
  1043. else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) {
  1044. i dont know what was here
  1045. }
  1046. else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) {
  1047. i dont know hwat was here
  1048. }
  1049. */
  1050.  
  1051. GameTextForPlayer(playerid, " ", 10, 3);
  1052. zoneupdates[playerid] = 1;
  1053. player_zone[playerid] = -1;
  1054. if(!zoneupdate) zoneupdate = SetTimer("update_zones",1000,4);
  1055. SetPlayerWeather(playerid, 9);
  1056.  
  1057.  
  1058. switch(gTeam[playerid])
  1059. {
  1060.  
  1061. case FRANCE_GENERAL:
  1062. {
  1063. GivePlayerWeapon(playerid, 25, 5000);
  1064. GivePlayerWeapon(playerid, 15, 60);
  1065. GivePlayerWeapon(playerid, 7, 1);
  1066. }
  1067. case FRANCE_SOLDIER:
  1068. {
  1069. GivePlayerWeapon(playerid, 24, 5000);
  1070. GivePlayerWeapon(playerid, 27, 160);
  1071. GivePlayerWeapon(playerid, 7, 301);
  1072. }
  1073. case FRANCE_MEDIC:
  1074. {
  1075. GivePlayerWeapon(playerid, 22, 5000);
  1076. GivePlayerWeapon(playerid, 39, 160);
  1077. GivePlayerWeapon(playerid, 33, 301);
  1078. GivePlayerWeapon(playerid, 16, 150);
  1079. }
  1080.  
  1081. case BRITISH_GENERAL:
  1082. {
  1083. GivePlayerWeapon(playerid, 25, 5000);
  1084. GivePlayerWeapon(playerid, 15, 60);
  1085. GivePlayerWeapon(playerid, 7, 1);
  1086. }
  1087. case BRITISH_SOLDIER:
  1088. {
  1089. GivePlayerWeapon(playerid, 24, 5000);
  1090. GivePlayerWeapon(playerid, 27, 160);
  1091. GivePlayerWeapon(playerid, 7, 301);
  1092. }
  1093. case BRITISH_MEDIC:
  1094. {
  1095. GivePlayerWeapon(playerid, 22, 5000);
  1096. GivePlayerWeapon(playerid, 39, 160);
  1097. GivePlayerWeapon(playerid, 33, 301);
  1098. GivePlayerWeapon(playerid, 16, 150);
  1099. }
  1100.  
  1101. }
  1102. return 0;
  1103. }
  1104.  
  1105. public OnPlayerDeath(playerid, killerid, reason)
  1106. {
  1107.  
  1108. new playercash;
  1109. if(killerid == INVALID_PLAYER_ID) {
  1110. ResetPlayerMoney(playerid);
  1111. } else {
  1112. playercash = GetPlayerMoney(playerid);
  1113. if(playercash > 0) {
  1114. GivePlayerMoney(killerid, playercash);
  1115. ResetPlayerMoney(playerid);
  1116. }
  1117. }
  1118.  
  1119. GetPlayerScore(killerid,1);
  1120. GetPlayerScore(playerid,-1);
  1121. zoneupdates[playerid] = 0;
  1122. player_zone[playerid] = -1;
  1123. SendDeathMessage(killerid, playerid, reason);
  1124. zoneupdates[playerid] = 0;
  1125. player_zone[playerid] = -1;
  1126.  
  1127. return 0;
  1128. }
  1129.  
  1130.  
  1131. public OnPlayerCommandText(playerid, cmdtext[])
  1132. {
  1133. new cmd[256];
  1134.  
  1135. if (strcmp(cmd, "/stats", true) == 0)
  1136. {
  1137. if(IsPlayerConnected(playerid))
  1138. {
  1139. Stats(playerid,playerid);
  1140. }
  1141. return 1;
  1142. }
  1143. if (strcmp("/fstyle", cmdtext, true, 10) == 0)
  1144. {
  1145. if(IsPlayerConnected(playerid))
  1146. {
  1147. ShowPlayerDialog(playerid, FIGHTMENU, DIALOG_STYLE_LIST, "Learn new Moves", "Boxing\nElbow\nKneehead\nKung-Fu\nGrabKick\nNormal", "Learn", "Nevermind");
  1148. }
  1149. return 1;
  1150. }
  1151. //-------------------------------[Stats]--------------------------------------------------------------------------
  1152.  
  1153. return 0;
  1154. }
  1155. public OnPlayerLogin(playerid,password[])
  1156. {
  1157. new string2[64];
  1158. new playername2[MAX_PLAYER_NAME];
  1159. GetPlayerName(playerid, playername2, sizeof(playername2));
  1160. format(string2, sizeof(string2), "%s.ini", playername2);
  1161. new File: UserFile = fopen(string2, io_read);
  1162. if ( UserFile )
  1163. {
  1164. new PassData[256];
  1165. new keytmp[256], valtmp[256];
  1166. fread( UserFile , PassData , sizeof( PassData ) );
  1167. keytmp = ini_GetKey( PassData );
  1168. if( strcmp( keytmp , "Key" , true ) == 0 )
  1169. {
  1170. valtmp = ini_GetValue( PassData );
  1171. strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
  1172. }
  1173. if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
  1174. {
  1175. new key[ 256 ] , val[ 256 ];
  1176. new Data[ 256 ];
  1177. while ( fread( UserFile , Data , sizeof( Data ) ) )
  1178. {
  1179. key = ini_GetKey( Data );
  1180. if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
  1181. if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
  1182. if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
  1183. if( strcmp( key , "Joins" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJoins] = strval( val ); }
  1184. }//end while
  1185. fclose(UserFile);//close the file after everything has been read in the while
  1186. }
  1187. }
  1188. return 1;
  1189. }
  1190.  
  1191.  
  1192. public OnPlayerRegister(playerid, password[])
  1193. {
  1194. if(IsPlayerConnected(playerid))
  1195. {
  1196. new string3[32];
  1197. new var[32];
  1198. new playername3[MAX_PLAYER_NAME];
  1199. GetPlayerName(playerid, playername3, sizeof(playername3));
  1200. format(string3, sizeof(string3), "%s.ini", playername3);
  1201. new File: hFile = fopen(string3, io_write);
  1202. if (hFile)
  1203. {
  1204. format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
  1205. format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
  1206. format(var, 32, "Team=%d\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
  1207. format(var, 32, "Joins=%d\n",PlayerInfo[playerid][pJoins]);fwrite(hFile, var);
  1208. fclose(hFile);
  1209. new loginstring[128];
  1210. new loginname[64];
  1211. GetPlayerName(playerid,loginname,sizeof(loginname));
  1212. format(loginstring,sizeof(loginstring),"Welcome back to San Andreas War. \n \nThat name is in use. Please enter your password",loginname);
  1213. ShowPlayerDialog(playerid,LOGINMENU,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
  1214. }
  1215. }
  1216. return 1;
  1217. }
  1218.  
  1219. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  1220. {
  1221. tAxI_OnPlayerEnterVehicle(playerid,vehicleid);
  1222. new
  1223. vehid,
  1224. string[64];
  1225. vehid = GetVehicleModel(vehicleid);
  1226. format(string, 100, "Entering %s" ,VehicleNames[vehid - 400]);
  1227. SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
  1228. return 1;
  1229. }
  1230. forward DontCarJack(playerid,jackedplayer, vehicleid);
  1231. public DontCarJack(playerid, jackedplayer, vehicleid)
  1232. {
  1233. if(! (IsPlayerInAnyVehicle(jackedplayer)) ) PutPlayerInVehicle(jackedplayer,vehicleid,0);
  1234. SetTimerEx("DontCarJack2",2000,false,"iii",playerid,jackedplayer,vehicleid);
  1235. }
  1236.  
  1237. forward DontCarJack2(playerid,jackedplayer, vehicleid);
  1238. public DontCarJack2(playerid, jackedplayer, vehicleid)
  1239. {
  1240. if(! (IsPlayerInAnyVehicle(jackedplayer)) ) PutPlayerInVehicle(jackedplayer,vehicleid,0);
  1241. TogglePlayerControllable(playerid, true);
  1242. }
  1243. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1244. {
  1245. new sendername[MAX_PLAYER_NAME];
  1246. new string[256];
  1247. if(dialogid == FIGHTMENU)
  1248. {
  1249. if(response)
  1250. {
  1251. if(listitem == 0)
  1252. {
  1253. SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
  1254. SendClientMessage(playerid, GREEN, " Fighting style now boxing !");
  1255. }
  1256. if(listitem == 1)
  1257. {
  1258. SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
  1259. SendClientMessage(playerid, GREEN, " Fighting style now elbow !");
  1260. }
  1261. if(listitem == 2)
  1262. {
  1263. SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
  1264. SendClientMessage(playerid, GREEN, " Fighting style now kneehead !");
  1265. }
  1266. if(listitem == 3)
  1267. {
  1268. SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
  1269. SendClientMessage(playerid, GREEN, " Fighting style now kung-fu !");
  1270. }
  1271. if(listitem == 4)
  1272. {
  1273. SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
  1274. SendClientMessage(playerid, GREEN, " Fighting style now grabkick !");
  1275. }
  1276. if(listitem == 5)
  1277. {
  1278. SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
  1279. SendClientMessage(playerid, GREEN, " Fighting style now back to normal !");
  1280. }
  1281. }
  1282. }
  1283. if(response)
  1284. {
  1285. if(dialogid == LOGINMENU || dialogid == 12347)
  1286. {
  1287. if(strlen(inputtext))
  1288. {
  1289. new tmppass[64];
  1290. strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
  1291. Encrypt(tmppass);
  1292. }
  1293. else
  1294. {
  1295. new loginstring[128];
  1296. new loginname[64];
  1297. GetPlayerName(playerid,loginname,sizeof(loginname));
  1298. format(loginstring,sizeof(loginstring),"ERROR: Incorrect password!\n \nPlease enter the correct password:",loginname);
  1299. ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
  1300. }
  1301. }
  1302. if(dialogid == 2)
  1303. {
  1304. if(strlen(inputtext))
  1305. {
  1306. GetPlayerName(playerid, sendername, sizeof(sendername));
  1307. format(string, sizeof(string), "%s.ini", sendername);
  1308. new File: hFile = fopen(string, io_read);
  1309. if (hFile)
  1310. {
  1311. SendClientMessage(playerid, RED, "That Username is already taken, please choose a different one.");
  1312. fclose(hFile);
  1313. return 1;
  1314. }
  1315. new tmppass[64];
  1316. strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
  1317. Encrypt(tmppass);
  1318. OnPlayerRegister(playerid,tmppass);
  1319. }
  1320. else
  1321. {
  1322. new regstring[128];
  1323. new regname[64];
  1324. GetPlayerName(playerid,regname,sizeof(regname));
  1325. format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
  1326. ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
  1327. }
  1328. }
  1329. }
  1330. return 1;
  1331. }
  1332.  
  1333. public OnPlayerRequestSpawn(playerid)
  1334. {
  1335. return 1;
  1336. }
  1337.  
  1338.  
  1339.  
  1340. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  1341. {
  1342. if(IsPlayerConnected(playerid))
  1343. {
  1344. new Float:oldposx, Float:oldposy, Float:oldposz;
  1345. new Float:tempposx, Float:tempposy, Float:tempposz;
  1346. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1347. tempposx = (oldposx -x);
  1348. tempposy = (oldposy -y);
  1349. tempposz = (oldposz -z);
  1350. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  1351. {
  1352. return 1;
  1353. }
  1354. }
  1355. return 0;
  1356. }
  1357.  
  1358. public OnGameModeExit()
  1359. {
  1360. print("\n~=~=~=~=~=~=~=~=~=~=~=~=~=~=~~=~=~=");
  1361. print(" .: wdawdaw \n");
  1362. print(" .: awdawda :.\n");
  1363. print(" .: dawdawd :.\n");
  1364. print("~=~=~=~=~=~=~=~=~=~=~=~=~=~=~~=~=~=\n");
  1365. return 1;
  1366. }
  1367. public Encrypt(string[])
  1368. {
  1369. for(new x=0; x < strlen(string); x++)
  1370. {
  1371. string[x] += (3^x) * (x % 15);
  1372. if(string[x] > (0xff))
  1373. {
  1374. string[x] -= 256;
  1375. }
  1376. }
  1377. return 1;
  1378. }
  1379. public Stats(playerid,targetid)
  1380. {
  1381. if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
  1382. {
  1383. new deaths = PlayerInfo[targetid][pDeaths];
  1384. new kills = PlayerInfo[targetid][pKills];
  1385. new team = PlayerInfo[targetid][pTeam];
  1386. new joins = PlayerInfo[targetid][pJoins];
  1387. new name[MAX_PLAYER_NAME];
  1388. GetPlayerName(targetid, name, sizeof(name));
  1389. new Float:px,Float:py,Float:pz;
  1390. GetPlayerPos(targetid, px, py, pz);
  1391. new coordsstring[256];
  1392. SendClientMessage(playerid, LIGHTBLUE,"||-----PLAYER STATS--------||");
  1393. format(coordsstring, sizeof(coordsstring),"- Player Name: %s -",name);
  1394. SendClientMessage(playerid, ORANGE,coordsstring);
  1395. format(coordsstring, sizeof(coordsstring), "Info: Kills:[%d] || Deaths:[%d]", kills,deaths);
  1396. SendClientMessage(playerid, ORANGE,coordsstring);
  1397. format(coordsstring, sizeof(coordsstring), "Info: Team:[%s] || Joins:[%d]", team,joins);
  1398. SendClientMessage(playerid, ORANGE,coordsstring);
  1399. SendClientMessage(playerid, LIGHTBLUE,"||-------------------------||");
  1400. }
  1401. }
  1402. stock PlayerName(playerid)
  1403. {
  1404. new name[255];
  1405. GetPlayerName(playerid, name, 255);
  1406. return name;
  1407. }
  1408. public SaveStats(playerid)
  1409. {
  1410. if(IsPlayerConnected(playerid))
  1411. {
  1412. new string3[128];
  1413. format(string3, sizeof(string3), "%s.ini", PlayerName(playerid));
  1414. new File: hFile = fopen(string3, io_write);
  1415. if (hFile)
  1416. {
  1417. new var[32];
  1418. format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
  1419. format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
  1420. format(var, 32, "Team=%s\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
  1421. format(var, 32, "Joins=%d\n",PlayerInfo[playerid][pJoins]);fwrite(hFile, var);
  1422. fclose(hFile);
  1423. }
  1424. }
  1425. return 1;
  1426. }
  1427. stock ini_GetKey( line[] )
  1428. {
  1429. new keyRes[256];
  1430. keyRes[0] = 0;
  1431. if ( strfind( line , "=" , true ) == -1 ) return keyRes;
  1432. strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
  1433. return keyRes;
  1434. }
  1435. stock ini_GetValue( line[] )
  1436. {
  1437. new valRes[256];
  1438. valRes[0]=0;
  1439. if ( strfind( line , "=" , true ) == -1 ) return valRes;
  1440. strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
  1441. return valRes;
  1442. }
Advertisement
Add Comment
Please, Sign In to add comment