Advertisement
Guest User

Untitled

a guest
Jul 4th, 2013
1,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.33 KB | None | 0 0
  1. // JoeMatt Graffiti System v0.1 LOAD/SAVE
  2. //
  3.  
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf2>
  8. #include <YSI\y_ini>
  9. #define FILTERSCRIPT
  10.  
  11. new Text[MAX_PLAYERS];
  12. new GrafiteID[MAX_PLAYERS];
  13. new DeleteObject;
  14. #define MAX_GRAFITI 30
  15. #define GRAFITI_FILE "Grafiti/%d.ini"
  16.  
  17. #if defined FILTERSCRIPT
  18.  
  19. #else
  20.  
  21. main()
  22. {
  23. print("\n----------------------------------");
  24. print(" Graffiti System JoeMatt ");
  25. print("----------------------------------\n");
  26. }
  27.  
  28. #endif
  29.  
  30. enum xGrafitiInfo
  31. {
  32. xIDF,
  33. xID,
  34. Float:xMjestox,
  35. Float:xMjestoy,
  36. Float:xMjestoz,
  37. xtextgrafita[128],
  38. Float:xRotacijax,
  39. Float:xRotacijay,
  40. Float:xRotacijaz,
  41. xfont[35],
  42. xboja
  43. }
  44.  
  45. new GrafitiInfo [ MAX_GRAFITI ][ xGrafitiInfo ];
  46.  
  47. public OnFilterScriptInit()
  48. {
  49. print("\n--------------------------------------");
  50. print(" Graffiti System by JoeMatt v0.1 ");
  51. print("--------------------------------------\n");
  52. return 1;
  53. }
  54.  
  55. public OnFilterScriptExit()
  56. {
  57. return 1;
  58. }
  59.  
  60. public OnPlayerRequestClass(playerid, classid)
  61. {
  62. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  63. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  64. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  65. return 1;
  66. }
  67.  
  68. public OnPlayerConnect(playerid)
  69. {
  70.  
  71. return 1;
  72. }
  73.  
  74. public OnPlayerDisconnect(playerid, reason)
  75. {
  76. return 1;
  77. }
  78.  
  79. public OnPlayerSpawn(playerid)
  80. {
  81. for(new grafite = 0; grafite < sizeof(GrafitiInfo); grafite++)
  82. {
  83. new tFile[50];
  84. format(tFile, sizeof(tFile), GRAFITI_FILE, grafite);
  85. if(fexist(tFile))
  86. {
  87. INI_ParseFile(tFile, "UcitajGrafite", .bExtra = true, .extra = grafite);
  88. Text[playerid] = CreateObject(19353, GrafitiInfo[grafite][xMjestox], GrafitiInfo[grafite][xMjestoy], GrafitiInfo[grafite][xMjestoz], GrafitiInfo[grafite][xRotacijax], GrafitiInfo[grafite][xRotacijay], GrafitiInfo[grafite][xRotacijaz]);
  89. SetObjectMaterialText(Text[playerid],GrafitiInfo[grafite][xtextgrafita], 0, OBJECT_MATERIAL_SIZE_256x128,GrafitiInfo[grafite][xfont], 28, 0, GrafitiInfo[grafite][xboja], 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
  90. }
  91. }
  92. return 1;
  93. }
  94.  
  95. public OnPlayerDeath(playerid, killerid, reason)
  96. {
  97. return 1;
  98. }
  99.  
  100. public OnVehicleSpawn(vehicleid)
  101. {
  102. return 1;
  103. }
  104.  
  105. public OnVehicleDeath(vehicleid, killerid)
  106. {
  107. return 1;
  108. }
  109.  
  110. public OnPlayerText(playerid, text[])
  111. {
  112. return 1;
  113. }
  114.  
  115. public OnPlayerCommandText(playerid, cmdtext[])
  116. {
  117. return 0;
  118. }
  119.  
  120. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerExitVehicle(playerid, vehicleid)
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnPlayerStateChange(playerid, newstate, oldstate)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerEnterCheckpoint(playerid)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnPlayerLeaveCheckpoint(playerid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnPlayerEnterRaceCheckpoint(playerid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerLeaveRaceCheckpoint(playerid)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnRconCommand(cmd[])
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerRequestSpawn(playerid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnObjectMoved(objectid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerObjectMoved(playerid, objectid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnPlayerPickUpPickup(playerid, pickupid)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnVehicleMod(playerid, vehicleid, componentid)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerSelectedMenuRow(playerid, row)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnPlayerExitedMenu(playerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnRconLoginAttempt(ip[], password[], success)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerUpdate(playerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerStreamIn(playerid, forplayerid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerStreamOut(playerid, forplayerid)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnVehicleStreamIn(vehicleid, forplayerid)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnVehicleStreamOut(vehicleid, forplayerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  251. {
  252. return 1;
  253. }
  254. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  260. {
  261. new Float:oldX, Float:oldY, Float:oldZ,
  262. Float:oldRotX, Float:oldRotY, Float:oldRotZ;
  263. GetObjectPos(objectid, oldX, oldY, oldZ);
  264. GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
  265. new grafite = GrafiteID[playerid];
  266. if(!playerobject)
  267. {
  268. if(!IsValidObject(objectid)) return;
  269. MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
  270. SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
  271. SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
  272.  
  273. GrafitiInfo[grafite][xMjestox] = fX;
  274. GrafitiInfo[grafite][xMjestoy] = fY;
  275. GrafitiInfo[grafite][xMjestoz] = fZ;
  276. //------Rotacija EDITA-------
  277. GrafitiInfo[grafite][xRotacijax] = fRotX;
  278. GrafitiInfo[grafite][xRotacijay] = fRotY;
  279. GrafitiInfo[grafite][xRotacijaz] = fRotZ;
  280.  
  281. SacuvajGrafite(grafite);
  282.  
  283. }
  284. }
  285.  
  286. public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
  287. {
  288.  
  289. if(type == SELECT_OBJECT_GLOBAL_OBJECT)
  290. {
  291. if(DeleteObject == 1)
  292. {
  293. GrafiteID[playerid] = objectid;
  294. new id = GrafiteID[playerid];
  295. new kFile[50];
  296. DestroyObject(objectid);
  297. CancelEdit(playerid);
  298. SendClientMessage(playerid, -1 , " You deleted that object!");
  299. DeleteObject = 0;
  300. format(kFile, sizeof(kFile), "Grafiti/%d.ini" , GrafitiInfo[id][xIDF]);
  301. fremove(kFile);
  302. }
  303. if(DeleteObject == 0)
  304. {
  305. GrafiteID[playerid] = objectid;
  306. EditObject(playerid, objectid);
  307. }
  308. }
  309. return 1;
  310. }
  311.  
  312. forward UcitajGrafite(grafite, name[], value[]);
  313. public UcitajGrafite(grafite, name[], value[])
  314. {
  315. INI_Int("IDF",GrafitiInfo[grafite][xIDF]);
  316. INI_Int("ID",GrafitiInfo[grafite][xID]);
  317. INI_Float("Mjestox",GrafitiInfo[grafite][xMjestox]);
  318. INI_Float("Mjestoy",GrafitiInfo[grafite][xMjestoy]);
  319. INI_Float("Mjestoz",GrafitiInfo[grafite][xMjestoz]);
  320. INI_String("textgrafita",GrafitiInfo[grafite][xtextgrafita],128);
  321. INI_Float("Rotacijax",GrafitiInfo[grafite][xRotacijax]);
  322. INI_Float("Rotacijay",GrafitiInfo[grafite][xRotacijay]);
  323. INI_Float("Rotacijaz",GrafitiInfo[grafite][xRotacijaz]);
  324. INI_String("font",GrafitiInfo[grafite][xfont],35);
  325. INI_Hex("boja",GrafitiInfo[grafite][xboja]);
  326. return 1;
  327. }
  328.  
  329. stock SacuvajGrafite(grafite)
  330. {
  331. new tFile[128];
  332. format(tFile, sizeof(tFile), GRAFITI_FILE, grafite);
  333. if(fexist(tFile))
  334. {
  335. new INI:File = INI_Open(tFile);
  336. INI_WriteInt(File,"IDF",GrafitiInfo[grafite][xIDF]);
  337. INI_WriteInt(File,"ID",GrafitiInfo[grafite][xID]);
  338. INI_WriteFloat(File,"Mjestox",GrafitiInfo[grafite][xMjestox]);
  339. INI_WriteFloat(File,"Mjestoy",GrafitiInfo[grafite][xMjestoy]);
  340. INI_WriteFloat(File,"Mjestoz",GrafitiInfo[grafite][xMjestoz]);
  341. INI_WriteString(File,"textgrafita",GrafitiInfo[grafite][xtextgrafita]);
  342. INI_WriteFloat(File,"Rotacijax",GrafitiInfo[grafite][xRotacijax]);
  343. INI_WriteFloat(File,"Rotacijay",GrafitiInfo[grafite][xRotacijay]);
  344. INI_WriteFloat(File,"Rotacijaz",GrafitiInfo[grafite][xRotacijaz]);
  345. INI_WriteString(File,"font",GrafitiInfo[grafite][xfont]);
  346. INI_WriteHex(File,"boja",GrafitiInfo[grafite][xboja]);
  347. INI_Close(File);
  348. }
  349. return 1;
  350. }
  351.  
  352.  
  353. CMD:grafiti(playerid, params[])
  354. {
  355. new txt[128],boja, font[35], Float:X, Float:Y, Float:Z;
  356. if(sscanf(params, "s[128]s[35]h", txt, font,boja)) return SendClientMessage(playerid,-1,"USAGE: /grafiti [Text] [Font] [Color]");
  357. GetPlayerPos(playerid, X, Y, Z);
  358. Text[playerid] = CreateObject(19353, X, Y +2, Z, 0.0, 0.0, 90.0);
  359. SetObjectMaterialText(Text[playerid],txt, 0, OBJECT_MATERIAL_SIZE_256x128,font, 28, 0, boja , 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
  360. for(new i = 0; i < MAX_GRAFITI; i++)
  361. {
  362. new fajl[20]; format(fajl, sizeof(fajl), "Grafiti/%d.ini", i);
  363. if(!fexist(fajl))
  364. {
  365. GrafitiInfo[i][xID] = 19353;
  366. GrafitiInfo[i][xMjestox] = X;
  367. GrafitiInfo[i][xMjestoy] = Y;
  368. GrafitiInfo[i][xMjestoz] = Z;
  369.  
  370. GrafitiInfo[i][xIDF] = i;
  371. GrafitiInfo[i][xboja] = boja;
  372.  
  373. GrafitiInfo[i][xRotacijax] = 0;
  374. GrafitiInfo[i][xRotacijay] = 0;
  375. GrafitiInfo[i][xRotacijaz] = 0;
  376. strmid(GrafitiInfo[i][xtextgrafita], txt, 0, strlen(txt), 128);
  377. strmid(GrafitiInfo[i][xfont], font, 0, strlen(font), 35);
  378. fopen(fajl, io_write);
  379. SacuvajGrafite(i);
  380. GrafiteID[playerid] = i;
  381. i = 49;
  382. }
  383. }
  384. return 1;
  385. }
  386.  
  387. CMD:grafitiedit(playerid, params[])
  388. {
  389. SendClientMessage(playerid, -1, " Please select object for editing.");
  390. SelectObject(playerid);
  391. return 1;
  392. }
  393.  
  394. CMD:deletegrafit(playerid, params[])
  395. {
  396. SendClientMessage(playerid, -1, " Please select object for delete.");
  397. SelectObject(playerid);
  398. DeleteObject = 1;
  399. return 1;
  400. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement