Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define IsObjectTextured(%0) MAPMOVER_OBJECTS[%0][ObjectTextured]
- #define IsObjectIndexTextured(%0,%1) MAPMOVER_TEXTURES[%0][%1][IndexTextured]
- #define GetTexturedObjectModelid(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Modelid]
- #define GetTexturedObjectTxdName(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Txd]
- #define GetTexturedObjectTextureName(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Texture]
- #define GetTexturedObjectMaterialColor(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_Color]
- #define GetTexturedObjectID(%0,%1) MAPMOVER_TEXTURES[%0][%1][M_ObjectID]
- #define IsObjectTextTextured(%0) MAPMOVER_OBJECTS[%0][ObjectTextTextured]
- #define IsObjectIndexText(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_IndexTextured]
- #define GetTextObjectText(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_Text]
- #define GetTextObjectMaterialSize(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_MaterialSize]
- #define GetTextObjectFontFace(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontFace]
- #define GetTextObjectFontSize(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontSize]
- #define GetTextObjectBold(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_Bold]
- #define GetTextObjectFontColor(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_FontColor]
- #define GetTextObjectBackColor(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_BackColor]
- #define GetTextObjectAlignment(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_TextAlignment]
- #define GetTexturedTextObjectID(%0,%1) TEXT_TEXTURE_MAPMOVER_OBJECT[%0][%1][I_ObjectID]
- stock LoadMap(playerid, mapname[])
- {
- if(Player_MovingMap[playerid] == 0) return 1;
- new File:Handler = fopen(mapname, io_read);
- if(!Handler) return 1;
- fremove("editingmap.amx");
- fremove("editingmap.pwn");
- new File:filer = fopen("editingmap.pwn", io_append);
- if(filer)
- {
- fwrite(filer, "//temp_script\r\n");
- fwrite(filer, "#include <a_samp>\r\n");
- //fwrite(filer, "#include <mapmover>\r\n\r\n");
- fwrite(filer, "public OnFilterScriptInit()\r\n");
- fwrite(filer, "{\r\n\t");
- }
- while(fread(Handler, Object_String))
- {
- StripNewLine(Object_String);
- new Ob = strfind(Object_String, "CreateDynamicObject(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+20);
- strins(Object_String, "CreateObjectT(", Ob);
- }
- Ob = strfind(Object_String, "CreateObject(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+13);
- strins(Object_String, "CreateObjectT(", Ob);
- }
- Ob = strfind(Object_String, "SetDynamicObjectMaterial(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+25);
- strins(Object_String, "SetObjectMaterialE(", Ob);
- }
- Ob = strfind(Object_String, "SetObjectMaterial(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+18);
- strins(Object_String, "SetObjectMaterialE(", Ob);
- }
- Ob = strfind(Object_String, "SetDynamicObjectMaterialText(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+29);
- strins(Object_String, "SetObjectMaterialTextT(", Ob);
- }
- Ob = strfind(Object_String, "SetObjectMaterialText(", true);
- if(Ob != -1)
- {
- strdel(Object_String, Ob, Ob+22);
- strins(Object_String, "SetObjectMaterialTextE(", Ob);
- }
- format(Object_String, 512, "%s\r\n", Object_String);
- fwrite(filer, Object_String);
- }
- fwrite(filer, "\r\n}\r\n\r\n");
- fwrite(filer, "stock CreateObjectT(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0)\r\n");
- fwrite(filer, "{\r\n");
- fwrite(filer, "\tnew objectid = CreateObject(modelid, x, y, z, rx, ry, rz, drawdistance);\r\n");
- fwrite(filer, "\tCallRemoteFunction(\"OnObjectImported\", \"dd\", modelid, objectid);\r\n");
- fwrite(filer, "\treturn objectid;\r\n");
- fwrite(filer, "}\r\n\r\n");
- 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");
- fwrite(filer, "{\r\n");
- fwrite(filer, "\treturn SetObjectMaterialTextE(objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
- fwrite(filer, "}\r\n\r\n");
- 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");
- fwrite(filer, "{\r\n");
- fwrite(filer, "\tCallRemoteFunction(\"OnObjectTexturedText\", \"dsddsdddddd\", objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
- fwrite(filer, "\treturn SetObjectMaterialText(objectid, text, materialindex, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment);\r\n");
- fwrite(filer, "}\r\n\r\n");
- fwrite(filer, "stock SetObjectMaterialE(objectid, materialindex, modelid, txdname[], texturename[], materialcolor = 0)\r\n");
- fwrite(filer, "{\r\n");
- fwrite(filer, "\tCallRemoteFunction(\"OnObjectTextured\", \"dddssd\", objectid, materialindex, modelid, txdname, texturename, materialcolor);\r\n");
- fwrite(filer, "\treturn SetObjectMaterial(objectid, materialindex, modelid, txdname, texturename, materialcolor);\r\n");
- fwrite(filer, "}\r\n\r\n");
- fclose(filer);
- fclose(Handler);
- WinExec("pawno\\pawncc.exe ./scriptfiles/editingmap.pwn");
- SetTimerEx("LoadTheMap", 100, 0, "i", playerid);
- format(mapnamefile, 24, "%s", mapname);
- return true;
- }
- forward LoadTheMap(playerid);
- public LoadTheMap(playerid)
- {
- if(!fexist("editingmap.amx")) return SetTimer("LoadTheMap", 100, 0);
- new File:Handler = fopen("editingmap.amx", io_read);
- new string[512];
- while(fread(Handler, string))
- {
- SetTimerEx("Finish", 2000, 0, "id", playerid, 1);
- fclose(Handler);
- return 1;
- }
- SetTimer("LoadTheMap", 100, 0);
- return 1;
- }
- forward Finish(playerid, de);
- public Finish(playerid, de)
- {
- if(de == 1)
- {
- SendRconCommand("loadfs ../scriptfiles/editingmap");
- SetTimerEx("Finish", 2000, 0, "id", playerid, 0);
- }
- else ShowPlayerDialog(playerid, 802, DIALOG_STYLE_MSGBOX, "Map Mover", "\n\n\tMap loaded correctly.\n\n", "OK", "");
- return 1;
- }
- new Index;
- public OnObjectImported(modelid, objectid)
- {
- new Float:pos[6];
- GetObjectPos(objectid, pos[0], pos[1], pos[2]);
- GetObjectRot(objectid, pos[3], pos[4], pos[5]);
- MAPMOVER_OBJECTS[Index][ObjectTextured] = 0;
- MAPMOVER_OBJECTS[Index][ObjectTextTextured] = 0;
- MAPMOVER_OBJECTS[Index][ModelID] = modelid;
- MAPMOVER_OBJECTS[Index][PositionX] = pos[0];
- MAPMOVER_OBJECTS[Index][PositionY] = pos[1];
- MAPMOVER_OBJECTS[Index][PositionZ] = pos[2];
- MAPMOVER_OBJECTS[Index][RotationX] = pos[3];
- MAPMOVER_OBJECTS[Index][RotationY] = pos[4];
- MAPMOVER_OBJECTS[Index][RotationZ] = pos[5];
- MAPMOVER_OBJECTS[Index][ObjectID] = objectid;
- Index ++;
- return 1;
- }
- public OnObjectTexturedText(objectid, text[], materialindex, materialsize, fontface[], fontsize, bold, fontcolor, backcolor, textalignment)
- {
- new Indexe = GetIndexFromObjectID(objectid);
- MAPMOVER_OBJECTS[Indexe][ObjectTextTextured] = 1;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_IndexTextured] = 1;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_ObjectID] = objectid;
- format(TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_Text], 256, "%s", text);
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_MaterialIndex] = materialindex;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_MaterialSize] = materialsize;
- format(TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontFace], 64, "%s", fontface);
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontSize] = fontsize;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_Bold] = bold;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_FontColor] = fontcolor;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_BackColor] = backcolor;
- TEXT_TEXTURE_MAPMOVER_OBJECT[Indexe][materialindex][I_TextAlignment] = textalignment;
- return 1;
- }
- public OnObjectTextured(objectid, materialindex, modelid, txdname[], texturename[], materialcolor)
- {
- new Indexe = GetIndexFromObjectID(objectid);
- MAPMOVER_OBJECTS[Indexe][ObjectTextured] = 1;
- MAPMOVER_TEXTURES[Indexe][materialindex][IndexTextured] = 1;
- MAPMOVER_TEXTURES[Indexe][materialindex][M_ObjectID] = objectid;
- MAPMOVER_TEXTURES[Indexe][materialindex][M_Index] = materialindex;
- MAPMOVER_TEXTURES[Indexe][materialindex][M_Modelid] = modelid;
- format(MAPMOVER_TEXTURES[Indexe][materialindex][M_Txd], 64, "%s", txdname);
- format(MAPMOVER_TEXTURES[Indexe][materialindex][M_Texture], 64, "%s", texturename);
- MAPMOVER_TEXTURES[Indexe][materialindex][M_Color] = materialcolor;
- return 1;
- }
- stock GetIndexFromObjectID(objectid)
- {
- if(MAPMOVER_OBJECTS[Index][ObjectID] == objectid) return Index;
- for(new i = 0; i != MAX_MAPMOVER_OBJECTS; i++)
- {
- if(MAPMOVER_OBJECTS[i][ObjectID] == objectid)
- {
- return i;
- }
- }
- return false;
- }
- stock GetObjectIDFromIndexID(indexid)
- {
- return MAPMOVER_OBJECTS[indexid][ObjectID];
- }
Advertisement
Add Comment
Please, Sign In to add comment