SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2108 lines
58 KiB

  1. /* SA:MP PAWN Debug -
  2. * Debugging filterscript used
  3. * for creation of gamemode.
  4. *
  5. * Simon Campbell
  6. * 10/03/2007, 6:31pm
  7. *
  8. * 17/11/2011
  9. * Updated to 0.5d which supports SA:MP 0.3d
  10. */
  11. //==============================================================================
  12. #include <a_samp>
  13. #undef KEY_UP
  14. #undef KEY_DOWN
  15. #undef KEY_LEFT
  16. #undef KEY_RIGHT
  17. #define KEY_UP 65408
  18. #define KEY_DOWN 128
  19. #define KEY_LEFT 65408
  20. #define KEY_RIGHT 128
  21. #define DEBUG_VERSION "0.5d"
  22. #define SKIN_SELECT true
  23. #define VEHI_SELECT true
  24. #define WORL_SELECT true
  25. #define CAME_SELECT true
  26. #define OBJE_SELECT true
  27. #define MISCEL_CMDS true
  28. #define ADMINS_ONLY false
  29. #define SKIN_SEL_STAT 1
  30. #define VEHI_SEL_STAT 2
  31. #define WORL_SEL_STAT 3
  32. #define CAME_SEL_STAT 4
  33. #define OBJE_SEL_STAT 5
  34. #define COLOR_RED 0xFF4040FF
  35. #define COLOR_GREEN 0x40FF40FF
  36. #define COLOR_BLUE 0x4040FFFF
  37. #define COLOR_CYAN 0x40FFFFFF
  38. #define COLOR_PINK 0xFF40FFFF
  39. #define COLOR_YELLOW 0xFFFF40FF
  40. #define COLOR_WHITE 0xFFFFFFFF
  41. #define COLOR_BLACK 0x000000FF
  42. #define COLOR_NONE 0x00000000
  43. #define MIN_SKIN_ID 0
  44. #define MAX_SKIN_ID 299
  45. #define MIN_VEHI_ID 400
  46. #define MAX_VEHI_ID 611
  47. #define MIN_TIME_ID 0
  48. #define MAX_TIME_ID 23
  49. #define MIN_WEAT_ID 0
  50. #define MAX_WEAT_ID 45
  51. #define MIN_OBJE_ID 615
  52. #define MAX_OBJE_ID 13563
  53. #define DEFAULT_GRA 0.008
  54. #define VEHI_DIS 5.0
  55. #define OBJE_DIS 10.0
  56. #define CMODE_A 0
  57. #define CMODE_B 1
  58. #define O_MODE_SELECTOR 0
  59. #define O_MODE_MOVER 1
  60. #define O_MODE_ROTATOR 2
  61. #define PI 3.14159265
  62. #define CAMERA_TIME 40
  63. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  64. //==============================================================================
  65. new gPlayerStatus[MAX_PLAYERS]; // Player Status
  66. new gPlayerTimers[MAX_PLAYERS]; // Player TimerID's for keypresses
  67. new gWorldStatus[3] = {12, 4}; // Time, Weather
  68. new curPlayerSkin[MAX_PLAYERS] = {MIN_SKIN_ID, ...}; // Current Player Skin ID
  69. new curPlayerVehM[MAX_PLAYERS] = {MIN_VEHI_ID, ...}; // Current Player Vehicle ID
  70. new curPlayerVehI[MAX_PLAYERS] = {-1, ...};
  71. enum E_OBJECT
  72. {
  73. OBJ_MOD,
  74. OBJ_MDL,
  75. Float:OBJ_X,
  76. Float:OBJ_Y,
  77. Float:OBJ_Z,
  78. Float:OBJ_RX,
  79. Float:OBJ_RY,
  80. Float:OBJ_RZ
  81. }
  82. enum E_OBJ_RATE
  83. {
  84. Float:OBJ_RATE_ROT,
  85. Float:OBJ_RATE_MOVE
  86. }
  87. new pObjectRate[ MAX_PLAYERS ][ E_OBJ_RATE ];
  88. new curPlayerObjM[ MAX_PLAYERS ][ E_OBJECT ];
  89. new curPlayerObjI[ MAX_PLAYERS ] = {-1, ...};
  90. enum P_CAMERA_D {
  91. CMODE,
  92. Float:RATE,
  93. Float:CPOS_X,
  94. Float:CPOS_Y,
  95. Float:CPOS_Z,
  96. Float:CLOO_X,
  97. Float:CLOO_Y,
  98. Float:CLOO_Z
  99. };
  100. new curPlayerCamD[MAX_PLAYERS][P_CAMERA_D];
  101. enum CURVEHICLE {
  102. bool:spawn,
  103. vmodel,
  104. vInt
  105. };
  106. new curServerVehP[MAX_VEHICLES][CURVEHICLE];
  107. new aSelNames[5][] = { // Menu selection names
  108. {"SkinSelect"},
  109. {"VehicleSelect"},
  110. {"WeatherSelect"},
  111. {"CameraSelect"},
  112. {"ObjectSelect"}
  113. };
  114. new aWeaponNames[][32] = {
  115. {"Unarmed (Fist)"}, // 0
  116. {"Brass Knuckles"}, // 1
  117. {"Golf Club"}, // 2
  118. {"Night Stick"}, // 3
  119. {"Knife"}, // 4
  120. {"Baseball Bat"}, // 5
  121. {"Shovel"}, // 6
  122. {"Pool Cue"}, // 7
  123. {"Katana"}, // 8
  124. {"Chainsaw"}, // 9
  125. {"Purple Dildo"}, // 10
  126. {"Big White Vibrator"}, // 11
  127. {"Medium White Vibrator"}, // 12
  128. {"Small White Vibrator"}, // 13
  129. {"Flowers"}, // 14
  130. {"Cane"}, // 15
  131. {"Grenade"}, // 16
  132. {"Teargas"}, // 17
  133. {"Molotov"}, // 18
  134. {" "}, // 19
  135. {" "}, // 20
  136. {" "}, // 21
  137. {"Colt 45"}, // 22
  138. {"Colt 45 (Silenced)"}, // 23
  139. {"Desert Eagle"}, // 24
  140. {"Normal Shotgun"}, // 25
  141. {"Sawnoff Shotgun"}, // 26
  142. {"Combat Shotgun"}, // 27
  143. {"Micro Uzi (Mac 10)"}, // 28
  144. {"MP5"}, // 29
  145. {"AK47"}, // 30
  146. {"M4"}, // 31
  147. {"Tec9"}, // 32
  148. {"Country Rifle"}, // 33
  149. {"Sniper Rifle"}, // 34
  150. {"Rocket Launcher"}, // 35
  151. {"Heat-Seeking Rocket Launcher"}, // 36
  152. {"Flamethrower"}, // 37
  153. {"Minigun"}, // 38
  154. {"Satchel Charge"}, // 39
  155. {"Detonator"}, // 40
  156. {"Spray Can"}, // 41
  157. {"Fire Extinguisher"}, // 42
  158. {"Camera"}, // 43
  159. {"Night Vision Goggles"}, // 44
  160. {"Infrared Vision Goggles"}, // 45
  161. {"Parachute"}, // 46
  162. {"Fake Pistol"} // 47
  163. };
  164. new aVehicleNames[212][] = { // Vehicle Names - Betamaster
  165. {"Landstalker"},
  166. {"Bravura"},
  167. {"Buffalo"},
  168. {"Linerunner"},
  169. {"Perrenial"},
  170. {"Sentinel"},
  171. {"Dumper"},
  172. {"Firetruck"},
  173. {"Trashmaster"},
  174. {"Stretch"},
  175. {"Manana"},
  176. {"Infernus"},
  177. {"Voodoo"},
  178. {"Pony"},
  179. {"Mule"},
  180. {"Cheetah"},
  181. {"Ambulance"},
  182. {"Leviathan"},
  183. {"Moonbeam"},
  184. {"Esperanto"},
  185. {"Taxi"},
  186. {"Washington"},
  187. {"Bobcat"},
  188. {"Mr Whoopee"},
  189. {"BF Injection"},
  190. {"Hunter"},
  191. {"Premier"},
  192. {"Enforcer"},
  193. {"Securicar"},
  194. {"Banshee"},
  195. {"Predator"},
  196. {"Bus"},
  197. {"Rhino"},
  198. {"Barracks"},
  199. {"Hotknife"},
  200. {"Trailer 1"}, //artict1
  201. {"Previon"},
  202. {"Coach"},
  203. {"Cabbie"},
  204. {"Stallion"},
  205. {"Rumpo"},
  206. {"RC Bandit"},
  207. {"Romero"},
  208. {"Packer"},
  209. {"Monster"},
  210. {"Admiral"},
  211. {"Squalo"},
  212. {"Seasparrow"},
  213. {"Pizzaboy"},
  214. {"Tram"},
  215. {"Trailer 2"}, //artict2
  216. {"Turismo"},
  217. {"Speeder"},
  218. {"Reefer"},
  219. {"Tropic"},
  220. {"Flatbed"},
  221. {"Yankee"},
  222. {"Caddy"},
  223. {"Solair"},
  224. {"Berkley's RC Van"},
  225. {"Skimmer"},
  226. {"PCJ-600"},
  227. {"Faggio"},
  228. {"Freeway"},
  229. {"RC Baron"},
  230. {"RC Raider"},
  231. {"Glendale"},
  232. {"Oceanic"},
  233. {"Sanchez"},
  234. {"Sparrow"},
  235. {"Patriot"},
  236. {"Quad"},
  237. {"Coastguard"},
  238. {"Dinghy"},
  239. {"Hermes"},
  240. {"Sabre"},
  241. {"Rustler"},
  242. {"ZR-350"},
  243. {"Walton"},
  244. {"Regina"},
  245. {"Comet"},
  246. {"BMX"},
  247. {"Burrito"},
  248. {"Camper"},
  249. {"Marquis"},
  250. {"Baggage"},
  251. {"Dozer"},
  252. {"Maverick"},
  253. {"News Chopper"},
  254. {"Rancher"},
  255. {"FBI Rancher"},
  256. {"Virgo"},
  257. {"Greenwood"},
  258. {"Jetmax"},
  259. {"Hotring"},
  260. {"Sandking"},
  261. {"Blista Compact"},
  262. {"Police Maverick"},
  263. {"Boxville"},
  264. {"Benson"},
  265. {"Mesa"},
  266. {"RC Goblin"},
  267. {"Hotring Racer A"}, //hotrina
  268. {"Hotring Racer B"}, //hotrinb
  269. {"Bloodring Banger"},
  270. {"Rancher"},
  271. {"Super GT"},
  272. {"Elegant"},
  273. {"Journey"},
  274. {"Bike"},
  275. {"Mountain Bike"},
  276. {"Beagle"},
  277. {"Cropdust"},
  278. {"Stunt"},
  279. {"Tanker"}, //petro
  280. {"Roadtrain"},
  281. {"Nebula"},
  282. {"Majestic"},
  283. {"Buccaneer"},
  284. {"Shamal"},
  285. {"Hydra"},
  286. {"FCR-900"},
  287. {"NRG-500"},
  288. {"HPV1000"},
  289. {"Cement Truck"},
  290. {"Tow Truck"},
  291. {"Fortune"},
  292. {"Cadrona"},
  293. {"FBI Truck"},
  294. {"Willard"},
  295. {"Forklift"},
  296. {"Tractor"},
  297. {"Combine"},
  298. {"Feltzer"},
  299. {"Remington"},
  300. {"Slamvan"},
  301. {"Blade"},
  302. {"Freight"},
  303. {"Streak"},
  304. {"Vortex"},
  305. {"Vincent"},
  306. {"Bullet"},
  307. {"Clover"},
  308. {"Sadler"},
  309. {"Firetruck LA"}, //firela
  310. {"Hustler"},
  311. {"Intruder"},
  312. {"Primo"},
  313. {"Cargobob"},
  314. {"Tampa"},
  315. {"Sunrise"},
  316. {"Merit"},
  317. {"Utility"},
  318. {"Nevada"},
  319. {"Yosemite"},
  320. {"Windsor"},
  321. {"Monster A"}, //monstera
  322. {"Monster B"}, //monsterb
  323. {"Uranus"},
  324. {"Jester"},
  325. {"Sultan"},
  326. {"Stratum"},
  327. {"Elegy"},
  328. {"Raindance"},
  329. {"RC Tiger"},
  330. {"Flash"},
  331. {"Tahoma"},
  332. {"Savanna"},
  333. {"Bandito"},
  334. {"Freight Flat"}, //freiflat
  335. {"Streak Carriage"}, //streakc
  336. {"Kart"},
  337. {"Mower"},
  338. {"Duneride"},
  339. {"Sweeper"},
  340. {"Broadway"},
  341. {"Tornado"},
  342. {"AT-400"},
  343. {"DFT-30"},
  344. {"Huntley"},
  345. {"Stafford"},
  346. {"BF-400"},
  347. {"Newsvan"},
  348. {"Tug"},
  349. {"Trailer 3"}, //petrotr
  350. {"Emperor"},
  351. {"Wayfarer"},
  352. {"Euros"},
  353. {"Hotdog"},
  354. {"Club"},
  355. {"Freight Carriage"}, //freibox
  356. {"Trailer 3"}, //artict3
  357. {"Andromada"},
  358. {"Dodo"},
  359. {"RC Cam"},
  360. {"Launch"},
  361. {"Police Car (LSPD)"},
  362. {"Police Car (SFPD)"},
  363. {"Police Car (LVPD)"},
  364. {"Police Ranger"},
  365. {"Picador"},
  366. {"S.W.A.T. Van"},
  367. {"Alpha"},
  368. {"Phoenix"},
  369. {"Glendale"},
  370. {"Sadler"},
  371. {"Luggage Trailer A"}, //bagboxa
  372. {"Luggage Trailer B"}, //bagboxb
  373. {"Stair Trailer"}, //tugstair
  374. {"Boxville"},
  375. {"Farm Plow"}, //farmtr1
  376. {"Utility Trailer"} //utiltr1
  377. };
  378. //==============================================================================
  379. forward SkinSelect(playerid);
  380. forward VehicleSelect(playerid);
  381. forward WorldSelect(playerid);
  382. forward CameraSelect(playerid);
  383. forward ObjectSelect( playerid );
  384. //==============================================================================
  385. dcmd_debug(playerid, params[]) {
  386. if(strcmp(params, "help", true, 4) == 0) {
  387. SendClientMessage(playerid, COLOR_BLUE, "[DEBUG]: Debug Mode 0.2 - HELP");
  388. SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: Debug Mode 0.2 is a filterscript which allows scripters");
  389. SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: or people who wish to explore SA:MP 0.2\'s features to have access");
  390. SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: to many commands and \"menu\'s\".");
  391. SendClientMessage(playerid, COLOR_YELLOW, "[DEBUG]: This filterscript was designed for SA:MP version 0.2");
  392. SendClientMessage(playerid, COLOR_PINK, "[DEBUG]: For the command list type \"/debug commands\"");
  393. return true;
  394. }
  395. if(strcmp(params, "commands", true, 8) == 0) {
  396. SendClientMessage(playerid, COLOR_BLUE, "[DEBUG]: Debug Mode 0.2 - COMMANDS");
  397. SendClientMessage(playerid, COLOR_CYAN, "[WORLD]: /w, /weather, /t, /time, /wsel, /g, /gravity");
  398. SendClientMessage(playerid, COLOR_CYAN, "[VEHICLES]: /v, /vehicle, /vsel");
  399. SendClientMessage(playerid, COLOR_CYAN, "[PLAYER]: /s, /skin, /ssel, /weapon, /w2");
  400. SendClientMessage(playerid, COLOR_CYAN, "[PLAYER]: /goto, /warpto, /bring, /setloc");
  401. SendClientMessage(playerid, COLOR_CYAN, "[CAMERA]: /camera, /csel");
  402. return true;
  403. }
  404. if(strcmp(params, "dump", true, 4) == 0) {
  405. SendClientMessage(playerid, COLOR_GREEN, "[SUCCESS]: All current server data dumped to a file.");
  406. new File:F_DUMP = fopen("DEBUG-DUMP.txt", io_append);
  407. if(F_DUMP) {
  408. new h, m, s, Y, M, D, cString[256];
  409. getdate(Y, M, D);
  410. gettime(h, m, s);
  411. format(cString, 256, "// %d-%d-%d @ %d:%d:%d\r\n", D, M, Y, h, m, s);
  412. fwrite(F_DUMP, cString);
  413. for(new i = 0; i < MAX_VEHICLES; i++) {
  414. if(curServerVehP[i][spawn] == true) {
  415. new Float:vx, Float:vy, Float:vz, Float:va;
  416. GetVehiclePos(i, vx, vy, vz);
  417. GetVehicleZAngle(i, va);
  418. format(cString, 256, "CreateVehicle(%d, %f, %f, %f, %f, -1, -1, 5000); // Interior(%d), %s\r\n", curServerVehP[i][vmodel], vx, vy, vz, va, curServerVehP[i][vInt], aVehicleNames[curServerVehP[i][vmodel] - MIN_VEHI_ID]);
  419. fwrite(F_DUMP, cString);
  420. }
  421. }
  422. print("** Dumped current server information.");
  423. fclose(F_DUMP);
  424. }
  425. else {
  426. print("** Failed to create the file \"DEBUG-DUMP.txt\".\n");
  427. }
  428. return true;
  429. }
  430. return false;
  431. }
  432. #if CAME_SELECT == true
  433. dcmd_object(playerid, params[])
  434. {
  435. new cString[ 128 ], idx;
  436. cString = strtok( params, idx );
  437. if ( !strlen( cString ) || !strlen( params[ idx + 1 ] ) )
  438. {
  439. SendClientMessage( playerid, COLOR_WHITE, "[USAGE]: /object [RRATE/MRATE/CAMERA] [RATE/ID]");
  440. return 1;
  441. }
  442. if ( strcmp( cString, "rrate", true ) == 0 )
  443. {
  444. pObjectRate[ playerid ][ OBJ_RATE_ROT ] = floatstr( params[ idx + 1 ] );
  445. format( cString, 128, "[SUCCESS]: Object rotation rate changed to %f.", pObjectRate[ playerid ][ OBJ_RATE_ROT ] );
  446. SendClientMessage( playerid, COLOR_GREEN, cString );
  447. return 1;
  448. }
  449. if ( strcmp( cString, "mrate", true ) == 0 )
  450. {
  451. pObjectRate[ playerid ][ OBJ_RATE_MOVE ] = floatstr( params[ idx + 1 ] );
  452. format( cString, 128, "[SUCCESS]: Object movement rate changed to %f.", pObjectRate[ playerid ][ OBJ_RATE_MOVE ] );
  453. SendClientMessage( playerid, COLOR_GREEN, cString );
  454. return 1;
  455. }
  456. if ( strcmp( cString, "mode", true ) == 0 )
  457. {
  458. new fuck = strval( params[ idx + 1 ] );
  459. if ( fuck >= O_MODE_SELECTOR || fuck <= O_MODE_ROTATOR )
  460. {
  461. curPlayerObjM[ playerid ][ OBJ_MOD ] = fuck;
  462. switch ( fuck )
  463. {
  464. case O_MODE_SELECTOR: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Selection." );
  465. case O_MODE_MOVER: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Mover." );
  466. case O_MODE_ROTATOR: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Rotator." );
  467. }
  468. return 1;
  469. }
  470. else
  471. {
  472. SendClientMessage( playerid, COLOR_RED, "[ERROR]: Invalid modeid." );
  473. return 1;
  474. }
  475. }
  476. if ( strcmp( cString, "focus", true ) == 0 )
  477. {
  478. new objectid = strval( params[ idx + 1 ] );
  479. if ( !IsValidObject( objectid ) )
  480. {
  481. SendClientMessage( playerid, COLOR_RED, "[ERROR]: Enter a valid objectid." );
  482. return 1;
  483. }
  484. else
  485. {
  486. curPlayerObjI[ playerid ] = objectid;
  487. GetObjectPos( objectid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] );
  488. GetObjectRot( objectid, curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] );
  489. curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 5.0;
  490. curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] - 20.0;
  491. curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_Z ] + 30.0;
  492. curPlayerCamD[playerid][CLOO_X] = curPlayerObjM[ playerid ][ OBJ_X ];
  493. curPlayerCamD[playerid][CLOO_Y] = curPlayerObjM[ playerid ][ OBJ_Y ];
  494. curPlayerCamD[playerid][CLOO_Z] = curPlayerObjM[ playerid ][ OBJ_Z ];
  495. if ( gPlayerStatus[ playerid ] == OBJE_SEL_STAT )
  496. {
  497. SetPlayerCameraPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] );
  498. SetPlayerCameraLookAt( playerid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] );
  499. }
  500. return 1;
  501. }
  502. }
  503. if ( strcmp( cString, "camera", true ) == 0 )
  504. {
  505. new cameraid = strval( params[ idx + 1 ] );
  506. if ( cameraid >= 0 && cameraid < 4 )
  507. {
  508. switch ( cameraid )
  509. {
  510. case 0:
  511. {
  512. curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 7.0;
  513. curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] - 20.0;
  514. curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_Z ] + 30.0;
  515. }
  516. case 1:
  517. {
  518. curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 7.0;
  519. curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 15.0;
  520. curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 15.0;
  521. }
  522. case 2:
  523. {
  524. curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] - 20.0;
  525. curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 20.0;
  526. curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 20.0;
  527. }
  528. case 3:
  529. {
  530. curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] - 10.0;
  531. curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 25.0;
  532. curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 15.0;
  533. }
  534. }
  535. SetPlayerCameraPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] );
  536. SetPlayerCameraLookAt( playerid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] );
  537. return 1;
  538. }
  539. else
  540. {
  541. SendClientMessage( playerid, COLOR_RED, "[ERROR]: Invalid object camera id.");
  542. return 1;
  543. }
  544. }
  545. return 0;
  546. }
  547. dcmd_osel(playerid, params[])
  548. {
  549. #pragma unused params
  550. new cString[ 128 ];
  551. if ( gPlayerStatus[ playerid ] != 0 )
  552. {
  553. format( cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] );
  554. SendClientMessage(playerid, COLOR_RED, cString);
  555. return 1;
  556. }
  557. new Float:a;
  558. gPlayerStatus[playerid] = OBJE_SEL_STAT;
  559. GetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  560. curPlayerCamD[playerid][CPOS_Z] += 5.0;
  561. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  562. GetXYInFrontOfPlayer(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], OBJE_DIS);
  563. curPlayerCamD[playerid][CLOO_Z] = curPlayerCamD[playerid][CPOS_Z] - 5.0;
  564. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  565. TogglePlayerControllable(playerid, 0);
  566. GetPlayerFacingAngle(playerid, a);
  567. curPlayerObjM[ playerid ][ OBJ_X ] = curPlayerCamD[playerid][CLOO_X];
  568. curPlayerObjM[ playerid ][ OBJ_Y ] = curPlayerCamD[playerid][CLOO_Y];
  569. curPlayerObjM[ playerid ][ OBJ_Z ] = curPlayerCamD[playerid][CLOO_Z];
  570. curPlayerObjM[ playerid ][ OBJ_RX ] = 0.0;
  571. curPlayerObjM[ playerid ][ OBJ_RY ] = 0.0;
  572. curPlayerObjM[ playerid ][ OBJ_RZ ] = 0.0;
  573. curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ],
  574. curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ],
  575. curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ]
  576. );
  577. gPlayerTimers[ playerid ] = SetTimerEx("ObjectSelect", 200, 1, "i", playerid);
  578. return 1;
  579. }
  580. dcmd_camera(playerid, params[]) {
  581. new idx; new cString[128];
  582. cString = strtok(params, idx);
  583. if (!strlen(cString)) {
  584. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /camera [RATE/MODE] [RATE/MODEID]");
  585. return true;
  586. }
  587. if (strcmp(cString, "rate", true, 4) == 0) {
  588. curPlayerCamD[playerid][RATE] = floatstr(params[idx+1]);
  589. return true;
  590. }
  591. if (strcmp(cString, "mode", true, 4) == 0) {
  592. curPlayerCamD[playerid][CMODE] = strval(params[idx+1]);
  593. return true;
  594. }
  595. return true;
  596. }
  597. dcmd_csel(playerid, params[]) {
  598. #pragma unused params
  599. new cString[128];
  600. if (gPlayerStatus[playerid] != 0) {
  601. format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
  602. SendClientMessage(playerid, COLOR_RED, cString);
  603. return true;
  604. }
  605. gPlayerStatus[playerid] = CAME_SEL_STAT;
  606. TogglePlayerControllable(playerid, 0);
  607. GetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  608. GetXYInFrontOfPlayer(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], 5.0);
  609. curPlayerCamD[playerid][CLOO_Z] = curPlayerCamD[playerid][CPOS_Z];
  610. gPlayerTimers[playerid] = SetTimerEx("CameraSelect", 200, 1, "i", playerid);
  611. return true;
  612. }
  613. #endif
  614. #if WORL_SELECT == true
  615. dcmd_g(playerid, params[]) {
  616. new cString[128];
  617. if (!strlen(params[0]))
  618. {
  619. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /g GRAVITY or /gravity GRAVITY");
  620. return true;
  621. }
  622. new Float:grav = floatstr(params[0]);
  623. SetGravity(grav);
  624. format(cString, 128, "[SUCCESS]: World gravity changed to %f", grav);
  625. SendClientMessage(playerid, COLOR_GREEN, cString);
  626. return true;
  627. }
  628. dcmd_gravity(playerid, params[])
  629. return dcmd_g(playerid, params);
  630. dcmd_w(playerid, params[]) {
  631. new idx, iString[128];
  632. iString = strtok(params, idx);
  633. if (!strlen(iString)) {
  634. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w WEATHERID or /weather WEATHERID");
  635. return true;
  636. }
  637. idx = strval(iString);
  638. if (idx < MIN_WEAT_ID || idx > MAX_WEAT_ID) {
  639. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEATHERID");
  640. return true;
  641. }
  642. gWorldStatus[1] = idx;
  643. SetWeather(idx);
  644. format(iString, 128, "[SUCCESS]: Weather has changed to WEATHERID %d", idx);
  645. SendClientMessage(playerid, COLOR_GREEN, iString);
  646. return true;
  647. }
  648. dcmd_weather(playerid, params[])
  649. return dcmd_w(playerid, params);
  650. dcmd_t(playerid, params[]) {
  651. new idx, iString[128];
  652. iString = strtok(params, idx);
  653. if (!strlen(iString)) {
  654. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /t HOUR or /time HOUR");
  655. return true;
  656. }
  657. idx = strval(iString);
  658. if (idx < MIN_TIME_ID || idx > MAX_TIME_ID) {
  659. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid HOUR");
  660. return true;
  661. }
  662. gWorldStatus[0] = idx;
  663. SetWorldTime(idx);
  664. format(iString, 128, "[SUCCESS]: Time has changed to HOUR %d", idx);
  665. SendClientMessage(playerid, COLOR_GREEN, iString);
  666. return true;
  667. }
  668. dcmd_time(playerid, params[])
  669. return dcmd_t(playerid, params);
  670. dcmd_wsel(playerid, params[]) {
  671. #pragma unused params
  672. new cString[128];
  673. if (gPlayerStatus[playerid] != 0) {
  674. format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
  675. SendClientMessage(playerid, COLOR_RED, cString);
  676. return true;
  677. }
  678. new Float:x, Float:y, Float:z;
  679. gPlayerStatus[playerid] = WORL_SEL_STAT;
  680. GetPlayerPos(playerid, x, y, z);
  681. SetPlayerCameraPos(playerid, x, y, z + 40.0);
  682. GetXYInFrontOfPlayer(playerid, x, y, 100.0);
  683. SetPlayerCameraLookAt(playerid, x, y, z + 5.0);
  684. TogglePlayerControllable(playerid, 0);
  685. gPlayerTimers[playerid] = SetTimerEx("WorldSelect", 200, 1, "i", playerid);
  686. GameTextForPlayer(playerid, "WorldSelect", 1500, 3);
  687. return true;
  688. }
  689. #endif
  690. #if VEHI_SELECT == true
  691. dcmd_v(playerid, params[])
  692. {
  693. new
  694. idx,
  695. iString[ 128 ];
  696. if ( gPlayerStatus[ playerid ] != 0 )
  697. {
  698. format ( iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] );
  699. SendClientMessage ( playerid, COLOR_RED, iString );
  700. return true;
  701. }
  702. if ( params[ 0 ] == '\0' ) // Same effect as a !strlen check.
  703. return SendClientMessage( playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME" );
  704. //***************
  705. // Fix by Mike! *
  706. //***************
  707. idx = GetVehicleModelIDFromName( params );
  708. if( idx == -1 )
  709. {
  710. idx = strval(iString);
  711. if ( idx < MIN_VEHI_ID || idx > MAX_VEHI_ID )
  712. return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
  713. }
  714. new
  715. Float:x,
  716. Float:y,
  717. Float:z,
  718. Float:a;
  719. GetPlayerPos(playerid, x, y, z);
  720. GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
  721. GetPlayerFacingAngle(playerid, a);
  722. curPlayerVehM[playerid] = idx;
  723. curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
  724. LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));
  725. curServerVehP[curPlayerVehI[playerid]][spawn] = true;
  726. curServerVehP[curPlayerVehI[playerid]][vmodel] = idx;
  727. curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);
  728. format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);
  729. SendClientMessage(playerid, COLOR_GREEN, iString);
  730. return true;
  731. }
  732. dcmd_vehicle(playerid, params[])
  733. return dcmd_v(playerid, params);
  734. dcmd_vsel(playerid, params[])
  735. {
  736. // /vsel allows players to select a vehicle using playerkeys.
  737. #pragma unused params
  738. new cString[128];
  739. if (gPlayerStatus[playerid] != 0) {
  740. format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
  741. SendClientMessage(playerid, COLOR_RED, cString);
  742. return true;
  743. }
  744. new Float:x, Float:y, Float:z, Float:a;
  745. gPlayerStatus[playerid] = VEHI_SEL_STAT;
  746. GetPlayerPos(playerid, x, y, z);
  747. SetPlayerCameraPos(playerid, x, y, z + 3.0);
  748. GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
  749. SetPlayerCameraLookAt(playerid, x, y, z);
  750. TogglePlayerControllable(playerid, 0);
  751. GetPlayerFacingAngle(playerid, a);
  752. curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000);
  753. printf( "vsel vehicle start id = %d", curPlayerVehI[playerid] );
  754. LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));
  755. curServerVehP[curPlayerVehI[playerid]][spawn] = true;
  756. curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid];
  757. curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);
  758. gPlayerTimers[playerid] = SetTimerEx("VehicleSelect", 200, 1, "i", playerid);
  759. return true;
  760. }
  761. #endif
  762. #if SKIN_SELECT == true
  763. dcmd_ssel(playerid, params[])
  764. {
  765. // /ssel allows players to select a skin using playerkeys.
  766. #pragma unused params
  767. new cString[128];
  768. if (gPlayerStatus[playerid] != 0) {
  769. format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]);
  770. SendClientMessage(playerid, COLOR_RED, cString);
  771. return true;
  772. }
  773. new Float:x, Float:y, Float:z;
  774. gPlayerStatus[playerid] = SKIN_SEL_STAT;
  775. GetPlayerPos(playerid, x, y, z);
  776. SetPlayerCameraLookAt(playerid, x, y, z);
  777. GetXYInFrontOfPlayer(playerid, x, y, 3.5);
  778. SetPlayerCameraPos(playerid, x, y, z);
  779. TogglePlayerControllable(playerid, 0);
  780. gPlayerTimers[playerid] = SetTimerEx("SkinSelect", 200, 1, "i", playerid);
  781. return true;
  782. }
  783. dcmd_s(playerid, params[])
  784. {
  785. // /s SKINID allows players to directly select a skin using it's ID.
  786. new idx, iString[128];
  787. iString = strtok(params, idx);
  788. if (!strlen(iString)) {
  789. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /s SKINID");
  790. return true;
  791. }
  792. idx = strval(iString);
  793. if (IsInvalidSkin(idx) || idx < MIN_SKIN_ID || idx > MAX_SKIN_ID) {
  794. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid SKINID");
  795. return true;
  796. }
  797. SetPlayerSkin(playerid, idx);
  798. curPlayerSkin[playerid] = idx;
  799. format(iString, 128, "[SUCCESS]: Changed skin to SKINID %d", idx);
  800. SendClientMessage(playerid, COLOR_GREEN, iString);
  801. return true;
  802. }
  803. dcmd_skin(playerid, params[])
  804. {
  805. dcmd_s(playerid, params);
  806. return true;
  807. }
  808. #endif
  809. #if MISCEL_CMDS == true
  810. dcmd_goto(playerid, params[])
  811. {
  812. new idx, iString[128];
  813. iString = strtok(params, idx);
  814. if (!strlen(iString)) {
  815. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /goto PLAYERID (X_OFFSET Y_OFFSET Z_OFFSET)");
  816. return true;
  817. }
  818. new ID = strval(iString);
  819. if (!IsPlayerConnected(ID)) {
  820. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Not connected PLAYERID.");
  821. return true;
  822. }
  823. new Float:X, Float:Y, Float:Z;
  824. new Interior = GetPlayerInterior(ID);
  825. GetPlayerPos(ID, X, Y, Z);
  826. iString = strtok(params, idx);
  827. if (!strlen(iString)) {
  828. GetXYInFrontOfPlayer(ID, X, Y, 1.5);
  829. SetPlayerInterior(playerid, Interior);
  830. SetPlayerPos(playerid, X, Y, Z);
  831. GetPlayerName(ID, iString, 128);
  832. format(iString, 128, "[SUCCESS]: You have warped to %s (ID: %d).", iString, ID);
  833. SendClientMessage(playerid, COLOR_GREEN, iString);
  834. return true;
  835. }
  836. X += floatstr(iString);
  837. iString = strtok(params, idx);
  838. if (!strlen(iString)) {
  839. goto fwarpto;
  840. }
  841. Y += floatstr(iString);
  842. iString = strtok(params, idx);
  843. if (!strlen(iString)) {
  844. goto fwarpto;
  845. }
  846. Z += floatstr(iString);
  847. fwarpto:
  848. new pVID = GetPlayerVehicleID( playerid );
  849. if ( pVID )
  850. {
  851. SetVehiclePos( pVID, X, Y, Z );
  852. LinkVehicleToInterior( pVID, Interior );
  853. }
  854. else
  855. {
  856. SetPlayerPos( playerid, X, Y, Z);
  857. }
  858. SetPlayerInterior( playerid, Interior);
  859. GetPlayerName(ID, iString, 128);
  860. format(iString, 128, "[SUCCESS]: You have warped to %s (ID: %d).", iString, ID);
  861. SendClientMessage(playerid, COLOR_GREEN, iString);
  862. return true;
  863. }
  864. dcmd_warpto(playerid, params[])
  865. {
  866. dcmd_goto(playerid, params);
  867. return true;
  868. }
  869. dcmd_setloc(playerid, params[])
  870. {
  871. new idx, iString[128];
  872. iString = strtok(params, idx);
  873. if (!strlen(iString)) {
  874. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /setloc X Y Z INTERIOR");
  875. return true;
  876. }
  877. new Float:X, Float:Y, Float:Z;
  878. new Interior;
  879. X = floatstr(iString);
  880. Y = floatstr(strtok(params,idx));
  881. Z = floatstr(strtok(params,idx));
  882. Interior = strval(strtok(params,idx));
  883. new pVID = GetPlayerVehicleID( playerid );
  884. if ( pVID )
  885. {
  886. SetVehiclePos( pVID, X, Y, Z );
  887. LinkVehicleToInterior( pVID, Interior );
  888. }
  889. else
  890. {
  891. SetPlayerPos( playerid, X, Y, Z );
  892. }
  893. SetPlayerInterior(playerid, Interior);
  894. return true;
  895. }
  896. dcmd_bring(playerid, params[])
  897. {
  898. new idx, iString[128];
  899. iString = strtok(params, idx);
  900. if (!strlen(iString)) {
  901. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /bring PLAYERID (X_OFFSET Y_OFFSET Z_OFFSET)");
  902. return true;
  903. }
  904. new ID = strval(iString);
  905. if (!IsPlayerConnected(ID)) {
  906. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Not connected PLAYERID.");
  907. return true;
  908. }
  909. new Float:X, Float:Y, Float:Z;
  910. new Interior = GetPlayerInterior(playerid);
  911. GetPlayerPos(playerid, X, Y, Z);
  912. iString = strtok(params, idx);
  913. if (!strlen(iString)) {
  914. GetXYInFrontOfPlayer(playerid, X, Y, 1.5);
  915. SetPlayerInterior(ID, Interior);
  916. SetPlayerPos(ID, X, Y, Z);
  917. GetPlayerName(ID, iString, 128);
  918. format(iString, 128, "[SUCCESS]: You have brought %s (ID: %d) to you.", iString, ID);
  919. SendClientMessage(playerid, COLOR_GREEN, iString);
  920. return true;
  921. }
  922. X += floatstr(iString);
  923. iString = strtok(params, idx);
  924. if (!strlen(iString)) {
  925. goto fbring;
  926. }
  927. Y += floatstr(iString);
  928. iString = strtok(params, idx);
  929. if (!strlen(iString)) {
  930. goto fbring;
  931. }
  932. Z += floatstr(iString);
  933. fbring:
  934. new pVID = GetPlayerVehicleID( ID );
  935. if ( pVID )
  936. {
  937. SetVehiclePos( pVID, X, Y, Z );
  938. LinkVehicleToInterior( pVID, Interior );
  939. }
  940. else
  941. {
  942. SetPlayerPos( ID, X, Y, Z );
  943. }
  944. SetPlayerInterior(ID, Interior);
  945. GetPlayerName(ID, iString, 128);
  946. format(iString, 128, "[SUCCESS]: You have brought %s (ID: %d) to you.", iString, ID);
  947. SendClientMessage(playerid, COLOR_GREEN, iString);
  948. return true;
  949. }
  950. dcmd_weapon(playerid, params[])
  951. {
  952. dcmd_w2(playerid, params);
  953. return true;
  954. }
  955. dcmd_w2(playerid, params[])
  956. {
  957. new idx, iString[128];
  958. iString = strtok(params, idx);
  959. if (!strlen(iString)) {
  960. SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w2 WEAPONID/NAME (AMMO) or /weapon WEAPONID/NAME (AMMO)");
  961. return true;
  962. }
  963. new weaponid = GetWeaponModelIDFromName(iString);
  964. if (weaponid == -1) {
  965. weaponid = strval(iString);
  966. if (weaponid < 0 || weaponid > 47) {
  967. SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEAPONID/NAME");
  968. return true;
  969. }
  970. }
  971. if (!strlen(params[idx+1])) {
  972. GivePlayerWeapon(playerid, weaponid, 500);
  973. format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with 500 ammo.", aWeaponNames[weaponid], weaponid);
  974. SendClientMessage(playerid, COLOR_GREEN, iString);
  975. return true;
  976. }
  977. idx = strval(params[idx+1]);
  978. GivePlayerWeapon(playerid, weaponid, idx);
  979. format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with %d ammo.", aWeaponNames[weaponid], weaponid, idx);
  980. SendClientMessage(playerid, COLOR_GREEN, iString);
  981. return true;
  982. }
  983. #endif
  984. public OnFilterScriptInit()
  985. {
  986. print("\n *********************\n * SA:MP DEBUG 0.2 *");
  987. print(" * By Simon Campbell *\n *********************");
  988. printf(" * Version: %s *\n *********************", DEBUG_VERSION);
  989. print(" * -- LOADED *\n *********************\n");
  990. for ( new i = 0; i < MAX_PLAYERS; i++ )
  991. {
  992. curPlayerObjM[ i ][ OBJ_MDL ] = MIN_OBJE_ID;
  993. pObjectRate[ i ][ OBJ_RATE_ROT ] = 1.0;
  994. pObjectRate[ i ][ OBJ_RATE_MOVE ] = 1.0;
  995. }
  996. }
  997. public OnFilterScriptExit()
  998. {
  999. print("\n *********************\n * SA:MP DEBUG 0.2 *");
  1000. print(" * -- SHUTDOWN *\n *********************\n");
  1001. }
  1002. public OnPlayerCommandText(playerid, cmdtext[])
  1003. {
  1004. #if ADMINS_ONLY == true
  1005. if(IsPlayerAdmin(playerid)) {
  1006. #endif
  1007. #if SKIN_SELECT == true
  1008. dcmd(s, 1, cmdtext);
  1009. dcmd(ssel, 4, cmdtext);
  1010. dcmd(skin, 4, cmdtext);
  1011. #endif
  1012. #if VEHI_SELECT == true
  1013. dcmd(v, 1, cmdtext);
  1014. dcmd(vsel, 4, cmdtext);
  1015. dcmd(vehicle, 7, cmdtext);
  1016. #endif
  1017. #if WORL_SELECT == true
  1018. dcmd(w, 1, cmdtext);
  1019. dcmd(t, 1, cmdtext);
  1020. dcmd(g, 1, cmdtext);
  1021. dcmd(wsel, 4, cmdtext);
  1022. dcmd(time, 4, cmdtext);
  1023. dcmd(weather, 7, cmdtext);
  1024. dcmd(gravity, 7, cmdtext);
  1025. #endif
  1026. #if MISCEL_CMDS == true
  1027. dcmd(w2, 2, cmdtext);
  1028. dcmd(goto, 4, cmdtext);
  1029. dcmd(bring, 5, cmdtext);
  1030. dcmd(warpto, 6, cmdtext);
  1031. dcmd(weapon, 6, cmdtext);
  1032. dcmd(setloc, 6, cmdtext);
  1033. #endif
  1034. #if CAME_SELECT == true
  1035. dcmd(csel, 4, cmdtext);
  1036. dcmd(camera, 6, cmdtext);
  1037. #endif
  1038. dcmd(osel, 4, cmdtext);
  1039. dcmd(object, 6, cmdtext);
  1040. dcmd(debug, 5, cmdtext);
  1041. #if ADMINS_ONLY == true
  1042. }
  1043. #endif
  1044. return 0;
  1045. }
  1046. public OnPlayerDisconnect(playerid,reason)
  1047. {
  1048. KillTimer(gPlayerTimers[playerid]);
  1049. gPlayerStatus[playerid] = 0;
  1050. gPlayerTimers[playerid] = 0;
  1051. curPlayerSkin[playerid] = MIN_SKIN_ID; // Current Player Skin ID
  1052. curPlayerVehM[playerid] = MIN_VEHI_ID; // Current Player Vehicle ID
  1053. curPlayerVehI[playerid] = -1;
  1054. return 0;
  1055. }
  1056. public OnPlayerConnect(playerid)
  1057. {
  1058. curPlayerCamD[playerid][CMODE] = CMODE_A;
  1059. curPlayerCamD[playerid][RATE] = 2.0;
  1060. return 0;
  1061. }
  1062. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) {
  1063. #if ADMINS_ONLY == true
  1064. if (IsPlayerAdmin(playerid)) {
  1065. #endif
  1066. SetPlayerPosFindZ(playerid, fX, fY, fZ);
  1067. #if ADMINS_ONLY == true
  1068. }
  1069. #endif
  1070. }
  1071. //==============================================================================
  1072. #if WORL_SELECT == true
  1073. public WorldSelect(playerid)
  1074. { // Created by Simon
  1075. /*
  1076. // Make sure the player is not in world selection before continuing
  1077. if (gPlayerStatus[playerid] != WORL_SEL_STAT) {
  1078. KillTimer(skinTimerID[playerid]);
  1079. return;
  1080. }
  1081. */
  1082. new keys, updown, leftright;
  1083. GetPlayerKeys(playerid, keys, updown, leftright);
  1084. new cString[128];
  1085. // Right key increases World Time
  1086. if (leftright == KEY_RIGHT) {
  1087. if(gWorldStatus[0] == MAX_TIME_ID) {
  1088. gWorldStatus[0] = MIN_TIME_ID;
  1089. }
  1090. else {
  1091. gWorldStatus[0]++;
  1092. }
  1093. format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]);
  1094. GameTextForPlayer(playerid, cString, 1500, 3);
  1095. SetWorldTime(gWorldStatus[0]);
  1096. }
  1097. // Left key decreases World Time
  1098. if (leftright == KEY_LEFT) {
  1099. if(gWorldStatus[0] == MIN_TIME_ID) {
  1100. gWorldStatus[0] = MAX_TIME_ID;
  1101. }
  1102. else {
  1103. gWorldStatus[0]--;
  1104. }
  1105. format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]);
  1106. GameTextForPlayer(playerid, cString, 1500, 3);
  1107. SetWorldTime(gWorldStatus[0]);
  1108. }
  1109. // Up key increases Weather ID
  1110. if(updown == KEY_UP) {
  1111. if(gWorldStatus[1] == MAX_WEAT_ID) {
  1112. gWorldStatus[1] = MIN_WEAT_ID;
  1113. }
  1114. else {
  1115. gWorldStatus[1]++;
  1116. }
  1117. format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]);
  1118. GameTextForPlayer(playerid, cString, 1500, 3);
  1119. SetWeather(gWorldStatus[1]);
  1120. }
  1121. // Down key decreases Weather ID
  1122. if(updown == KEY_DOWN) {
  1123. if(gWorldStatus[1] == MIN_WEAT_ID) {
  1124. gWorldStatus[1] = MAX_WEAT_ID;
  1125. }
  1126. else {
  1127. gWorldStatus[1]--;
  1128. }
  1129. format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]);
  1130. GameTextForPlayer(playerid, cString, 1500, 3);
  1131. SetWeather(gWorldStatus[1]);
  1132. }
  1133. // Action key exits WorldSelection
  1134. if(keys & KEY_ACTION) {
  1135. SetCameraBehindPlayer(playerid);
  1136. TogglePlayerControllable(playerid, 1);
  1137. format(cString, 128, "[SUCCESS]: Time changed to %d hours and weather changed to WEATHERID %d", gWorldStatus[0], gWorldStatus[1]);
  1138. SendClientMessage(playerid, COLOR_GREEN, cString);
  1139. new File:F_WORLD = fopen("TIME-WEATHER.txt", io_append);
  1140. if(F_WORLD) {
  1141. new h, m, s, Y, M, D;
  1142. getdate(Y, M, D);
  1143. gettime(h, m, s);
  1144. format(cString, 128, "// %d-%d-%d @ %d:%d:%d\r\nSetWeather(%d);\r\nSetWorldTime(%d);\r\n", D, M, Y, h, m, s);
  1145. fwrite(F_WORLD, cString);
  1146. fclose(F_WORLD);
  1147. printf("\n%s\n",cString);
  1148. }
  1149. else {
  1150. print("Failed to create the file \"TIME-WEATHER.txt\".\n");
  1151. }
  1152. gPlayerStatus[playerid] = 0;
  1153. KillTimer(gPlayerTimers[playerid]);
  1154. return;
  1155. }
  1156. }
  1157. #endif
  1158. #if SKIN_SELECT == true
  1159. public SkinSelect(playerid)
  1160. { // Created by Simon
  1161. /*
  1162. // Make sure the player is not in skin selection before continuing
  1163. if (gPlayerStatus[playerid] != SKIN_SEL_STAT) {
  1164. KillTimer(skinTimerID[playerid]);
  1165. return;
  1166. }
  1167. */
  1168. new keys, updown, leftright;
  1169. GetPlayerKeys(playerid, keys, updown, leftright);
  1170. new cString[128];
  1171. // Right key increases Skin ID
  1172. if (leftright == KEY_RIGHT) {
  1173. if(curPlayerSkin[playerid] == MAX_SKIN_ID) {
  1174. curPlayerSkin[playerid] = MIN_SKIN_ID;
  1175. }
  1176. else {
  1177. curPlayerSkin[playerid]++;
  1178. }
  1179. while(IsInvalidSkin(curPlayerSkin[playerid])) {
  1180. curPlayerSkin[playerid]++;
  1181. }
  1182. format(cString, 128, "Skin ID: %d", curPlayerSkin[playerid]);
  1183. GameTextForPlayer(playerid, cString, 1500, 3);
  1184. SetPlayerSkin(playerid, curPlayerSkin[playerid]);
  1185. }
  1186. // Left key decreases Skin ID
  1187. if(leftright == KEY_LEFT) {
  1188. if(curPlayerSkin[playerid] == MIN_SKIN_ID) {
  1189. curPlayerSkin[playerid] = MAX_SKIN_ID;
  1190. }
  1191. else {
  1192. curPlayerSkin[playerid]--;
  1193. }
  1194. while(IsInvalidSkin(curPlayerSkin[playerid])) {
  1195. curPlayerSkin[playerid]--;
  1196. }
  1197. format(cString, 128, "Skin ID: %d", curPlayerSkin[playerid]);
  1198. GameTextForPlayer(playerid, cString, 1500, 3);
  1199. SetPlayerSkin(playerid, curPlayerSkin[playerid]);
  1200. }
  1201. // Action key exits skin selection
  1202. if(keys & KEY_ACTION)
  1203. {
  1204. SetCameraBehindPlayer(playerid);
  1205. TogglePlayerControllable(playerid, 1);
  1206. format(cString, 128, "[SUCCESS]: You have changed to SKINID %d", curPlayerSkin[playerid]);
  1207. SendClientMessage(playerid, COLOR_GREEN, cString);
  1208. gPlayerStatus[playerid] = 0;
  1209. KillTimer(gPlayerTimers[playerid]);
  1210. }
  1211. }
  1212. #endif
  1213. #if CAME_SELECT == true
  1214. public CameraSelect(playerid)
  1215. {
  1216. // CMODE_A 0 Up/Down = IncreaseZ/DecreaseZ; Left/Right = IncreaseX/DecreaseX; Num4/Num6 = IncreaseY/DecreaseY
  1217. // CMODE_B 1 Up/Down = Rotate Up/Down; Left/Right = Rotate Left/Right; Num4/Num6 = Move Left/Right
  1218. new keys, updown, leftright;
  1219. GetPlayerKeys(playerid, keys, updown, leftright);
  1220. printf("Player (%d) keys = %d, updown = %d, leftright = %d", playerid, keys, updown, leftright);
  1221. if (curPlayerCamD[playerid][CMODE] == CMODE_A)
  1222. {
  1223. if (leftright == KEY_RIGHT) {
  1224. curPlayerCamD[playerid][CPOS_X] += curPlayerCamD[playerid][RATE];
  1225. curPlayerCamD[playerid][CLOO_X] += curPlayerCamD[playerid][RATE];
  1226. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1227. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1228. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1229. }
  1230. if (leftright == KEY_LEFT) {
  1231. curPlayerCamD[playerid][CPOS_X] -= curPlayerCamD[playerid][RATE];
  1232. curPlayerCamD[playerid][CLOO_X] -= curPlayerCamD[playerid][RATE];
  1233. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1234. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1235. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1236. }
  1237. if (updown == KEY_UP) {
  1238. curPlayerCamD[playerid][CPOS_Z] += curPlayerCamD[playerid][RATE];
  1239. curPlayerCamD[playerid][CLOO_Z] += curPlayerCamD[playerid][RATE];
  1240. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1241. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1242. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1243. }
  1244. if (updown == KEY_DOWN) {
  1245. curPlayerCamD[playerid][CPOS_Z] -= curPlayerCamD[playerid][RATE];
  1246. curPlayerCamD[playerid][CLOO_Z] -= curPlayerCamD[playerid][RATE];
  1247. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1248. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1249. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1250. }
  1251. if (keys & KEY_ANALOG_RIGHT) {
  1252. curPlayerCamD[playerid][CPOS_Y] += curPlayerCamD[playerid][RATE];
  1253. curPlayerCamD[playerid][CLOO_Y] += curPlayerCamD[playerid][RATE];
  1254. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1255. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1256. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1257. }
  1258. if (keys & KEY_ANALOG_LEFT) {
  1259. curPlayerCamD[playerid][CPOS_Y] -= curPlayerCamD[playerid][RATE];
  1260. curPlayerCamD[playerid][CLOO_Y] -= curPlayerCamD[playerid][RATE];
  1261. SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1262. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1263. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1264. }
  1265. }
  1266. if(curPlayerCamD[playerid][CMODE] == CMODE_B)
  1267. {
  1268. if (leftright == KEY_RIGHT) {
  1269. // Rotate Y +
  1270. }
  1271. if (leftright == KEY_LEFT) {
  1272. // Rotate Y -
  1273. }
  1274. if (updown == KEY_UP) {
  1275. // Rotate X +
  1276. }
  1277. if (updown == KEY_DOWN) {
  1278. // Rotate X -
  1279. }
  1280. if (keys & KEY_ANALOG_RIGHT) {
  1281. // Rotate Z +
  1282. }
  1283. if (keys & KEY_ANALOG_LEFT) {
  1284. // Rotate Z -
  1285. }
  1286. }
  1287. if (keys & KEY_ACTION)
  1288. {
  1289. SetCameraBehindPlayer(playerid);
  1290. new
  1291. File:F_CAMERA = fopen("CAMERA.txt", io_append);
  1292. if( F_CAMERA )
  1293. {
  1294. new
  1295. cString[512], h, m, s, Y, M, D;
  1296. getdate(Y, M, D);
  1297. gettime(h, m, s);
  1298. format(cString, sizeof( cString ), "// %d-%d-%d @ %d:%d:%d\r\nSetPlayerCameraPos(playerid, %f, %f, %f);\r\nSetPlayerCameraLookAt(playerid, %f, %f, %f);\r\n", D, M, Y, h, m, s,curPlayerCamD[playerid][CPOS_X],curPlayerCamD[playerid][CPOS_Y],curPlayerCamD[playerid][CPOS_Z],curPlayerCamD[playerid][CLOO_X],curPlayerCamD[playerid][CLOO_Y],curPlayerCamD[playerid][CLOO_Z]);
  1299. fwrite(F_CAMERA, cString);
  1300. fclose(F_CAMERA);
  1301. printf("\n%s\n",cString);
  1302. SendClientMessage( playerid, COLOR_GREEN, "Current camera data saved to 'CAMERA.txt'" );
  1303. }
  1304. else
  1305. print("Failed to create the file \"CAMERA.txt\".\n");
  1306. TogglePlayerControllable(playerid, 1);
  1307. KillTimer(gPlayerTimers[playerid]);
  1308. gPlayerStatus[playerid] = 0;
  1309. }
  1310. }
  1311. #endif
  1312. #if VEHI_SELECT == true
  1313. public VehicleSelect(playerid)
  1314. {
  1315. /*
  1316. // Make sure the player is not in skin selection before continuing
  1317. if (gPlayerStatus[playerid] != VEHI_SEL_STAT) {
  1318. KillTimer(skinTimerID[playerid]);
  1319. return;
  1320. }
  1321. */
  1322. new keys, updown, leftright;
  1323. GetPlayerKeys(playerid, keys, updown, leftright);
  1324. new cString[128];
  1325. // Right key increases Vehicle MODELID
  1326. if (leftright == KEY_RIGHT) {
  1327. if(curPlayerVehM[playerid] == MAX_VEHI_ID) {
  1328. curPlayerVehM[playerid] = MIN_VEHI_ID;
  1329. }
  1330. else {
  1331. curPlayerVehM[playerid]++;
  1332. }
  1333. format(cString, 128, "Model ID: %d~n~Vehicle Name: %s", curPlayerVehM, aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID]);
  1334. GameTextForPlayer(playerid, cString, 1500, 3);
  1335. new Float:x, Float:y, Float:z, Float:a;
  1336. GetPlayerPos(playerid, x, y, z);
  1337. GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
  1338. GetPlayerFacingAngle(playerid, a);
  1339. DestroyVehicle(curPlayerVehI[playerid]);
  1340. curServerVehP[curPlayerVehI[playerid]][spawn] = false;
  1341. curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000);
  1342. printf( "vsel vehicle select id = %d", curPlayerVehI[playerid] );
  1343. LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));
  1344. curServerVehP[curPlayerVehI[playerid]][spawn] = true;
  1345. curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid];
  1346. curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);
  1347. }
  1348. // Left key decreases Vehicle MODELID
  1349. if(leftright == KEY_LEFT) {
  1350. if(curPlayerVehM[playerid] == MIN_VEHI_ID) {
  1351. curPlayerVehM[playerid] = MAX_VEHI_ID;
  1352. }
  1353. else {
  1354. curPlayerVehM[playerid]--;
  1355. }
  1356. format(cString, 128, "Model ID: %d~n~Vehicle Name: %s", curPlayerVehM, aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID]);
  1357. GameTextForPlayer(playerid, cString, 1500, 3);
  1358. new Float:x, Float:y, Float:z, Float:a;
  1359. GetPlayerPos(playerid, x, y, z);
  1360. GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
  1361. GetPlayerFacingAngle(playerid, a);
  1362. DestroyVehicle(curPlayerVehI[playerid]);
  1363. curServerVehP[curPlayerVehI[playerid]][spawn] = false;
  1364. curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000);
  1365. printf( "vsel vehicle select id = %d", curPlayerVehI[playerid] );
  1366. LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));
  1367. curServerVehP[curPlayerVehI[playerid]][spawn] = true;
  1368. curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid];
  1369. curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid);
  1370. }
  1371. // Action key exits vehicle selection
  1372. if(keys & KEY_ACTION)
  1373. {
  1374. SetCameraBehindPlayer(playerid);
  1375. TogglePlayerControllable(playerid, 1);
  1376. format(cString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID], curPlayerVehM[playerid], curPlayerVehI[playerid]);
  1377. SendClientMessage(playerid, COLOR_GREEN, cString);
  1378. gPlayerStatus[playerid] = 0;
  1379. KillTimer(gPlayerTimers[playerid]);
  1380. }
  1381. }
  1382. #endif
  1383. #if OBJE_SELECT == true
  1384. public ObjectSelect( playerid )
  1385. {
  1386. new keys, updown, leftright;
  1387. GetPlayerKeys( playerid, keys, updown, leftright );
  1388. new cString[ 128 ];
  1389. switch ( curPlayerObjM[ playerid ][ OBJ_MOD ] )
  1390. {
  1391. case O_MODE_SELECTOR:
  1392. {
  1393. if ( updown == KEY_UP)
  1394. {
  1395. curPlayerObjM[ playerid ][ OBJ_MDL ] += 10;
  1396. if ( curPlayerObjM[ playerid ][ OBJ_MDL ] >= MAX_OBJE_ID )
  1397. {
  1398. curPlayerObjM[ playerid ][ OBJ_MDL ] = MIN_OBJE_ID;
  1399. }
  1400. while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) )
  1401. {
  1402. curPlayerObjM[ playerid ][ OBJ_MDL ]++;
  1403. }
  1404. DestroyObject( curPlayerObjI[ playerid ] );
  1405. curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ],
  1406. curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ],
  1407. curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ]
  1408. );
  1409. format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] );
  1410. GameTextForPlayer(playerid, cString, 1500, 3);
  1411. }
  1412. if ( updown == KEY_DOWN)
  1413. {
  1414. curPlayerObjM[ playerid ][ OBJ_MDL ] -= 10;
  1415. if ( curPlayerObjM[ playerid ][ OBJ_MDL ] <= MIN_OBJE_ID )
  1416. {
  1417. curPlayerObjM[ playerid ][ OBJ_MDL ] = MAX_OBJE_ID;
  1418. }
  1419. while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) )
  1420. {
  1421. curPlayerObjM[ playerid ][ OBJ_MDL ]--;
  1422. }
  1423. DestroyObject( curPlayerObjI[ playerid ] );
  1424. curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ],
  1425. curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ],
  1426. curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ]
  1427. );
  1428. format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] );
  1429. GameTextForPlayer(playerid, cString, 1500, 3);
  1430. }
  1431. if ( leftright == KEY_LEFT)
  1432. {
  1433. curPlayerObjM[ playerid ][ OBJ_MDL ]--;
  1434. if ( curPlayerObjM[ playerid ][ OBJ_MDL ] <= MIN_OBJE_ID )
  1435. {
  1436. curPlayerObjM[ playerid ][ OBJ_MDL ] = MAX_OBJE_ID;
  1437. }
  1438. while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) )
  1439. {
  1440. curPlayerObjM[ playerid ][ OBJ_MDL ]--;
  1441. }
  1442. DestroyObject( curPlayerObjI[ playerid ] );
  1443. curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ],
  1444. curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ],
  1445. curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ]
  1446. );
  1447. format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] );
  1448. GameTextForPlayer(playerid, cString, 1500, 3);
  1449. }
  1450. if ( leftright == KEY_RIGHT)
  1451. {
  1452. curPlayerObjM[ playerid ][ OBJ_MDL ]++;
  1453. if ( curPlayerObjM[ playerid ][ OBJ_MDL ] >= MAX_OBJE_ID )
  1454. {
  1455. curPlayerObjM[ playerid ][ OBJ_MDL ] = MIN_OBJE_ID;
  1456. }
  1457. while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) )
  1458. {
  1459. curPlayerObjM[ playerid ][ OBJ_MDL ]++;
  1460. }
  1461. DestroyObject( curPlayerObjI[ playerid ] );
  1462. curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ],
  1463. curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ],
  1464. curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ]
  1465. );
  1466. format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] );
  1467. GameTextForPlayer(playerid, cString, 1500, 3);
  1468. }
  1469. }
  1470. case O_MODE_MOVER:
  1471. {
  1472. if ( updown == KEY_UP)
  1473. {
  1474. curPlayerObjM[ playerid ][ OBJ_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1475. curPlayerCamD[ playerid ][ CPOS_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1476. curPlayerCamD[ playerid ][ CLOO_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1477. }
  1478. if ( updown == KEY_DOWN)
  1479. {
  1480. curPlayerObjM[ playerid ][ OBJ_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1481. curPlayerCamD[ playerid ][ CPOS_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1482. curPlayerCamD[ playerid ][ CLOO_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1483. }
  1484. if ( leftright == KEY_LEFT)
  1485. {
  1486. curPlayerObjM[ playerid ][ OBJ_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1487. curPlayerCamD[ playerid ][ CPOS_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1488. curPlayerCamD[ playerid ][ CLOO_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1489. }
  1490. if ( leftright == KEY_RIGHT)
  1491. {
  1492. curPlayerObjM[ playerid ][ OBJ_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1493. curPlayerCamD[ playerid ][ CPOS_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1494. curPlayerCamD[ playerid ][ CLOO_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1495. }
  1496. if ( keys & KEY_ANALOG_LEFT )
  1497. {
  1498. curPlayerObjM[ playerid ][ OBJ_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1499. curPlayerCamD[ playerid ][ CPOS_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1500. curPlayerCamD[ playerid ][ CLOO_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1501. }
  1502. if ( keys & KEY_ANALOG_LEFT )
  1503. {
  1504. curPlayerObjM[ playerid ][ OBJ_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1505. curPlayerCamD[ playerid ][ CPOS_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1506. curPlayerCamD[ playerid ][ CLOO_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ];
  1507. }
  1508. SetPlayerPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] );
  1509. SetObjectPos( curPlayerObjI[ playerid ], curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] );
  1510. SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]);
  1511. SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]);
  1512. }
  1513. case O_MODE_ROTATOR:
  1514. {
  1515. if ( updown == KEY_UP)
  1516. {
  1517. curPlayerObjM[ playerid ][ OBJ_RZ ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1518. }
  1519. if ( updown == KEY_DOWN)
  1520. {
  1521. curPlayerObjM[ playerid ][ OBJ_RZ ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1522. }
  1523. if ( leftright == KEY_LEFT)
  1524. {
  1525. curPlayerObjM[ playerid ][ OBJ_RY ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1526. }
  1527. if ( leftright == KEY_RIGHT)
  1528. {
  1529. curPlayerObjM[ playerid ][ OBJ_RY ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1530. }
  1531. if ( keys & KEY_ANALOG_LEFT )
  1532. {
  1533. curPlayerObjM[ playerid ][ OBJ_RY ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1534. }
  1535. if ( keys & KEY_ANALOG_LEFT )
  1536. {
  1537. curPlayerObjM[ playerid ][ OBJ_RX ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ];
  1538. }
  1539. SetObjectRot( curPlayerObjI[ playerid ], curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] );
  1540. }
  1541. }
  1542. if ( keys & KEY_ACTION )
  1543. {
  1544. gPlayerStatus[ playerid ] = 0;
  1545. TogglePlayerControllable( playerid, 1 );
  1546. SetCameraBehindPlayer( playerid );
  1547. KillTimer( gPlayerTimers[playerid] );
  1548. }
  1549. }
  1550. #endif
  1551. IsInvalidSkin(skinid)
  1552. { // Created by Simon
  1553. // Checks whether the skinid parsed is crashable or not.
  1554. #define MAX_BAD_SKINS 14
  1555. new badSkins[MAX_BAD_SKINS] = {
  1556. 3, 4, 5, 6, 8, 42, 65, 74, 86,
  1557. 119, 149, 208, 273, 289
  1558. };
  1559. for (new i = 0; i < MAX_BAD_SKINS; i++) {
  1560. if (skinid == badSkins[i]) return true;
  1561. }
  1562. return false;
  1563. }
  1564. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  1565. { // Created by Y_Less
  1566. new Float:a;
  1567. GetPlayerPos(playerid, x, y, a);
  1568. GetPlayerFacingAngle(playerid, a);
  1569. if (GetPlayerVehicleID(playerid)) {
  1570. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  1571. }
  1572. x += (distance * floatsin(-a, degrees));
  1573. y += (distance * floatcos(-a, degrees));
  1574. }
  1575. strtok(const string[], &index)
  1576. { // Created by Compuphase
  1577. new length = strlen(string);
  1578. while ((index < length) && (string[index] <= ' '))
  1579. {
  1580. index++;
  1581. }
  1582. new offset = index;
  1583. new result[20];
  1584. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1585. {
  1586. result[index - offset] = string[index];
  1587. index++;
  1588. }
  1589. result[index - offset] = EOS;
  1590. return result;
  1591. }
  1592. GetVehicleModelIDFromName(vname[])
  1593. {
  1594. for(new i = 0; i < 211; i++)
  1595. {
  1596. if ( strfind(aVehicleNames[i], vname, true) != -1 )
  1597. return i + MIN_VEHI_ID;
  1598. }
  1599. return -1;
  1600. }
  1601. GetWeaponModelIDFromName(wname[])
  1602. {
  1603. for(new i = 0; i < 48; i++) {
  1604. if (i == 19 || i == 20 || i == 21) continue;
  1605. if (strfind(aWeaponNames[i], wname, true) != -1) {
  1606. return i;
  1607. }
  1608. }
  1609. return -1;
  1610. }
  1611. IsValidModel(modelid)
  1612. {
  1613. // Created by Y_Less.
  1614. static modeldat[] =
  1615. {
  1616. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128,
  1617. -515899393, -134217729, -1, -1, 33554431, -1, -1, -1, -14337, -1, -33,
  1618. 127, 0, 0, 0, 0, 0, -8388608, -1, -1, -1, -16385, -1, -1, -1, -1, -1,
  1619. -1, -1, -33, -1, -771751937, -1, -9, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1620. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1621. -1, -1, -1, -1, -1, -1, -1, -1, 33554431, -25, -1, -1, -1, -1, -1, -1,
  1622. -1073676289, -2147483648, 34079999, 2113536, -4825600, -5, -1, -3145729,
  1623. -1, -16777217, -63, -1, -1, -1, -1, -201326593, -1, -1, -1, -1, -1,
  1624. -257, -1, 1073741823, -133122, -1, -1, -65, -1, -1, -1, -1, -1, -1,
  1625. -2146435073, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1073741823, -64, -1,
  1626. -1, -1, -1, -2635777, 134086663, 0, -64, -1, -1, -1, -1, -1, -1, -1,
  1627. -536870927, -131069, -1, -1, -1, -1, -1, -1, -1, -1, -16384, -1,
  1628. -33554433, -1, -1, -1, -1, -1, -1610612737, 524285, -128, -1,
  1629. 2080309247, -1, -1, -1114113, -1, -1, -1, 66977343, -524288, -1, -1, -1,
  1630. -1, -2031617, -1, 114687, -256, -1, -4097, -1, -4097, -1, -1,
  1631. 1010827263, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32768, -1, -1, -1, -1, -1,
  1632. 2147483647, -33554434, -1, -1, -49153, -1148191169, 2147483647,
  1633. -100781080, -262145, -57, 134217727, -8388608, -1, -1, -1, -1, -1, -1,
  1634. -1, -1, -1, -1, -1, -1, -1, -1, -1048577, -1, -449, -1017, -1, -1, -1,
  1635. -1, -1, -1, -1, -1, -1, -1, -1, -1835009, -2049, -1, -1, -1, -1, -1, -1,
  1636. -8193, -1, -536870913, -1, -1, -1, -1, -1, -87041, -1, -1, -1, -1, -1,
  1637. -1, -209860, -1023, -8388609, -2096897, -1, -1048577, -1, -1, -1, -1,
  1638. -1, -1, -897, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1610612737,
  1639. -3073, -28673, -1, -1, -1, -1537, -1, -1, -13, -1, -1, -1, -1, -1985,
  1640. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1056964609, -1, -1, -1,
  1641. -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1642. -236716037, -1, -1, -1, -1, -1, -1, -1, -536870913, 3, 0, 0, 0, 0, 0, 0,
  1643. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1644. 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1645. -1, -1, -1, -1, -1, -2097153, -2109441, -1, 201326591, -4194304, -1, -1,
  1646. -241, -1, -1, -1, -1, -1, -1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1647. 0, -32768, -1, -1, -1, -2, -671096835, -1, -8388609, -66323585, -13,
  1648. -1793, -32257, -247809, -1, -1, -513, 16252911, 0, 0, 0, -131072,
  1649. 33554383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1650. 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1651. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8356095, 0, 0, 0, 0, 0,
  1652. 0, -256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1653. -268435449, -1, -1, -2049, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  1654. 92274627, -65536, -2097153, -268435457, 591191935, 1, 0, -16777216, -1,
  1655. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127
  1656. };
  1657. if ((modelid >= 0) && ((modelid / 32) < sizeof (modeldat)) && (modeldat[modelid / 32] & (1 << (modelid % 32))))
  1658. {
  1659. return 1;
  1660. }
  1661. return 0;
  1662. }