09.01.2013, 13:37
Hello, I have these two commands:
The /houseprice command works perfectly, but the /houseaddress command only changes the first letter of the address. Say the address says "Palomino Creek" and I type '/houseaddress Dillimore', it'll change the address to 'Dalomino Creek'.
pawn Code:
CMD:houseprice(playerid, params[])
{
new string[210], cash;
new i = GetClosetHouseID(playerid);
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not authorized to use this command.");
if(AdminDuty[playerid] < 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not on duty as an Administrator [/aduty].");
if(House[i][On_Sell] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: This house price cannot be edited because it isn't for sale.");
if(i < 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not close to a house.");
if(sscanf(params, "i", cash)) return SendClientMessage(playerid, COLOR_TWGRAY, "USAGE{FFFFFF}: /houseprice [House Price Amount]");
if(cash < 1 || cash > 2500000) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: The house price can only be between $1 and $2500000.");
House[i][Price] = cash;
CheckHouse(i);
format(string,sizeof(string),"Information{FFFFFF}: You have edited house %d %s price to $%d.", House[i][CheckHouseID], House[i][Address], cash);
SendClientMessage(playerid, COLOR_ORANGE, string);
format(string, sizeof(string), "Admin Notice: Administrator %s has changed house %d %s price to $%d.", GetName(playerid), House[i][CheckHouseID], House[i][Address], cash);
SendClientMessageToAdmins(COLOR_DARKRED, string, 1);
format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"None\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"$%d\n{29CC3F}Address: "COL_WHITE"%d %s\n{29CC3F}Status: "COL_WHITE"Ownable",House[i][HouseName],House[i][Price],House[i][CheckHouseID],House[i][Address]);
UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
return 1;
}
CMD:houseaddress(playerid, params[])
{
new string[210], say;
new i = GetClosetHouseID(playerid);
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not authorized to use this command.");
if(AdminDuty[playerid] < 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not on duty as an Administrator [/aduty].");
if(House[i][On_Sell] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: This house price cannot be edited because it isn't for sale.");
if(i < 1) return SendClientMessage(playerid,COLOR_LIGHTRED,"Error{FFFFFF}: You are not close to a house.");
if(sscanf(params, "s", say)) return SendClientMessage(playerid, COLOR_TWGRAY, "USAGE{FFFFFF}: /houseaddress [Address (Example: Palomino Creek)]");
House[i][Address] = say;
CheckHouse(i);
format(string,sizeof(string),"Information{FFFFFF}: You have changed the address of house ID %d to %s.", House[i][CheckHouseID], say);
SendClientMessage(playerid, COLOR_ORANGE, string);
format(string, sizeof(string), "Admin Notice: Administrator %s has changed address of house ID %d to %s.", GetName(playerid), House[i][CheckHouseID], say);
SendClientMessageToAdmins(COLOR_DARKRED, string, 1);
format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"None\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"$%d\n{29CC3F}Address: "COL_WHITE"%d %s\n{29CC3F}Status: "COL_WHITE"Ownable",House[i][HouseName],House[i][Price],House[i][CheckHouseID],House[i][Address]);
UpdateDynamic3DTextLabelText(House[i][DLabel],-1,string);
return 1;
}