2
0

YDBG2.pwn 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. /**
  2. *
  3. * YDBG.pwn
  4. * 2008 (c) LexSoftware Foundation, Alexander de Jong (mrdejong)
  5. * 2008 (c) Alex "Y_Less" cole
  6. *
  7. * Version 1.0.0 BETA
  8. *
  9. * YDBG comes with two lang files English and Dutch:
  10. * YDBG.en
  11. * YDBG.nl
  12. * YDBG_format.YSI
  13. *
  14. * All the files can be found in:
  15. * scriptfiles/YSI/
  16. *
  17. *
  18. * This file need to make all the property's, ammunation's, bank's.
  19. * This file can save also Area's and much more. With this file you can create your server
  20. * In a minute. It works allmost automatically that means that you don't need to
  21. * use much commands. No it's simple thinking, simple use thought
  22. *
  23. * This file saves all information in to an xml file "scriptfiles/YSI/YDBG" there you can find everything you need.
  24. *
  25. * This file loads every property's, ammunation's, bank's all what you want automatically.
  26. *
  27. * This file also uses an administration system, thats linked to the user system of YSI.
  28. * It's not really an adminisrator system, but i call him "BUILDERS" you can give people some rights
  29. * and they can use only the commands they have rights to :) simple?
  30. *
  31. *
  32. * I wish you all good luck with it. And keep SIMPLE THINKING if not you make it your self so dificult!
  33. *
  34. * cya arround homi's
  35. *
  36. * Alexander de Jong (mrdejong).
  37. *
  38. * This file is copyrighted and protected by the GNU General Public License
  39. * You can do all you want in this file, that will say if you don't like the working of something, easely edit it to your hand
  40. *
  41. * License:
  42. *
  43. * This program is free software: you can redistribute it and/or modify
  44. * it under the terms of the GNU General Public License as published by
  45. * the Free Software Foundation, either version 3 of the License, or
  46. * (at your option) any later version.
  47. *
  48. * This program is distributed in the hope that it will be useful,
  49. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  50. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  51. * GNU General Public License for more details.
  52. *
  53. * You should have received a copy of the GNU General Public License
  54. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  55. *
  56. * Complete license: (please read them)
  57. *
  58. * http://www.gnu.org/licenses/gpl.html
  59. *
  60. * If you don't agree with this license please don't use IT!
  61. *
  62. */
  63. // We are building a filterscript, that means we need to let know the system that it is a filterscript. So it is a child of the gamemode.
  64. #define FILTERSCRIPT
  65. #define _DEBUG 5
  66. // Setup all the defines we need:
  67. /**
  68. * Options
  69. */
  70. // Load options
  71. // #define NO_VEHICLE_LOAD
  72. // #define NO_PROPERTYS_LOAD
  73. // #define NO_MONEYPOINT_LOAD
  74. // #define NO_BANK_LOAD
  75. #define MAX_XML_FILES 30
  76. #include <YSI>
  77. enum binfo
  78. {
  79. blevel,
  80. Float:spos_x,
  81. Float:spos_y,
  82. Float:spos_z,
  83. Float:spos_a,
  84. sinterior,
  85. }
  86. new userinfo[MAX_PLAYERS][binfo];
  87. new userLoged[MAX_PLAYERS] = {-1, ...};
  88. // Menu var's
  89. new Menu:propertyMenu;
  90. new Menu:vehicleSpawn;
  91. new Menu:saveMenu;
  92. new Menu:propertyOptionsMenu;
  93. new propertyOption = 0;
  94. new SaveOption = 0;
  95. new MoneyOption = 0;
  96. new bankOption = 0;
  97. new popos[256];
  98. new pnames[256];
  99. new setup1[256];
  100. new setup2[256];
  101. // vars for the command permissions
  102. new spos;
  103. new lpos;
  104. new mkprop;
  105. new giveright;
  106. new veh;
  107. new savepos;
  108. new c_menu;
  109. new builder;
  110. new superbuilder;
  111. /**
  112. * forwards
  113. */
  114. forward ycmd_spos(playerid, params[], help);
  115. forward ycmd_lpos(playerid, params[], help);
  116. forward ycmd_kill(playerid, params[], help);
  117. forward ycmd_mkprop(playerid, params[], help);
  118. forward ycmd_giveright(playerid, params[], help);
  119. forward ycmd_gr(playerid, params[], help);
  120. forward ycmd_veh(playerid, params[], help);
  121. forward ycmd_menu(playerid, params[], help);
  122. forward ycmd_savepos(playerid, params[], help);
  123. forward ycmd_explain(playerid, params[], help);
  124. forward ycmd_hexplain(playerid, params[], help);
  125. forward ycmd_bgmx(playerid, params[], help);
  126. forward MkProp(playerid, prop1[], prop2[], prop3[], prop4[]);
  127. forward SpawnVehicle(playerid, vehicleid);
  128. forward LoadCars();
  129. forward LoadProp();
  130. forward Load_MoneyPoint();
  131. forward LoadBank();
  132. forward LoginDat_YDBG(playerid, identifier[], text[]);
  133. /**
  134. * Register tags for the lang files
  135. */
  136. Text_RegisterTag(info);
  137. Text_RegisterTag(complete);
  138. Text_RegisterTag(error);
  139. Script_OnFilterScriptInit()
  140. {
  141. print("\n------------------------------------");
  142. print(" YDBG Ysi DeBuG tool.");
  143. print(" 2008 (c) LexSoftware Foundation, Alexander de Jong");
  144. print(" 2008 (c) Alex \"Y_Less\" Cole");
  145. print(" Alex \"Y_Less\" Cole is also the founder of YSI");
  146. print("------------------------------------\n");
  147. // Set groups
  148. builder = Group_Create("Builder");
  149. superbuilder = Group_Create("Superbuilder");
  150. load_functions();
  151. Langs_AddLanguage("EN", "English");
  152. Langs_AddLanguage("NL", "Nederlands");
  153. Langs_AddFile("core", "YSI");
  154. Langs_AddFile("YDBG", "YSI");
  155. // ** Create the menu's
  156. /// Make the propertyOptionsMenu
  157. propertyOptionsMenu = CreateMenu("Property options", 2, 150.0, 150.0, 170.0, 200.0);
  158. AddMenuItem(propertyOptionsMenu, 0, "1. Bussinus"); // 0
  159. AddMenuItem(propertyOptionsMenu, 0, "2. Bank"); // 1
  160. AddMenuItem(propertyOptionsMenu, 0, "3. Ammunation"); // 2
  161. AddMenuItem(propertyOptionsMenu, 0, "4. Money area"); // 3
  162. AddMenuItem(propertyOptionsMenu, 0, "5. Money point"); // 4
  163. AddMenuItem(propertyOptionsMenu, 0, "6. Teleport"); // 5
  164. AddMenuItem(propertyOptionsMenu, 0, "7. Forbidden Area"); // 6
  165. AddMenuItem(propertyOptionsMenu, 0, "8. Houses"); // 7
  166. AddMenuItem(propertyOptionsMenu, 0, "9. Cancel"); // 8
  167. AddMenuItem(propertyOptionsMenu, 1, "CreateProperty");
  168. AddMenuItem(propertyOptionsMenu, 1, "CreateBank");
  169. AddMenuItem(propertyOptionsMenu, 1, "CreateAmmunation");
  170. AddMenuItem(propertyOptionsMenu, 1, "CreateMoneyArea");
  171. AddMenuItem(propertyOptionsMenu, 1, "CreateMoneyPoint");
  172. AddMenuItem(propertyOptionsMenu, 1, "CreateTeleport");
  173. AddMenuItem(propertyOptionsMenu, 1, "CreateForbiddenArea");
  174. /// Make property menu:
  175. propertyMenu = CreateMenu("Property builder", 1, 10.0, 150.0, 225.0);
  176. AddMenuItem(propertyMenu, 0, "1. Make property");
  177. AddMenuItem(propertyMenu, 0, "2. Give a name");
  178. AddMenuItem(propertyMenu, 0, "3. Setup 1");
  179. AddMenuItem(propertyMenu, 0, "4. Setup 2");
  180. AddMenuItem(propertyMenu, 0, "5. Cancel");
  181. // /savep menu
  182. saveMenu = CreateMenu("Save options", 1, 200.0, 150.0, 200.0);
  183. AddMenuItem(saveMenu, 0, "1. Save vehicles");
  184. AddMenuItem(saveMenu, 0, "2. Save custom positions");
  185. AddMenuItem(saveMenu, 0, "3. Save pickups");
  186. AddMenuItem(saveMenu, 0, "4. Save arrea's");
  187. AddMenuItem(saveMenu, 0, "5. Cancel");
  188. /**
  189. * Make a vehicle menu;
  190. * This is used if the builder doesn't have add a vulue when typing /veh
  191. */
  192. vehicleSpawn = CreateMenu("Vehicle Menu", 2, 200.0, 100.0, 100.0, 125.0);
  193. AddMenuItem(vehicleSpawn, 0, "521 Bike :"); // FCR-900
  194. AddMenuItem(vehicleSpawn, 0, "522 Bike :"); // NRG-500
  195. AddMenuItem(vehicleSpawn, 0, "463 Bike :"); // Freeway
  196. AddMenuItem(vehicleSpawn, 0, "541 Car :"); // Bullet
  197. AddMenuItem(vehicleSpawn, 0, "411 Car :"); // Invernus
  198. AddMenuItem(vehicleSpawn, 0, "482 Bus :"); // Buritto
  199. AddMenuItem(vehicleSpawn, 0, "487 Heli :"); // Maverick
  200. AddMenuItem(vehicleSpawn, 1, "FCR-900");
  201. AddMenuItem(vehicleSpawn, 1, "NRG-500");
  202. AddMenuItem(vehicleSpawn, 1, "Freeway");
  203. AddMenuItem(vehicleSpawn, 1, "Bullet");
  204. AddMenuItem(vehicleSpawn, 1, "Invernus");
  205. AddMenuItem(vehicleSpawn, 1, "Buritto");
  206. AddMenuItem(vehicleSpawn, 1, "Maverick");
  207. /**
  208. * Load xml init
  209. */
  210. load_xml_init();
  211. return 1;
  212. }
  213. /**
  214. * This command is only for testing
  215. */
  216. public ycmd_menu(playerid, params[], help)
  217. {
  218. #pragma unused params, help
  219. ShowMenu(propertyOptionsMenu, playerid);
  220. return 1;
  221. }
  222. Script_OnFilterScriptExit()
  223. {
  224. return 1;
  225. }
  226. Script_OnGameModeInit()
  227. {
  228. printf("call OGMI");
  229. return 1;
  230. }
  231. Script_OnGameModeExit()
  232. {
  233. Master_@Master();
  234. return 1;
  235. }
  236. Script_OnPlayerRequestClass(playerid, classid)
  237. {
  238. return 1;
  239. }
  240. Script_OnPlayerRequestSpawnEx(playerid, classid)
  241. {
  242. return 1;
  243. }
  244. Script_OnPlayerConnect(playerid)
  245. {
  246. Command_SetPlayerUseByID(spos, playerid, 0);
  247. Command_SetPlayerUseByID(lpos, playerid, 0);
  248. Command_SetPlayerUseByID(mkprop, playerid, 0);
  249. Command_SetPlayerUseByID(giveright, playerid, 0);
  250. Command_SetPlayerUseByID(veh, playerid, 0);
  251. Command_SetPlayerUseByID(savepos, playerid, 0);
  252. Command_SetPlayerUseByID(c_menu, playerid, 0);
  253. return 1;
  254. }
  255. Script_OnPlayerDisconnect(playerid, reason)
  256. {
  257. #pragma unused reason, playerid
  258. return 1;
  259. }
  260. Script_OnPlayerSpawn(playerid)
  261. {
  262. return 1;
  263. }
  264. Script_OnPlayerDeath(playerid, killerid, reason)
  265. {
  266. return 1;
  267. }
  268. Script_OnVehicleSpawn(vehicleid)
  269. {
  270. return 1;
  271. }
  272. Script_OnVehicleDeath(vehicleid, killerid)
  273. {
  274. return 1;
  275. }
  276. Script_OnPlayerText(playerid, text[])
  277. {
  278. if(propertyOption >= 1)
  279. {
  280. new str[256]; // This is for the format lines
  281. switch(propertyOption)
  282. {
  283. case 1:
  284. {
  285. if(!FindText(text, "yes", 3))
  286. {
  287. new
  288. Float:x,
  289. Float:y,
  290. Float:z;
  291. GetPlayerPos(playerid, x, y, z);
  292. format(str, sizeof(str), "%f, %f, %f", x, y, z);
  293. popos = str;
  294. Text_Send(playerid, "YDBG_PROP_ADD_1");
  295. propertyOption = 0;
  296. return 0;
  297. }
  298. }
  299. case 2:
  300. {
  301. new name[60];
  302. if(GetText(text, 60, name))
  303. {
  304. pnames = name;
  305. Text_Send(playerid, "YDBG_PROP_ADD_2");
  306. propertyOption = 0;
  307. return 0;
  308. }
  309. }
  310. case 3:
  311. {
  312. new opt[125];
  313. if(GetText(text, 125, opt))
  314. {
  315. setup1 = opt;
  316. Text_Send(playerid, "YDBG_PROP_ADD_3");
  317. propertyOption = 0;
  318. return 0;
  319. }
  320. }
  321. case 4:
  322. {
  323. new opt2[125];
  324. if(GetText(text, 125, opt2))
  325. {
  326. setup2 = opt2;
  327. Text_Send(playerid, "YDBG_PROP_ADD_4");
  328. Text_Send(playerid, "YDBG_PROP_ADD_5");
  329. propertyOption = 522;
  330. return 0;
  331. }
  332. }
  333. }
  334. }
  335. if(!FindText(text, "save", 4) && propertyOption == 522)
  336. {
  337. propertyOption = 0;
  338. MkProp(playerid, popos, pnames, setup1, setup2);
  339. return 0;
  340. }
  341. if(MoneyOption >= 1)
  342. {
  343. switch(MoneyOption)
  344. {
  345. case 1:
  346. {
  347. if(!FindText(text, "yes", 4))
  348. {
  349. Text_Send(playerid, "YDBG_MP_INFO_1.1");
  350. Text_Send(playerid, "YDBG_MP_INFO_1.2");
  351. Text_Send(playerid, "YDBG_MP_INFO_1.3");
  352. Text_Send(playerid, "YDBG_MP_INFO_1.4");
  353. Text_Send(playerid, "YDBG_MP_INFO_1.5");
  354. Text_Send(playerid, "YDBG_MP_INFO_1.6");
  355. Text_Send(playerid, "YDBG_MP_INFO_1.7");
  356. Text_Send(playerid, "YDBG_MP_INFO_1.8");
  357. MoneyOption = 2;
  358. return 0;
  359. }
  360. }
  361. case 2:
  362. {
  363. new options[125];
  364. new str[256];
  365. GetText(text, 125, options);
  366. new xmlMpoint = XML_AddItem("moneypoint");
  367. new Float:x, Float:y, Float:z;
  368. GetPlayerPos(playerid, x, y, z);
  369. XML_AddParameter(xmlMpoint, "options", options);
  370. format(str, sizeof(str), "%f, %f, %f", x, y, z);
  371. XML_AddParameter(xmlMpoint, "position", str);
  372. XML_WriteItem("YSI/YDBG/moneypoint.xml", xmlMpoint);
  373. Text_Send(playerid, "YDBG_MP_ADD");
  374. MoneyOption = 255;
  375. return 0;
  376. }
  377. }
  378. }
  379. if(bankOption >= 1)
  380. {
  381. switch(bankOption)
  382. {
  383. case 1:
  384. {
  385. if(!FindText(text, "yes", 3))
  386. {
  387. Text_Send(playerid, "YDBG_BANK_INFO_1");
  388. Text_Send(playerid, "YDBG_BANK_INFO_2");
  389. bankOption = 2;
  390. return 0;
  391. }
  392. }
  393. case 2:
  394. {
  395. new name[125];
  396. new str[256];
  397. GetText(text, 125, name);
  398. new xmlBank = XML_AddItem("bank");
  399. new Float:x, Float:y, Float:z;
  400. GetPlayerPos(playerid, x, y, z);
  401. format(str, sizeof(str), "%f, %f, %f", x, y, z);
  402. XML_AddParameter(xmlBank, "position", str);
  403. XML_AddParameter(xmlBank, "name", name);
  404. XML_WriteItem("YSI/YDBG/bank.xml", xmlBank);
  405. Text_Send(playerid, "YDBG_BANK_ADD");
  406. bankOption = 255;
  407. return 0;
  408. }
  409. }
  410. }
  411. return 1;
  412. }
  413. Script_OnPlayerPrivmsg(playerid, recieverid, text[])
  414. {
  415. return 1;
  416. }
  417. Script_OnPlayerCommandText(playerid, cmdtext[])
  418. {
  419. return Command_Process(playerid, cmdtext);
  420. }
  421. Script_OnPlayerInfoChange(playerid)
  422. {
  423. return 1;
  424. }
  425. Script_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  426. {
  427. return 1;
  428. }
  429. Script_OnPlayerExitVehicle(playerid, vehicleid)
  430. {
  431. return 1;
  432. }
  433. Script_OnPlayerStateChange(playerid, newstate, oldstate)
  434. {
  435. return 1;
  436. }
  437. Script_OnPlayerEnterCheckpointEx(playerid, cpid)
  438. {
  439. return 1;
  440. }
  441. Script_OnPlayerLeaveCheckpointEx(playerid, cpid)
  442. {
  443. return 1;
  444. }
  445. Script_OnPlayerEnterRaceCheckpoint(playerid)
  446. {
  447. return 1;
  448. }
  449. Script_OnPlayerLeaveRaceCheckpoint(playerid)
  450. {
  451. return 1;
  452. }
  453. Script_OnRconCommand(cmd[])
  454. {
  455. return 1;
  456. }
  457. Script_OnPlayerPickUpPickup(playerid, pickupid)
  458. {
  459. return 1;
  460. }
  461. Script_OnPlayerSelectedMenuRow(playerid, row)
  462. {
  463. new Menu:PlayerMenu = GetPlayerMenu(playerid);
  464. // Property Option menu
  465. if(PlayerMenu == propertyOptionsMenu)
  466. {
  467. switch(row)
  468. {
  469. case 0:
  470. {
  471. ShowMenu(propertyMenu, playerid);
  472. }
  473. case 1:
  474. {
  475. Text_Send(playerid, "YDBG_BANK_INFO_3");
  476. Text_Send(playerid, "YDBG_BANK_INFO_4");
  477. bankOption = 1;
  478. }
  479. case 4:
  480. {
  481. MoneyOption = 1;
  482. Text_Send(playerid, "YDBG_MP_INFO_2.1");
  483. Text_Send(playerid, "YDBG_MP_INFO_2.2");
  484. }
  485. case 7:
  486. {
  487. new Float:x, Float:y, Float:z;
  488. GetPlayerPos(playerid, x, y, z);
  489. new xmlHouse = XML_AddItem("house");
  490. new str[256];
  491. format(str, sizeof(str), "%f, %f, %f", x, y, z);
  492. XML_AddParameter(xmlHouse, "position", str);
  493. XML_WriteItem("propertys/houses.xml", xmlHouse);
  494. }
  495. default:
  496. {
  497. Text_Send(playerid, "YDBG_MENU_NOT_EXIST");
  498. }
  499. }
  500. TogglePlayerControllable(playerid, 1);
  501. }
  502. // PorpertyMenu
  503. if(PlayerMenu == propertyMenu)
  504. {
  505. switch(row)
  506. {
  507. case 0:
  508. {
  509. Text_Send(playerid, "YDBG_PROP_INFO_1");
  510. Text_Send(playerid, "YDBG_PROP_INFO_2");
  511. Text_Send(playerid, "YDBG_PROP_INFO_3");
  512. propertyOption = 1;
  513. }
  514. case 1:
  515. {
  516. Text_Send(playerid, "YDBG_PROP_INFO_4");
  517. propertyOption = 2;
  518. }
  519. case 2:
  520. {
  521. Text_Send(playerid, "YDBG_PROP_INFO_5");
  522. Text_Send(playerid, "YDBG_PROP_INFO_6");
  523. Text_Send(playerid, "YDBG_PROP_INFO_7");
  524. Text_Send(playerid, "YDBG_PROP_INFO_8");
  525. Text_Send(playerid, "YDBG_PROP_INFO_9");
  526. Text_Send(playerid, "YDBG_PROP_INFO_10");
  527. Text_Send(playerid, "YDBG_PROP_INFO_11");
  528. Text_Send(playerid, "YDBG_PROP_INFO_12");
  529. propertyOption = 3;
  530. }
  531. case 3:
  532. {
  533. Text_Send(playerid, "YDBG_PROP_INFO_13");
  534. Text_Send(playerid, "YDBG_PROP_INFO_14");
  535. Text_Send(playerid, "YDBG_PROP_INFO_15");
  536. Text_Send(playerid, "YDBG_PROP_INFO_16");
  537. Text_Send(playerid, "YDBG_PROP_INFO_17");
  538. Text_Send(playerid, "YDBG_PROP_INFO_18");
  539. Text_Send(playerid, "YDBG_PROP_INFO_19");
  540. Text_Send(playerid, "YDBG_PROP_INFO_20");
  541. Text_Send(playerid, "YDBG_PROP_INFO_21");
  542. Text_Send(playerid, "YDBG_PROP_INFO_22");
  543. propertyOption = 4;
  544. }
  545. }
  546. TogglePlayerControllable(playerid, 1);
  547. }
  548. // Vehicle menu
  549. if(PlayerMenu == vehicleSpawn)
  550. {
  551. switch(row)
  552. {
  553. case 0:
  554. {
  555. SpawnVehicle(playerid, 521);
  556. }
  557. case 1:
  558. {
  559. SpawnVehicle(playerid, 522);
  560. }
  561. case 2:
  562. {
  563. SpawnVehicle(playerid, 463);
  564. }
  565. case 3:
  566. {
  567. SpawnVehicle(playerid, 541);
  568. }
  569. case 4:
  570. {
  571. SpawnVehicle(playerid, 411);
  572. }
  573. case 5:
  574. {
  575. SpawnVehicle(playerid, 482);
  576. }
  577. case 6:
  578. {
  579. SpawnVehicle(playerid, 487);
  580. }
  581. }
  582. TogglePlayerControllable(playerid, 1);
  583. }
  584. if(PlayerMenu == saveMenu)
  585. {
  586. switch(row)
  587. {
  588. case 0:
  589. {
  590. SaveOption = 1;
  591. SendClientMessage(playerid, 0x00FF00AA, "Gebruik nu /savepos om de auto's op te slaan");
  592. }
  593. case 1:
  594. {
  595. SaveOption = 2;
  596. SendClientMessage(playerid, 0x00FF00AA, "Costum position selected use /savepos");
  597. }
  598. case 2:
  599. {
  600. SaveOption = 3;
  601. SendClientMessage(playerid, 0x00FF00AA, "Pickups gebruik nu /savepos [pickupid]");
  602. }
  603. case 3:
  604. {
  605. SaveOption = 4;
  606. SendClientMessage(playerid, 0x00FF00AA, "DEZE OPTIE IS NOG NIET INGEBOUWD");
  607. }
  608. case 4:
  609. {
  610. HideMenuForPlayer(saveMenu, playerid);
  611. }
  612. }
  613. TogglePlayerControllable(playerid, 1);
  614. }
  615. return 1;
  616. }
  617. Script_OnPlayerExitedMenu(playerid)
  618. {
  619. TogglePlayerControllable(playerid, 1);
  620. return 1;
  621. }
  622. Script_OnVehicleMod(vehicleid, componentid)
  623. {
  624. return 1;
  625. }
  626. Script_OnVehiclePaintjob(vehicleid, paintjobid)
  627. {
  628. return 1;
  629. }
  630. Script_OnVehicleRespray(vehicleid, color1, color2)
  631. {
  632. return 1;
  633. }
  634. Script_OnPlayerLogin(playerid, yid)
  635. {
  636. userLoged[playerid] = 1;
  637. return 1;
  638. }
  639. Script_OnPlayerLogout(playerid, yid)
  640. {
  641. Debug_Print_1("Script_OnPlayerLogout");
  642. userLoged[playerid] = 0;
  643. if(Group_HasPlayer(builder, playerid))
  644. {
  645. Group_RemovePlayer(builder, playerid);
  646. }
  647. if(Group_HasPlayer(superbuilder, playerid))
  648. {
  649. Group_RemovePlayer(superbuilder, playerid);
  650. }
  651. new playersIp[20];
  652. GetPlayerIp(playerid, playersIp, 20);
  653. // Write the user information
  654. Player_SetTag("YDBG");
  655. Player_WriteInt("blevel", userinfo[playerid][blevel]);
  656. Player_WriteFloat("spos_x", userinfo[playerid][spos_x]);
  657. Player_WriteFloat("spos_y", userinfo[playerid][spos_y]);
  658. Player_WriteFloat("spos_z", userinfo[playerid][spos_z]);
  659. Player_WriteFloat("spos_a", userinfo[playerid][spos_a]);
  660. Player_WriteInt("sinterior", userinfo[playerid][sinterior]);
  661. return 1;
  662. }
  663. Script_OnPlayerEnterArea(playerid, areaid)
  664. {
  665. return 1;
  666. }
  667. Script_OnPlayerLeaveArea(playerid, areaid)
  668. {
  669. return 1;
  670. }
  671. Script_OnRaceEnd(raceid)
  672. {
  673. return 1;
  674. }
  675. Script_OnPlayerExitRace(playerid, raceid)
  676. {
  677. return 1;
  678. }
  679. Script_OnPlayerFinishRace(playerid, raceid, position, prize, time)
  680. {
  681. return 1;
  682. }
  683. Script_OnDynamicObjectMoved(objectid)
  684. {
  685. return 1;
  686. }
  687. Script_OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  688. {
  689. return 1;
  690. }
  691. Script_OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  692. {
  693. return 1;
  694. }
  695. Script_OnPlayerKeyPress(playerid, key)
  696. {
  697. return 1;
  698. }
  699. Script_OnPlayerKeyRelease(playerid, key)
  700. {
  701. return 1;
  702. }
  703. Script_OnGangWarCapture(zoneid, attacker, defender)
  704. {
  705. return 1;
  706. }
  707. Script_OnGangWarStart(zoneid, attacker, defender)
  708. {
  709. return 1;
  710. }
  711. Script_OnGangWarDefend(zoneid, attacker, defender)
  712. {
  713. return 1;
  714. }
  715. /**
  716. * Commands
  717. */
  718. public ycmd_kill(playerid, params[], help)
  719. {
  720. #pragma unused help, params
  721. SetPlayerHealth(playerid, 0.0);
  722. return 1;
  723. }
  724. public ycmd_spos(playerid, params[], help)
  725. {
  726. #pragma unused help, params
  727. new Float:x, Float:y, Float:z, Float:a;
  728. GetPlayerPos(playerid, x, y, z);
  729. GetPlayerFacingAngle(playerid, a);
  730. new intid;
  731. intid = GetPlayerInterior(playerid);
  732. userinfo[playerid][spos_x] = x;
  733. userinfo[playerid][spos_y] = y;
  734. userinfo[playerid][spos_z] = z;
  735. userinfo[playerid][spos_a] = a;
  736. userinfo[playerid][sinterior] = intid;
  737. return 1;
  738. }
  739. public ycmd_lpos(playerid, params[], help)
  740. {
  741. #pragma unused help, params
  742. SetPlayerPos(playerid, userinfo[playerid][spos_x], userinfo[playerid][spos_y], userinfo[playerid][spos_z]);
  743. SetPlayerFacingAngle(playerid, userinfo[playerid][spos_a]);
  744. SetPlayerInterior(playerid, userinfo[playerid][sinterior]);
  745. return 1;
  746. }
  747. public ycmd_mkprop(playerid, params[], help)
  748. {
  749. #pragma unused help, params
  750. ShowMenu(propertyMenu, playerid);
  751. return 1;
  752. }
  753. public ycmd_giveright(playerid, params[], help)
  754. {
  755. #pragma unused help
  756. new
  757. bblevel,
  758. giveid;
  759. if(sscanf(params, "i", bblevel)) SendClientMessage(playerid, 0xff0000AA, "USAGE: /giveright [playerid] [builder] (1 = builder 2 = sbuilder)");
  760. else
  761. {
  762. switch(bblevel)
  763. {
  764. case 1:
  765. {
  766. userinfo[playerid][blevel] = 1;
  767. Group_AddPlayer(builder, giveid);
  768. }
  769. case 2:
  770. {
  771. userinfo[playerid][blevel] = 2;
  772. Group_AddPlayer(superbuilder, giveid);
  773. }
  774. }
  775. }
  776. return 1;
  777. }
  778. public ycmd_gr(playerid, params[], help)
  779. {
  780. #pragma unused help, params
  781. if(IsPlayerAdmin(playerid))
  782. {
  783. userinfo[playerid][blevel] = 2;
  784. Group_AddPlayer(superbuilder, playerid);
  785. SendClientMessage(playerid, 0x00FF00AA, "You are now SuperBuilder");
  786. }
  787. return 1;
  788. }
  789. public ycmd_veh(playerid, params[], help)
  790. {
  791. #pragma unused help
  792. new vehicle;
  793. if(sscanf(params, "i", vehicle)) ShowMenu(vehicleSpawn, playerid);
  794. else
  795. {
  796. SpawnVehicle(playerid, vehicle);
  797. }
  798. return 1;
  799. }
  800. public ycmd_savepos(playerid, params[], help)
  801. {
  802. #pragma unused help
  803. new menushoww;
  804. sscanf(params, "i", menushoww);
  805. if(menushoww == 522) ShowMenu(saveMenu, playerid);
  806. else
  807. {
  808. switch(SaveOption)
  809. {
  810. case 1:
  811. {
  812. new command[256];
  813. sscanf(params, "z", command);
  814. new vehicle = GetPlayerVehicleID(playerid);
  815. new Float:x, Float:y, Float:z, Float:a;
  816. GetVehiclePos(vehicle, x, y, z);
  817. GetVehicleZAngle(vehicle, a);
  818. new str[256];
  819. format(str, sizeof(str), "%s", command);
  820. new xml_cars = XML_AddItem("vehicle", str);
  821. format(str, sizeof(str), "%f, %f, %f, %f", x, y, z, a);
  822. XML_AddParameter(xml_cars, "position", str);
  823. format(str, sizeof(str), "%i", GetVehicleModel(vehicle));
  824. XML_AddParameter(xml_cars, "model", str);
  825. XML_WriteItem("YSI/YDBG/cars.xml", xml_cars);
  826. }
  827. case 2:
  828. {
  829. new command[256];
  830. sscanf(params, "z", command);
  831. new Float:x, Float:y, Float:z, Float:a;
  832. GetPlayerPos(playerid, x, y, z);
  833. GetPlayerFacingAngle(playerid, a);
  834. }
  835. default:
  836. {
  837. ShowMenu(saveMenu, playerid);
  838. }
  839. }
  840. }
  841. return 1;
  842. }
  843. new Text:showTxt;
  844. public ycmd_explain(playerid, params[], help)
  845. {
  846. #pragma unused params, help
  847. showTxt = TextDrawCreate(130, 50, "Welkom,\
  848. ~n~~n~\
  849. you want some explaining, here you GOOOO!\
  850. ~n~~n~\
  851. this sytem....");
  852. TextDrawFont(showTxt, 1);
  853. TextDrawSetShadow(showTxt, 2);
  854. TextDrawUseBox(showTxt, 1);
  855. TextDrawLetterSize(showTxt, 0.3, 0.3);
  856. TextDrawTextSize(showTxt, 430, 350);
  857. TextDrawBoxColor(showTxt, 0x00000AA);
  858. TextDrawShowForPlayer(playerid, showTxt);
  859. return 1;
  860. }
  861. public ycmd_hexplain(playerid, params[], help)
  862. {
  863. #pragma unused params, help
  864. TextDrawHideForPlayer(playerid, showTxt);
  865. return 1;
  866. }
  867. /**
  868. * Functions
  869. */
  870. stock IsBuilder(playerid, level)
  871. {
  872. if(userinfo[playerid][blevel] == level)
  873. {
  874. return 1;
  875. }
  876. return 0;
  877. }
  878. stock IsBuilderEx(playerid, from, to)
  879. {
  880. if(userinfo[playerid][blevel] >= from && userinfo[playerid][blevel] <= to)
  881. {
  882. return 1;
  883. }
  884. return 0;
  885. }
  886. stock IsValidVehicle(carid)
  887. {
  888. if(carid >= 400 && carid <= 611)
  889. {
  890. return 1;
  891. }
  892. return 0;
  893. }
  894. public SpawnVehicle(playerid, vehicleid)
  895. {
  896. if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, 0xFF0000AA, "Get off the vehicle please ...");
  897. else if(!IsValidVehicle(vehicleid)) SendClientMessage(playerid, 0xFF0000AA, "Invallid vehicle");
  898. else
  899. {
  900. new Float:x, Float:y, Float:z, Float:a;
  901. GetPlayerPos(playerid, x, y, z);
  902. GetPlayerFacingAngle(playerid, a);
  903. new spcar;
  904. spcar = CreateVehicle(vehicleid, x+2.0, y, z, a, -1, -1, 100000);
  905. PutPlayerInVehicle(playerid, spcar, 0);
  906. Debug_Print_1("%i is spawned", vehicleid);
  907. }
  908. }
  909. stock ShowMenu(Menu:smenu, playerid)
  910. {
  911. TogglePlayerControllable(playerid, 0);
  912. ShowMenuForPlayer(smenu, playerid);
  913. return 1;
  914. }
  915. public MkProp(playerid, prop1[], prop2[], prop3[], prop4[])
  916. {
  917. new xml_prop = XML_AddItem("property", prop2);
  918. XML_AddParameter(xml_prop, "position", prop1);
  919. XML_AddParameter(xml_prop, "name", prop2);
  920. XML_AddParameter(xml_prop, "options_1", prop3);
  921. XML_AddParameter(xml_prop, "options_2", prop4);
  922. XML_WriteItem("YSI/YDBG/prop.xml", xml_prop);
  923. Text_Send(playerid, "YDBG_PROP_ADD_6");
  924. return 1;
  925. }
  926. /**
  927. native YDBG_FUNCTIONS
  928. native
  929. native FindText(text[], find[], maxlength, &output = '', outp = false);
  930. native GetText(text[], &output);
  931. */
  932. stock FindText(text[], find[], maxlength)
  933. {
  934. if(strlen(text) <= maxlength)
  935. {
  936. if(strfind(text, find))
  937. {
  938. return 1;
  939. }
  940. }
  941. return 0;
  942. }
  943. stock GetText(text[], maxlength, output[])
  944. {
  945. if(strlen(text) <= maxlength)
  946. {
  947. format(output, maxlength, "%s", text);
  948. return 1;
  949. }
  950. return 0;
  951. }
  952. /**
  953. * Call the builder login
  954. * Load data functions
  955. */
  956. public LoginDat_YDBG(playerid, identifier[], text[])
  957. {
  958. Debug_Print_1("LoginDat_YDBG");
  959. if(!strcmp(identifier, "blevel")) userinfo[playerid][blevel] = strval(text);
  960. else if(!strcmp(identifier, "spos_x")) userinfo[playerid][spos_x] = floatstr(text);
  961. else if(!strcmp(identifier, "spos_y")) userinfo[playerid][spos_y] = floatstr(text);
  962. else if(!strcmp(identifier, "spos_z")) userinfo[playerid][spos_z] = floatstr(text);
  963. else if(!strcmp(identifier, "spos_a")) userinfo[playerid][spos_a] = floatstr(text);
  964. else if(!strcmp(identifier, "sinterior")) userinfo[playerid][sinterior] = strval(text);
  965. if(userinfo[playerid][blevel] == 1)
  966. {
  967. SetPlayerColor(playerid, 0x12bddbAA);
  968. SendClientMessage(playerid, 0x00FF00AA, "You are as builder loged in");
  969. Group_AddPlayer(builder, playerid);
  970. }
  971. if(userinfo[playerid][blevel] == 2)
  972. {
  973. SetPlayerColor(playerid, 0x017a8cAA);
  974. SendClientMessage(playerid, 0x00FF00AA, "You are as Superbuilder loged in");
  975. Group_AddPlayer(superbuilder, playerid);
  976. }
  977. return 1;
  978. }
  979. public LoadCars()
  980. {
  981. static
  982. key[MAX_XML_ENTRY_NAME],
  983. val[MAX_XML_ENTRY_TEXT];
  984. new
  985. model,
  986. pos[256];
  987. while (XML_GetKeyValue(key, val))
  988. {
  989. if(!strcmp(key, "model")) model = strval(val);
  990. else if(!strcmp(key, "position")) pos = val;
  991. }
  992. new dest[4][256];
  993. explode(pos, dest, ',');
  994. // printf("Model: %i x: %f y: %f z: %f a: %f", model, floatstr(dest[0]), floatstr(dest[1]), floatstr(dest[2]), floatstr(dest[3]));
  995. CreateVehicle(model, floatstr(dest[0]), floatstr(dest[1]), floatstr(dest[2]), floatstr(dest[3]), -1, -1, 1000);
  996. }
  997. public LoadProp()
  998. {
  999. static
  1000. key[MAX_XML_ENTRY_NAME],
  1001. val[MAX_XML_ENTRY_TEXT];
  1002. new
  1003. options_1[256],
  1004. options_2[256],
  1005. name[256],
  1006. pos[256];
  1007. while (XML_GetKeyValue(key, val))
  1008. {
  1009. if(!strcmp(key, "options_2")) options_2 = val;
  1010. else if(!strcmp(key, "options_1")) options_1 = val;
  1011. else if(!strcmp(key, "name")) name = val;
  1012. else if(!strcmp(key, "position")) pos = val;
  1013. }
  1014. new opt1[3][30];
  1015. new opt2[5][30];
  1016. new dest[3][30];
  1017. explode(options_1, opt1, ',');
  1018. explode(options_2, opt2, ',');
  1019. explode(pos, dest, ',');
  1020. // printf("Setups: 1: %i 2: %i 3: %i 4: %i 5: %i 6: %i 7: %i 8: %i", strval(opt1[0]), strval(opt1[1]), strval(opt1[2]), strval(opt2[0]), strval(opt2[1]), strval(opt2[2]), strval(opt2[3]), strval(opt2[4]));
  1021. // printf("Name: %s Position: %f, %f, %f", name, floatstr(dest[0]), floatstr(dest[1]), floatstr(dest[2]));
  1022. CreateProperty(name, floatstr(dest[0]), floatstr(dest[1]), floatstr(dest[2]), strval(opt1[0]), strval(opt1[1]), strval(opt1[2]), strval(opt2[0]), strval(opt2[1]), strval(opt2[2]), strval(opt2[3]), strval(opt2[4]));
  1023. }
  1024. public Load_MoneyPoint()
  1025. {
  1026. static
  1027. key[MAX_XML_ENTRY_NAME],
  1028. val[MAX_XML_ENTRY_TEXT];
  1029. new
  1030. pos[256],
  1031. options[256];
  1032. while (XML_GetKeyValue(key, val))
  1033. {
  1034. if(!strcmp(key, "position")) pos = val;
  1035. else if(!strcmp(key, "options")) options = val;
  1036. }
  1037. new posdest[3][30];
  1038. new optdest[2][30];
  1039. explode(pos, posdest, ',');
  1040. explode(options, optdest, ',');
  1041. // printf("POS: %f, %f, %f OPTIONS: %i, %i", floatstr(posdest[0]), floatstr(posdest[1]), floatstr(posdest[2]), strval(optdest[0]), strval(optdest[1]));
  1042. CreateMoneyPoint(floatstr(posdest[0]), floatstr(posdest[1]), floatstr(posdest[2]), 2.0, strval(optdest[0]), strval(optdest[1]));
  1043. }
  1044. public LoadBank()
  1045. {
  1046. static
  1047. key[MAX_XML_ENTRY_NAME],
  1048. val[MAX_XML_ENTRY_TEXT];
  1049. new
  1050. posi[256],
  1051. name[256];
  1052. while (XML_GetKeyValue(key, val))
  1053. {
  1054. if(!strcmp(key, "name")) name = val;
  1055. else if(!strcmp(key, "position")) posi = val;
  1056. }
  1057. new posidest[3][30];
  1058. explode(posi, posidest, ',');
  1059. printf("POS: %f, %f, %f NAME: %s", floatstr(posidest[0]), floatstr(posidest[1]), floatstr(posidest[2]), name);
  1060. CreateBank(floatstr(posidest[0]), floatstr(posidest[1]), floatstr(posidest[2]), name);
  1061. }
  1062. stock load_functions()
  1063. {
  1064. ycmd(kill);
  1065. ycmd(gr);
  1066. ycmd(explain);
  1067. ycmd(hexplain);
  1068. c_menu = ycmd(menu);
  1069. spos = ycmd(spos);
  1070. lpos = ycmd(lpos);
  1071. mkprop = ycmd(mkprop);
  1072. giveright = ycmd(giveright);
  1073. veh = ycmd(veh);
  1074. savepos = ycmd(savepos);
  1075. Group_SetDefaultCommandByID(spos, 0);
  1076. Group_SetDefaultCommandByID(lpos, 0);
  1077. Group_SetDefaultCommandByID(mkprop, 0);
  1078. Group_SetDefaultCommandByID(c_menu, 0);
  1079. Group_SetDefaultCommandByID(giveright, 0);
  1080. Group_SetDefaultCommandByID(veh, 0);
  1081. Group_SetDefaultCommandByID(savepos, 0);
  1082. // Set the bulder commands
  1083. Group_SetCommandByID(builder, spos, 1);
  1084. Group_SetCommandByID(builder, lpos, 1);
  1085. Group_SetCommandByID(builder, mkprop, 1);
  1086. Group_SetCommandByID(builder, savepos, 1);
  1087. // Set the Superbuilder commands
  1088. Group_SetCommandByID(superbuilder, spos, 1);
  1089. Group_SetCommandByID(superbuilder, lpos, 1);
  1090. Group_SetCommandByID(superbuilder, mkprop, 1);
  1091. Group_SetCommandByID(superbuilder, giveright, 1);
  1092. Group_SetCommandByID(superbuilder, veh, 1);
  1093. Group_SetCommandByID(superbuilder, c_menu, 1);
  1094. Group_SetCommandByID(superbuilder, savepos, 1);
  1095. Command_SetDeniedReturn(1);
  1096. Command_UseDeniedMessage(1);
  1097. Command_SetDisconnectReturn(1);
  1098. }
  1099. stock load_xml_init()
  1100. {
  1101. #if !defined NO_VEHICLE_LOAD
  1102. new
  1103. XML:xCars = XML_New();
  1104. if (xCars != NO_XML_FILE)
  1105. {
  1106. XML_AddHandler(xCars, "vehicle", "LoadCars");
  1107. XML_Parse(xCars, "YSI\\YDBG\\cars.xml");
  1108. }
  1109. #endif
  1110. #if !defined NO_PROPERTYS_LOAD
  1111. new
  1112. XML:xProps = XML_New();
  1113. if(xProps != NO_XML_FILE)
  1114. {
  1115. XML_AddHandler(xCars, "property", "LoadProp");
  1116. XML_Parse(xCars, "YSI\\YDBG\\prop.xml");
  1117. }
  1118. #endif
  1119. #if !defined NO_MONEYPOINT_LOAD
  1120. new
  1121. XML:xMPoint = XML_New();
  1122. if(xMPoint != NO_XML_FILE)
  1123. {
  1124. XML_AddHandler(xMPoint, "moneypoint", "Load_MoneyPoint");
  1125. XML_Parse(xMPoint, "YSI\\YDBG\\moneypoint.xml");
  1126. }
  1127. #endif
  1128. #if !defined NO_BANK_LOAD
  1129. new
  1130. XML:xBank = XML_New();
  1131. if(xBank != NO_XML_FILE)
  1132. {
  1133. XML_AddHandler(xBank, "bank", "LoadBank");
  1134. XML_Parse(xBank, "YSI\\YDBG\\bank.xml");
  1135. }
  1136. #endif
  1137. }