16.04.2015, 13:42
I have made this for deleting house...it includes furniture,but the problem is that when i put for example /deletehouse [houseid], if it's an invalid house id it says wrong house id,but if i put a right house id that is used it shows error message by ZCMD,why?here is the code:
pawn Код:
CMD:resethouse(houseid, params[])
{
new house;
if(!sscanf(params, "d", house))
{
if(hInfo[house][hcreated] != 1) return SendClientMessage(houseid, -1, "Invalid house id");
else
{
hInfo[house][hcreated] = 0; //it only changes these two things
hInfo[house][houseowned] = 0; //it only changes these two things
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][playerhouse] == house)
{
pInfo[i][playerhouse] = 0;
}
}
hInfo[house][housepot] = 0;
hInfo[house][housegun] = 0;
hInfo[house][housecash] = 0;
hInfo[house][houselock] = 0;
format(string, sizeof(string), "You have deleted house id %d.", house);
SendClientMessage(houseid, COLOR_GREY, string);
new query[128];
mysql_format(dbHandle, query, sizeof(query), "DELETE * FROM `houselist` WHERE `hID`=%d", house);
printf("%d deleted", house);
mysql_tquery(dbHandle, query, "", "");
}
}
else
{
SendClientMessage(houseid, COLOR_GREY, "/resethouse [houseid]");
}
return 1;
}