13.02.2012, 04:36
(
Последний раз редактировалось ryansheilds; 13.02.2012 в 08:13.
)
I created my own house system, but there is a slight problem with one of the commands, the command is /hedit, although the command works if you type the option you want, for example if you want to set the house interior you type /hedit interior [houseid] and it sets the interior, this is same for all the options - exterior, colour.. but if you type /hedit by its self it overwrites house id 0 and sets all the options to the position you are stood at (exterior, interior (it sets colour to 0))
Image:
Code:
Image:
Code:
pawn Код:
CMD:hedit(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 4)
{
new input[32],id,value;
if(sscanf(params,"s[32]dD",input,id,value))
{
SendClientMessage(playerid, COLOR_WHITE,"USAGE: /hedit [name] [houseID] [(optional)value]");
SendClientMessage(playerid, COLOR_WHITE,"Available names: Exterior, Color, Interior, Delete, Lock, PickupType, Level, VehicleAble, Admin");
}
if(id < 0 || id > MAX_HOUSES) return SendClientMessage(playerid, COLOR_WHITE,"ID Must be from 0 till 500");
if(strcmp(input,"exterior",true) == 0)
{
GetPlayerPosData(playerid);
HouseInfo[id][hExteriorX] = GFFP[playerid][0];
HouseInfo[id][hExteriorY] = GFFP[playerid][1];
HouseInfo[id][hExteriorZ] = GFFP[playerid][2];
HouseInfo[id][hExteriorA] = GFFP[playerid][3];
HouseInfo[id][hExtVw] = GIFP[playerid][1];
HouseInfo[id][hExtInt] = GIFP[playerid][0];
SaveHouses();
LoadHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the exterior !");
}
if(strcmp(input,"interior",true) == 0)
{
GetPlayerPosData(playerid);
HouseInfo[id][hInteriorX] = GFFP[playerid][0];
HouseInfo[id][hInteriorY] = GFFP[playerid][1];
HouseInfo[id][hInteriorZ] = GFFP[playerid][2];
HouseInfo[id][hInteriorA] = GFFP[playerid][3];
HouseInfo[id][hIntVW] = id+1000;
HouseInfo[id][hInt] = GIFP[playerid][0];
SetPlayerVirtualWorld(playerid,id+1000);
SaveHouses();
LoadHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the interior !");
}
if(strcmp(input,"color",true) == 0)
{
//0-9
if(value < 0 || value > 9) return SendClientMessage(playerid, COLOR_WHITE,"Color must be from 0 till 9");
HouseInfo[id][hColor] = value;
SaveHouses();
LoadHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the color !");
}
if(strcmp(input,"Lock",true) == 0)
{
if(HouseInfo[id][hLock] == 0)
{
HouseInfo[id][hLock] = 1;
GameTextForPlayer(playerid,"~n~ ~n~ Door ~r~ Locked",3000,3);
return 1;
}
if(HouseInfo[id][hLock] == 1)
{
HouseInfo[id][hLock] = 0;
GameTextForPlayer(playerid,"~n~ ~n~ Door ~g~ Unlocked",3000,3);
return 1;
}
}
if(strcmp(input,"PickupType",true) == 0)
{
if(value < 0 || value > 14) return SendClientMessage(playerid, COLOR_WHITE,"Pickup ID must be 0 to 14");
HouseInfo[id][hPickupType] = value;
SaveHouses();
LoadHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the pickup model !");
}
if(strcmp(input,"Level",true) == 0)
{
HouseInfo[id][hLevel] = value;
SaveHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the Level !");
}
if(strcmp(input,"Admin",true) == 0)
{
if(HouseInfo[id][hAdmin] == 0)
{
HouseInfo[id][hAdmin] = 1;
SendClientMessage(playerid, COLOR_WHITE,"The door will now work for (RCON)admins only !");
SaveHouses();
return 1;
}
if(HouseInfo[id][hAdmin] == 1)
{
HouseInfo[id][hAdmin] = 0;
SendClientMessage(playerid, COLOR_WHITE,"The door will now work for all players !");
SaveHouses();
return 1;
}
}
if(strcmp(input,"VehicleAble",true) == 0)
{
HouseInfo[id][hVehicleAble] = value;
SendClientMessage(playerid, COLOR_WHITE,"You have set vehicle able !");
SaveHouses();
return 1;
}
if(strcmp(input,"Delete",true) == 0)
{
HouseInfo[id][hInteriorX] = 0;
HouseInfo[id][hInteriorY] = 0;
HouseInfo[id][hInteriorZ] = 0;
HouseInfo[id][hInteriorA] = 0;
HouseInfo[id][hIntVW] = 0;
HouseInfo[id][hInt] = 0;
HouseInfo[id][hExteriorX] = 0;
HouseInfo[id][hExteriorY] = 0;
HouseInfo[id][hExteriorZ] = 0;
HouseInfo[id][hExteriorA] = 0;
HouseInfo[id][hIntVW] = 0;
HouseInfo[id][hInt] = 0;
HouseInfo[id][hColor] = 0;
HouseInfo[id][hAdmin] = 0;
HouseInfo[id][hLevel] = 0;
HouseInfo[id][hPickupType] = 0;
SaveHouses();
LoadHouses();
SendClientMessage(playerid, COLOR_WHITE,"You have set the interior !");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You're not authorized to that command!");
return 1;
}
return 1;
}