adri1

Untitled

Mar 21st, 2015
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.16 KB | None | 0 0
  1. #define IsObjectTextured(%0) MAPMOVER_OBJECTS[%0][ObjectTextured]
  2. #define IsObjectIndexTextured(%0,%1) MAPMOVER_TEXTURES[%0][%1][IndexTextured]
  3. #define GetTexturedObjectModelid(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Modelid]
  4. #define GetTexturedObjectTxdName(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Txd]
  5. #define GetTexturedObjectTextureName(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Texture]
  6. #define GetTexturedObjectMaterialColor(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Color]
  7. #define GetTexturedObjectID(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_ObjectID]
  8. #define IsObjectTextTextured(%0) MAPMOVER_OBJECTS[%0][ObjectTextTextured]
  9. #define IsObjectIndexText(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_IndexTextured]
  10. #define GetTextObjectText(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_Text]
  11. #define GetTextObjectMaterialSize(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_MaterialSize]
  12. #define GetTextObjectFontFace(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontFace]
  13. #define GetTextObjectFontSize(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontSize]
  14. #define GetTextObjectBold(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_Bold]
  15. #define GetTextObjectFontColor(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontColor]
  16. #define GetTextObjectBackColor(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_BackColor]
  17. #define GetTextObjectAlignment(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_TextAlignment]
  18. #define GetTexturedTextObjectID(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_ObjectID]
  19.  
  20. stock LoadMap(playerid, mapname[])
  21. {
  22. if(Player_MovingMap[playerid] == 0) return 1;
  23.  
  24. new File:Handler = fopen(mapname, io_read);
  25. if(!Handler) return 1;
  26. fremove("editingmap.amx");
  27. fremove("editingmap.pwn");
  28. new File:filer = fopen("editingmap.pwn", io_append);
  29. if(filer)
  30. {
  31. fwrite(filer, "//temp_script\r\n");
  32. fwrite(filer, "#include <a_samp>\r\n");
  33. //fwrite(filer, "#include <mapmover>\r\n\r\n");
  34. fwrite(filer, "public OnFilterScriptInit()\r\n");
  35. fwrite(filer, "{\r\n\t");
  36. }
  37.  
  38. while(fread(Handler, Object_String))
  39. {
  40. StripNewLine(Object_String);
  41. new Ob = strfind(Object_String, "CreateDynamicObject(", true);
  42. if(Ob != -1)
  43. {
  44. strdel(Object_String, Ob, Ob+20);
  45. strins(Object_String, "CreateObjectT(", Ob);
  46. }
  47. Ob = strfind(Object_String, "CreateObject(", true);
  48. if(Ob != -1)
  49. {
  50. strdel(Object_String, Ob, Ob+13);
  51. strins(Object_String, "CreateObjectT(", Ob);
  52. }
  53. Ob = strfind(Object_String, "SetDynamicObjectMaterial(", true);
  54. if(Ob != -1)
  55. {
  56. strdel(Object_String, Ob, Ob+25);
  57. strins(Object_String, "SetObjectMaterialE(", Ob);
  58. }
  59. Ob = strfind(Object_String, "SetObjectMaterial(", true);
  60. if(Ob != -1)
  61. {
  62. strdel(Object_String, Ob, Ob+18);
  63. strins(Object_String, "SetObjectMaterialE(", Ob);
  64. }
  65. Ob = strfind(Object_String, "SetDynamicObjectMaterialText(", true);
  66. if(Ob != -1)
  67. {
  68. strdel(Object_String, Ob, Ob+29);
  69. strins(Object_String, "SetObjectMaterialTextT(", Ob);
  70. }
  71. Ob = strfind(Object_String, "SetObjectMaterialText(", true);
  72. if(Ob != -1)
  73. {
  74. strdel(Object_String, Ob, Ob+22);
  75. strins(Object_String, "SetObjectMaterialTextE(", Ob);
  76. }
  77. format(Object_String, 512, "%s\r\n", Object_String);
  78. fwrite(filer, Object_String);
  79.  
  80. }
  81. fwrite(filer, "\r\n}\r\n\r\n");
  82. fwrite(filer, "stock CreateObjectT(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0)\r\n");
  83. fwrite(filer, "{\r\n");
  84. fwrite(filer, "\tnew objectid = CreateObject(modelid, x, y, z, rx, ry, rz, drawdistance);\r\n");
  85. fwrite(filer, "\tCallRemoteFunction(\"OnObjectImported\", \"dd\", modelid, objectid);\r\n");
  86. fwrite(filer, "\treturn objectid;\r\n");
  87. fwrite(filer, "}\r\n\r\n");
  88. fwrite(filer, "stock SetObjectMaterialTextT(objectid, materialindex = 0, text[], materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = \"Arial\", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0)\r\n");
  89. fwrite(filer, "{\r\n");
  90. fwrite(filer, "\treturn SetObjectMaterialTextE(objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
  91. fwrite(filer, "}\r\n\r\n");
  92. fwrite(filer, "stock SetObjectMaterialTextE(objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = \"Arial\", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0)\r\n");
  93. fwrite(filer, "{\r\n");
  94. fwrite(filer, "\tCallRemoteFunction(\"OnObjectTexturedText\", \"dsddsdddddd\", objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
  95. fwrite(filer, "\treturn SetObjectMaterialText(objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
  96. fwrite(filer, "}\r\n\r\n");
  97. fwrite(filer, "stock SetObjectMaterialE(objectid, materialindex, modelid, txdname[], texturename[], materialcolor = 0)\r\n");
  98. fwrite(filer, "{\r\n");
  99. fwrite(filer, "\tCallRemoteFunction(\"OnObjectTextured\", \"dddssd\", objectid, materialindex, modelid, txdname, texturename, materialcolor);\r\n");
  100. fwrite(filer, "\treturn SetObjectMaterial(objectid, materialindex, modelid, txdname, texturename, materialcolor);\r\n");
  101. fwrite(filer, "}\r\n\r\n");
  102. fclose(filer);
  103. fclose(Handler);
  104.  
  105. WinExec("pawno\\pawncc.exe ./scriptfiles/editingmap.pwn");
  106. SetTimerEx("LoadTheMap", 100, 0, "i", playerid);
  107. format(mapnamefile, 24, "%s", mapname);
  108.  
  109. return true;
  110. }
  111.  
  112. forward LoadTheMap(playerid);
  113. public LoadTheMap(playerid)
  114. {
  115. if(!fexist("editingmap.amx")) return SetTimer("LoadTheMap", 100, 0);
  116. new File:Handler = fopen("editingmap.amx", io_read);
  117. new string[512];
  118. while(fread(Handler, string))
  119. {
  120. SetTimerEx("Finish", 2000, 0, "id", playerid, 1);
  121. fclose(Handler);
  122. return 1;
  123. }
  124.  
  125.  
  126. SetTimer("LoadTheMap", 100, 0);
  127. return 1;
  128. }
  129.  
  130. forward Finish(playerid, de);
  131. public Finish(playerid, de)
  132. {
  133. if(de == 1)
  134. {
  135. SendRconCommand("loadfs ../scriptfiles/editingmap");
  136. SetTimerEx("Finish", 2000, 0, "id", playerid, 0);
  137. }
  138. else ShowPlayerDialog(playerid, 802, DIALOG_STYLE_MSGBOX, "Map Mover", "\n\n\tMap loaded correctly.\n\n", "OK", "");
  139. return 1;
  140. }
  141.  
  142. new Index;
  143. public OnObjectImported(modelid, objectid)
  144. {
  145. new Float:pos[6];
  146. GetObjectPos(objectid, pos[0], pos[1], pos[2]);
  147. GetObjectRot(objectid, pos[3], pos[4], pos[5]);
  148. MAPMOVER_OBJECTS[Index][ObjectTextured] = 0;
  149. MAPMOVER_OBJECTS[Index][ObjectTextTextured] = 0;
  150. MAPMOVER_OBJECTS[Index][ModelID] = modelid;
  151. MAPMOVER_OBJECTS[Index][PositionX] = pos[0];
  152. MAPMOVER_OBJECTS[Index][PositionY] = pos[1];
  153. MAPMOVER_OBJECTS[Index][PositionZ] = pos[2];
  154. MAPMOVER_OBJECTS[Index][RotationX] = pos[3];
  155. MAPMOVER_OBJECTS[Index][RotationY] = pos[4];
  156. MAPMOVER_OBJECTS[Index][RotationZ] = pos[5];
  157. MAPMOVER_OBJECTS[Index][ObjectID] = objectid;
  158. Index ++;
  159. return 1;
  160. }
  161.  
  162. public OnObjectTexturedText(objectid, text[], materialindex, materialsize, fontface[], fontsize, bold, fontcolor, backcolor, textalignment)
  163. {
  164. new Indexe = GetIndexFromObjectID(objectid);
  165. MAPMOVER_OBJECTS[Indexe][ObjectTextTextured] = 1;
  166. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_IndexTextured] = 1;
  167. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_ObjectID] = objectid;
  168. format(TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_Text], 256, "%s", text);
  169. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_MaterialIndex] = materialindex;
  170. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_MaterialSize] = materialsize;
  171. format(TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontFace], 64, "%s", fontface);
  172. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontSize] = fontsize;
  173. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_Bold] = bold;
  174. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontColor] = fontcolor;
  175. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_BackColor] = backcolor;
  176. TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_TextAlignment] = textalignment;
  177. return 1;
  178. }
  179.  
  180. public OnObjectTextured(objectid, materialindex, modelid, txdname[], texturename[], materialcolor)
  181. {
  182. new Indexe = GetIndexFromObjectID(objectid);
  183. MAPMOVER_OBJECTS[Indexe][ObjectTextured] = 1;
  184. MAPMOVER_TEXTURES[Indexe][materialindex][IndexTextured] = 1;
  185. MAPMOVER_TEXTURES[Indexe][materialindex][M_ObjectID] = objectid;
  186. MAPMOVER_TEXTURES[Indexe][materialindex][M_Index] = materialindex;
  187. MAPMOVER_TEXTURES[Indexe][materialindex][M_Modelid] = modelid;
  188. format(MAPMOVER_TEXTURES[Indexe][materialindex][M_Txd], 64, "%s", txdname);
  189. format(MAPMOVER_TEXTURES[Indexe][materialindex][M_Texture], 64, "%s", texturename);
  190. MAPMOVER_TEXTURES[Indexe][materialindex][M_Color] = materialcolor;
  191. return 1;
  192. }
  193.  
  194. stock GetIndexFromObjectID(objectid)
  195. {
  196. if(MAPMOVER_OBJECTS[Index][ObjectID] == objectid) return Index;
  197. for(new i = 0; i != MAX_MAPMOVER_OBJECTS; i++)
  198. {
  199. if(MAPMOVER_OBJECTS[i][ObjectID] == objectid)
  200. {
  201. return i;
  202. }
  203. }
  204. return false;
  205. }
  206.  
  207. stock GetObjectIDFromIndexID(indexid)
  208. {
  209. return MAPMOVER_OBJECTS[indexid][ObjectID];
  210. }
Advertisement
Add Comment
Please, Sign In to add comment