Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2012
6,549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.41 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp> // Credits to the SA:MP Developement Team
  6. #include <sscanf2> // Credits to Y_Less
  7. #include <YSI\y_ini> // Credits to Y_Less
  8. #include <ZCMD> // Credits to Zeex
  9. #include <streamer> // Credits to Incognito
  10. #include <foreach> // Credits to Y_Less
  11.  
  12. //furniture shit
  13. new Object;
  14. new oModel;
  15. #define OBJECT_FILE_NAME "DObjects.txt"
  16. #define COLOR_YELLOW 0xD8D8D8FF
  17. #define COLOR_FADE1 0xE6E6E6E6
  18. #define COLOR_FADE2 0xC8C8C8C8
  19. #define COLOR_FADE3 0xAAAAAAAA
  20. #define COLOR_FADE4 0x8C8C8C8C
  21. #define COLOR_FADE5 0x6E6E6E6E
  22. #define COLOR_FADE 0xC8C8C8C8
  23. #define COLOR_WHITE 0xFFFFFFAA
  24. #define COLOR_GRAD2 0xBFC0C2FF
  25. #define COLOR_DARKRED 0x8B0000AA
  26. #define COLOR_RED 0xFF0000AA
  27. #define COLOR_LIGHTBLUE 0x33CCFFAA
  28. #define COLOR_GREY 0xAFAFAFAA
  29. #define COLOR_PINK 0xDC00DDAA
  30. #define COLOR_BLUE 0x0259EAAA
  31. #define COLOR_GREEN 0x00A800AA
  32. #define COLOR_ORANGE 0xFF8000AA
  33. #define COLOR_CYAN 0xFF8080AA
  34. #define COLOR_WHITE 0xFFFFFFAA
  35. #define COLOR_DARKBLUE 0x0000A0AA
  36. #define COLOR_BLACK 0x000000AA
  37. #define COLOR_DARKGOLD 0x808000AA
  38. #define COLOR_PURPLE 0xC2A2DAAA
  39. #define COLOR_BROWN 0x804000AA
  40. #define COLOR_BLACK2 0x000000ff
  41. #define COLOR_GRAD2 0xBFC0C2FF
  42.  
  43. public OnFilterScriptInit()
  44. {
  45. print("\n--------------------------------------");
  46. print(" Blank Filterscript by your name here");
  47. print("--------------------------------------\n");
  48. new Line[60], Veh;
  49. AddObjectFromFile(OBJECT_FILE_NAME);
  50. format(Line, sizeof(Line), "** %i\t<->\tObjects Loaded From\t<->\tDObjects.txt **", Veh);
  51. printf(Line);
  52. return 1;
  53. }
  54.  
  55. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  56. {
  57. switch(dialogid)
  58. {
  59. case 509:
  60. {
  61. if(!response)
  62. {
  63. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  64. return 1;
  65. }
  66. switch(listitem)
  67. {
  68. case 0:
  69. {
  70. ShowPlayerDialog(playerid, 510, DIALOG_STYLE_LIST, "Furniture Chairs", "Chair1\nChair2\nChair3\nChair4", "Ok", "Cancel");
  71. }
  72. case 1:
  73. {
  74. ShowPlayerDialog(playerid, 511, DIALOG_STYLE_LIST, "Furniture Beds", "Bed1\nBed2\nBed3\nBed4", "Ok", "Cancel");
  75. }
  76. case 2:
  77. {
  78. ShowPlayerDialog(playerid, 512, DIALOG_STYLE_LIST, "Furniture Tables", "Table1\nTable2\nTable3", "Ok", "Cancel");
  79. }
  80. case 3:
  81. {
  82. ShowPlayerDialog(playerid, 513, DIALOG_STYLE_LIST, "Furniture T.V", "TV1\n TV2\n TV3", "Ok", "Cancel");
  83. }
  84. case 4:
  85. {
  86. ShowPlayerDialog(playerid, 514, DIALOG_STYLE_LIST, "Furniture Cabinet", "Cabinet 1", "Ok", "Cancel");
  87. }
  88. case 5:
  89. {
  90. ShowPlayerDialog(playerid, 515, DIALOG_STYLE_LIST, "Furniture Misc", "Basket Ball net\nClothes\nEaster Egg", "Ok", "Cancel");
  91. }
  92. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  93. }
  94. }
  95. }
  96. switch(dialogid)
  97. {
  98. case 510:
  99. {
  100. if(!response)
  101. {
  102. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  103. return 1;
  104. }
  105. switch(listitem)
  106. {
  107. case 0:
  108. {
  109. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  110. GetPlayerPos(playerid, OX, OY, OZ);
  111. oModel = 1723;
  112. ORX = 0.0;
  113. ORY = 0.0;
  114. ORZ = 0.0;
  115. Object = CreateObject(1723, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  116. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  117. EditObject(playerid, Object);
  118. }
  119. case 1:
  120. {
  121. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  122. GetPlayerPos(playerid, OX, OY, OZ);
  123. oModel = 1704;
  124. ORX = 0.0;
  125. ORY = 0.0;
  126. ORZ = 0.0;
  127. Object = CreateObject(1704, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  128. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  129. EditObject(playerid, Object);
  130. }
  131. case 2:
  132. {
  133. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  134. GetPlayerPos(playerid, OX, OY, OZ);
  135. oModel = 11665;
  136. ORX = 0.0;
  137. ORY = 0.0;
  138. ORZ = 0.0;
  139. Object = CreateObject(11665, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  140. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  141. EditObject(playerid, Object);
  142. }
  143. case 3:
  144. {
  145. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  146. GetPlayerPos(playerid, OX, OY, OZ);
  147. oModel = 1705;
  148. ORX = 0.0;
  149. ORY = 0.0;
  150. ORZ = 0.0;
  151. Object = CreateObject(1705, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  152. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  153. EditObject(playerid, Object);
  154. }
  155. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  156. }
  157. }
  158. }
  159. switch(dialogid)
  160. {
  161. case 511:
  162. {
  163. if(!response)
  164. {
  165. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  166. return 1;
  167. }
  168. switch(listitem)
  169. {
  170. case 0:
  171. {
  172. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  173. GetPlayerPos(playerid, OX, OY, OZ);
  174. oModel = 1745;
  175. ORX = 0.0;
  176. ORY = 0.0;
  177. ORZ = 0.0;
  178. Object = CreateObject(1745, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  179. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  180. EditObject(playerid, Object);
  181. }
  182. case 1:
  183. {
  184. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  185. GetPlayerPos(playerid, OX, OY, OZ);
  186. oModel = 1794;
  187. ORX = 0.0;
  188. ORY = 0.0;
  189. ORZ = 0.0;
  190. Object = CreateObject(1794, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  191. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  192. EditObject(playerid, Object);
  193. }
  194. case 2:
  195. {
  196. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  197. GetPlayerPos(playerid, OX, OY, OZ);
  198. oModel = 1797;
  199. ORX = 0.0;
  200. ORY = 0.0;
  201. ORZ = 0.0;
  202. Object = CreateObject(1797, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  203. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  204. EditObject(playerid, Object);
  205. }
  206. case 3:
  207. {
  208. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  209. GetPlayerPos(playerid, OX, OY, OZ);
  210. oModel = 2566;
  211. ORX = 0.0;
  212. ORY = 0.0;
  213. ORZ = 0.0;
  214. Object = CreateObject(2566, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  215. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  216. EditObject(playerid, Object);
  217. }
  218. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  219. }
  220. }
  221. }
  222. switch(dialogid)
  223. {
  224. case 512:
  225. {
  226. if(!response)
  227. {
  228. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  229. return 1;
  230. }
  231. switch(listitem)
  232. {
  233. case 0:
  234. {
  235. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  236. GetPlayerPos(playerid, OX, OY, OZ);
  237. oModel = 1281;
  238. ORX = 0.0;
  239. ORY = 0.0;
  240. ORZ = 0.0;
  241. Object = CreateObject(1281, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  242. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  243. EditObject(playerid, Object);
  244. }
  245. case 1:
  246. {
  247. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  248. GetPlayerPos(playerid, OX, OY, OZ);
  249. oModel = 2311;
  250. ORX = 0.0;
  251. ORY = 0.0;
  252. ORZ = 0.0;
  253. Object = CreateObject(2311, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  254. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  255. EditObject(playerid, Object);
  256. }
  257. case 2:
  258. {
  259. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  260. GetPlayerPos(playerid, OX, OY, OZ);
  261. oModel = 1825;
  262. ORX = 0.0;
  263. ORY = 0.0;
  264. ORZ = 0.0;
  265. Object = CreateObject(1825, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  266. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  267. EditObject(playerid, Object);
  268. }
  269. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  270. }
  271. }
  272. }
  273. switch(dialogid)
  274. {
  275. case 513:
  276. {
  277. if(!response)
  278. {
  279. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  280. return 1;
  281. }
  282. switch(listitem)
  283. {
  284. case 0:
  285. {
  286. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  287. GetPlayerPos(playerid, OX, OY, OZ);
  288. oModel = 2297;
  289. ORX = 0.0;
  290. ORY = 0.0;
  291. ORZ = 0.0;
  292. Object = CreateObject(2297, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  293. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  294. EditObject(playerid, Object);
  295. }
  296. case 1:
  297. {
  298. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  299. GetPlayerPos(playerid, OX, OY, OZ);
  300. oModel = 2296;
  301. ORX = 0.0;
  302. ORY = 0.0;
  303. ORZ = 0.0;
  304. Object = CreateObject(2296, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  305. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  306. EditObject(playerid, Object);
  307. }
  308. case 2:
  309. {
  310. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  311. GetPlayerPos(playerid, OX, OY, OZ);
  312. oModel = 2595;
  313. ORX = 0.0;
  314. ORY = 0.0;
  315. ORZ = 0.0;
  316. Object = CreateObject(2595, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  317. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  318. EditObject(playerid, Object);
  319. }
  320. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  321. }
  322. }
  323. }
  324. switch(dialogid)
  325. {
  326. case 514:
  327. {
  328. if(!response)
  329. {
  330. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  331. return 1;
  332. }
  333. switch(listitem)
  334. {
  335. case 0:
  336. {
  337. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  338. GetPlayerPos(playerid, OX, OY, OZ);
  339. oModel = 2078;
  340. ORX = 0.0;
  341. ORY = 0.0;
  342. ORZ = 0.0;
  343. Object = CreateObject(2078, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  344. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  345. EditObject(playerid, Object);
  346. }
  347. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  348. }
  349. }
  350. }
  351. switch(dialogid)
  352. {
  353. case 515:
  354. {
  355. if(!response)
  356. {
  357. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  358. return 1;
  359. }
  360. switch(listitem)
  361. {
  362. case 0:
  363. {
  364. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  365. GetPlayerPos(playerid, OX, OY, OZ);
  366. oModel = 3496;
  367. ORX = 0.0;
  368. ORY = 0.0;
  369. ORZ = 0.0;
  370. Object = CreateObject(3496, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  371. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  372. EditObject(playerid, Object);
  373. }
  374. case 1:
  375. {
  376. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  377. GetPlayerPos(playerid, OX, OY, OZ);
  378. oModel = 2844;
  379. ORX = 0.0;
  380. ORY = 0.0;
  381. ORZ = 0.0;
  382. Object = CreateObject(2844, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  383. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  384. EditObject(playerid, Object);
  385. }
  386. case 2:
  387. {
  388. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  389. GetPlayerPos(playerid, OX, OY, OZ);
  390. oModel = 19343;
  391. ORX = 0.0;
  392. ORY = 0.0;
  393. ORZ = 0.0;
  394. Object = CreateObject(19343, OX+2, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  395. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  396. EditObject(playerid, Object);
  397. }
  398. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  399. }
  400. }
  401. }
  402. return 1;
  403. }
  404.  
  405. stock AddObjectFromFile(DFileName[])
  406. {
  407. if(!fexist(DFileName)) return 0;
  408.  
  409. new File:ObjectFile, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, oTotal, Line[128];
  410.  
  411. ObjectFile = fopen(DFileName, io_read);
  412. while(fread(ObjectFile, Line))
  413. {
  414. if(Line[0] == '/' || isnull(Line)) continue;
  415. unformat(Line, "ffffffiii", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
  416. CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
  417. oTotal++;
  418. }
  419. fclose(ObjectFile);
  420. return oTotal;
  421. }
  422.  
  423. stock AddObjectToFile(DFileName[], Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT)
  424. {
  425. new File:ObjectFile, Line[128];
  426.  
  427. format(Line, sizeof(Line), "%f %f %f %f %f %f %i %i %i\r\n", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
  428. ObjectFile = fopen(DFileName, io_append);
  429. fwrite(ObjectFile, Line);
  430. fclose(ObjectFile);
  431. return 1;
  432. }
  433.  
  434. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  435. {
  436. new Float:oldX, Float:oldY, Float:oldZ,
  437. Float:oldRotX, Float:oldRotY, Float:oldRotZ;
  438. GetObjectPos(objectid, oldX, oldY, oldZ);
  439. GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
  440. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT;
  441. if(!playerobject) // If this is a global object, move it for other players
  442. {
  443. if(!IsValidObject(objectid)) return;
  444. MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
  445. }
  446.  
  447. if(response == EDIT_RESPONSE_FINAL)
  448. {
  449. new string[254];
  450. OVW = GetPlayerVirtualWorld(playerid);
  451. OINT = GetPlayerInterior(playerid);
  452. GetObjectPos(objectid, OX, OY, OZ);
  453. GetObjectRot(objectid, ORX, ORY, ORZ);
  454. AddObjectToFile(OBJECT_FILE_NAME, OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT);
  455. SendClientMessage(playerid, COLOR_BLUE, "Object Saved, Please add more if you wish");
  456. format(string, sizeof(string), "Object model %i spawned at %f, %f, %f, with rotation %f, %f, %f,", oModel, OX, OY, OZ, ORX, ORY, ORZ);
  457. SendClientMessage(playerid, 0xD8D8D8FF, string);
  458. format(string, sizeof(string), "Object world %i interior id %i", OVW, OINT);
  459. SendClientMessage(playerid, 0xD8D8D8FF, string);
  460. CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
  461. DestroyObject(Object);
  462. }
  463.  
  464. if(response == EDIT_RESPONSE_CANCEL)
  465. {
  466. //The player cancelled, so put the object back to it's old position
  467. if(!playerobject) //Object is not a playerobject
  468. {
  469. SetObjectPos(objectid, oldX, oldY, oldZ);
  470. SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
  471. }
  472. else
  473. {
  474. SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
  475. SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
  476. }
  477. }
  478. }
  479.  
  480. CMD:furniture(playerid, params[])
  481. {
  482. ShowPlayerDialog(playerid, 509, DIALOG_STYLE_LIST, "Furniture", "Chairs\nBeds\nTables\nTvs\nCabinets\nFuns tuff\n", "Ok", "Cancel");
  483. return 1;
  484. }
  485.  
  486. CMD:fhelp(playerid, params[])
  487. {
  488. SendClientMessage(playerid, COLOR_ORANGE, "This system was scripted by jueix, Type /furniture to plant furniture in your house");
  489. SendClientMessage(playerid, COLOR_ORANGE, "If the furniture is not in /furniture that you want please type /fplant then the object id.");
  490. SendClientMessage(playerid, COLOR_ORANGE, "Thank you for using Jueix's furniture system.");
  491. return 1;
  492. }
  493.  
  494. COMMAND:fplant(playerid, params[])
  495. {
  496. new objectid;
  497. if(!sscanf(params, "i", objectid))
  498. {
  499. if(objectid >= 1 && objectid <= 11000)
  500. {
  501. new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
  502. GetPlayerPos(playerid, OX, OY, OZ);
  503. oModel = objectid;
  504. ORX = 0.0;
  505. ORY = 0.0;
  506. ORZ = 0.0;
  507. Object = CreateObject(oModel, OX, OY, OZ, ORX, ORY, ORZ); //Object will render at its default distance.
  508. SendClientMessage(playerid, 0xD8D8D8FF, "Object spawned now move it");
  509. EditObject(playerid, Object);
  510. return 1;
  511. }
  512. else return SendClientMessage(playerid, 0xD8D8D8FF, "Only id's between 1 and 11000 are avaliable.");
  513. }
  514. else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /fplant[objectid]");
  515. }
  516.  
  517. public OnFilterScriptExit()
  518. {
  519. return 1;
  520. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement