17.02.2013, 16:18
Hi, I am making a new type of house system and was wondering how to edit this line so when a player type's /createhouse it dosn't make a new line but it edit's the current line.
the stock
/createhouse command
Ok, I want it so if a player type's /createhouse it dosn't create the file like this
it show's up like this for typing it once
then when they type it again it change's / edit's to this
and so on. Thanks.
the stock
pawn Код:
stock HouseToInfo(DFileName[], hId, Hvw1, Hvw2, Hvw3)
{
new File:HouseInfoFile, Line[128];
format(Line, sizeof(Line), "%i, %i, %i, %i\r\n", hId, Hvw1, Hvw2, Hvw3);
HouseInfoFile = fopen(DFileName, io_append);
fwrite(HouseInfoFile, Line);
fclose(HouseInfoFile);
return 1;
}
pawn Код:
COMMAND:createhouse(playerid, params[])
{
new hId, hCost, hSell, HINT, HVW, Hvw1, Hvw2, Hvw3;
if(PlayerInfo[playerid][AdminLevel] >= 5)
{
if(!sscanf(params, "ii", hCost, hSell))
{
if(hCost >= 0 && hCost <= 9000000)
{
if(hSell >= 0 && hSell <= 9000000)
{
new string[128];
new Float:HX, Float:HY, Float:HZ, Float:HIX, Float:HIY, Float:HIZ;
hId = hId+1;
Hvw1 = Hvw1+1;
HVW = Hvw1;
GetPlayerPos(playerid, HX, HY, HZ);
HIX = 247.7055;
HIY = 1637.7229;
HIZ = -13.6428;
HINT = 1;
AddHouse(hId, Float:HX, Float:HY, Float:HZ, Float:HIX, Float:HIY, Float:HIZ, hCost, hSell, HINT, HVW);
AddHouseToFile(HOUSE_FILE_NAME, HX, HY, HZ, HIX, HIY, HIZ, HVW, HINT, hCost, hSell, hId);
HouseToInfo(HOUSE_FILE_INFO, hId, Hvw1, Hvw2, Hvw3);
format(string, sizeof(string), "House Id %d House Vw %d.", hId, Hvw1);
SendClientMessage(playerid, 0xD8D8D8FF, string);
SendClientMessage(playerid, 0xD8D8D8FF, "House Created and saved.");
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Only sell between 1 and 9000000 are avaliable.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Only cost prices between 1 and 9000000 are avaliable.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /createhouse1[hId][hCost][hSell][VW]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not an which is level 10.");
}
Код:
1, 1, 0, 0 1, 1, 0, 0
Код:
1, 1, 0, 0
Код:
2, 2, 0, 0