29.07.2015, 13:59
Hello guys i created the cmd asellhouse,it works.The single think that is not working: it doesnt set the old owner key to -1 [no house],the old owner stays with the key of the house..i tried to do it you can see between /* */ but did not work.
thanks in advance
PHP код:
YCMD:asellhouse(playerid, params[], help)
{
if(PlayerData[playerid][Admin] < 6) return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
new str[128],house;
if(sscanf(params, "i", house)) return SendUsage(playerid,"/asellhouse <house id>");
{
//HouseInfo[house][hLocked] = 1;
HouseInfo[house][hOwned] = 0;
HouseInfo[house][hLock] = 0;
strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(str, sizeof(str), "~w~You have sold the House");
GameTextForPlayer(playerid, str, 10000, 3);
new Query[128];
/* mysql_format(SQL, Query, 256,"UPDATE `users` SET `HouseKey`='-1' WHERE username='%s'",HouseInfo[house][hOwner]);
mysql_tquery(SQL, Query, "", ""); */
mysql_format(SQL, Query, 128,"UPDATE houses SET `Owned`='0', `Lockk`='0', `Owner` ='The State' WHERE `ID`='%d'",HouseInfo[house][hID]);
mysql_tquery(SQL, Query, "", "");
/* mysql_format(SQL, Query, 128,"UPDATE `users` SET `HouseKey`='-1' WHERE username='%s' LIMIT 1",HouseInfo[house][hOwner]);
mysql_tquery(SQL, Query, "", ""); */
OnPropTextdrawUpdate(1, house);
} // UPDATE houses SET `Owner` = '%s' WHERE ID = %d
return 1;
}