15.05.2017, 16:17
Код:
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; }
pawn Код:
CMD:deletefurn(playerid, params[])
{
new holder[1000];
new hworld = GetPlayerVirtualWorld(playerid);
new house = PlayerInfo[playerid][HouseID];
if(house == 0) return SCM(playerid, COLOR_LIGHTRED, "You don't own a house.");
for(new h = 1; h < sizeof(HouseInfo); h++)
{
if(hworld == HouseInfo[h][hInsideWorld])
{
if(house == HouseInfo[h][hInsideWorld])
{
SelectObject(playerid);
DeletingFurn[playerid] = 1;
}
}
}
return 1;
}
pawn Код:
public OnPlayerSelectDynamicObject(playerid, objectid, modelid, Float:x, Float:y, Float:z)
{
new holder[1000];
new hworld = GetPlayerVirtualWorld(playerid);
new house = PlayerInfo[playerid][HouseID];
if(house == 0) return SCM(playerid, COLOR_LIGHTRED, "You don't own a house.");
for(new h = 1; h < sizeof(HouseInfo); h++)
{
if(hworld == HouseInfo[h][hInsideWorld])
{
if(house == HouseInfo[h][hInsideWorld])
{
if(DeletingFurn[playerid] == 1)
{
EDIT_OBJECT[playerid] = objectid;
ShowPlayerDialog(playerid, DIALOG_DELETE_FURNITURE, DIALOG_STYLE_MSGBOX, "{FFFFFF}Furniture Deletion", "{FFFFFF}You are about to delete a furniture object, are you sure you want to?", "Yes", "No");
DeletingFurn[playerid] = 0;
}
if(EditingFurn[playerid] == 1)
{
EditDynamicObject(playerid, objectid);
EditingFurn[playerid] = 0;
}
}
}
}
return 1;
}
pawn Код:
if(dialogid == DIALOG_DELETE_FURNITURE)
{
if(!response)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You cancelled deleting the furniture!");
return 1;
}
switch(listitem)
{
case 0:
{
DestroyDynamicObject(EDIT_OBJECT[playerid]);
DestroyObject(EDIT_OBJECT[playerid]);
}
case 1:
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You cancelled deleting the furniture!");
}
}
}