Üdv, fórumózó(k)!
Mint írtam a \"Modern Házrendszer\" témába, hogy készíteni fogok egy \"Házépítés\" rendszert, hát ezt meg is valósítottam.
Ez még csak a 0.1 verzió, ugyanis csak 10 falat lehet még lerakni, de ugyan úgy menti a falakat is a \"Falak.txt\" -be.
A \"Falak.txt\"-t nem kell létrehozni!! Magától létrehozza.
A falakat lehet bõvíteni... Pár nap múlva kb. kedden már több fal lesz és lesznek ablak,ajtó készletek a házépítéshez.
Elkészítési idõ:
16 perc (Evéssel,ivással,teszteléssel
)
Teszt:
Megvolt, mûködik.Használat:
/hazepites
#include <a_samp>
#include <zcmd>
#include <streamer>
#include <foreach>
#include <sscanf2>
#include <YSI/y_ini>
#pragma tabsize 0
new Object;
new oModel;
new FalObjektek[][]={ // Jelenleg 10 van, de lehet bõvíteni...
\"Fal\\n\",
\"Tapéta féle fal\\n\",
\"Kõfal\\n\",
\"Szikla színû fal\\n\",
\"Csupasz fehér fal\\n\",
\"Fal\\n\",
\"Csupasz krém színû fal\\n\",
\"Padló\\n\",
\"Fal\\n\",
\"Kõfal\"
};
#define OBJECT_FILE_NAME \"Falak.txt\"
#define MENU 1000
#define NEXT 1001
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Házépítés sikeresen betöltve \");
print(\"--------------------------------------\\n\");
AddObjectFromFile(OBJECT_FILE_NAME);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == MENU)
{
if(!response)
{
return 1;
}
switch(listitem)
{
case 0:
{
new FalakString[1600];
format(FalakString,sizeof FalakString,\"%s%s%s%s%s%s%s%s%s%s\",FalObjektek[0],FalObjektek[1],FalObjektek[2],FalObjektek[3],FalObjektek[4],FalObjektek[5],FalObjektek[6],FalObjektek[7],FalObjektek[8],FalObjektek[9]);
ShowPlayerDialog(playerid, NEXT, DIALOG_STYLE_LIST,\"{FFFF00}* FALAK\",FalakString,\"Ez kell\",\"Kilépés\");
}
}
return 1;
}
if(dialogid == NEXT)
{
if(!response)
{
return 1;
}
switch(listitem)
{
case 0:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19353;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19353, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 1:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19354;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19354, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 2:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19355;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19355, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 3:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19356;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19356, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 4:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19357;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19357, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 5:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19358;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19358, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 6:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19359;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19359, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 7:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19360;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19360, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 8:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19361;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19361, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
case 9:
{
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ;
GetPlayerPos(playerid, OX, OY, OZ);
oModel = 19362;
ORX = 0.0;
ORY = 0.0;
ORZ = 0.0;
Object = CreateObject(19362, OX+2, OY, OZ, ORX, ORY, ORZ);
EditObject(playerid, Object);
}
}
}
return 1;
}
stock AddObjectFromFile(DFileName[])
{
if(!fexist(DFileName)) return 0;
new File:ObjectFile, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, oTotal, Line[128];
ObjectFile = fopen(DFileName, io_read);
while(fread(ObjectFile, Line))
{
if(Line[0] == \'/\' || isnull(Line)) continue;
unformat(Line, \"ffffffiii\", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
oTotal++;
}
fclose(ObjectFile);
return oTotal;
}
stock AddObjectToFile(DFileName[], Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT)
{
new File:ObjectFile, Line[128];
format(Line, sizeof(Line), \"%f %f %f %f %f %f %i %i %i\\r\\n\", OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT, oModel);
ObjectFile = fopen(DFileName, io_append);
fwrite(ObjectFile, Line);
fclose(ObjectFile);
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new Float:oldX, Float:oldY, Float:oldZ,
Float:oldRotX, Float:oldRotY, Float:oldRotZ;
GetObjectPos(objectid, oldX, oldY, oldZ);
GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
new Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT;
if(!playerobject)
{
if(!IsValidObject(objectid)) return;
MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
if(response == EDIT_RESPONSE_FINAL)
{
OVW = GetPlayerVirtualWorld(playerid);
OINT = GetPlayerInterior(playerid);
GetObjectPos(objectid, OX, OY, OZ);
GetObjectRot(objectid, ORX, ORY, ORZ);
AddObjectToFile(OBJECT_FILE_NAME, OX, OY, OZ, ORX, ORY, ORZ, OVW, OINT);
SendClientMessage(playerid, -1, \"{33AA33}Fal mentve.\");
CreateDynamicObject(oModel, Float:OX, Float:OY, Float:OZ, Float:ORX, Float:ORY, Float:ORZ, OVW, OINT, -1, 200.0);
DestroyObject(Object);
}
if(response == EDIT_RESPONSE_CANCEL)
{
if(!playerobject)
{
SetObjectPos(objectid, oldX, oldY, oldZ);
SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ);
}
else
{
SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ);
SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ);
}
}
}
CMD:hazepites(playerid, params[])
{
ShowPlayerDialog(playerid, MENU, DIALOG_STYLE_LIST, \"{FFFF00}* HÁZÉPÍTÉS\", \"Falak (Össz. 10)\", \"Választ\", \"Kilépés\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
Képek:
Menü:
Falak menü:
Mozgatás:
U.I: Jó szórakozást!