Mysql cmd admin error -
nbx2000 - 13.06.2018
problem cmd admin to sell house is not updated to zero value hID on the table mysql en phpmyadmin
Код:
CMD:asellh(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 6) {
new i;
i = GetHouseID(playerid);
if(i == -255) return SendClientMessage(playerid, 0xDC143CAA, "ERROR: You need to be on house icon to remove it");
new Query[128],string[128];
format(Query, sizeof(Query), "UPDATE `houses` SET `Owner` = '%s', `Owned` = '%d' WHERE `ID` = '%d'","NULL",0,HouseInfo[i][Houseid]);
mysql_tquery(mysql, Query, "", "");
if(HouseInfo[i][Owned] == 1) {
HERE! format(Query, sizeof(Query),"UPDATE `accounts` SET `hID` = 0,`HOwned` = 0 WHERE `Name` = '%s'",pName(playerid));HERE
mysql_tquery(mysql, Query, "", "");
foreach (new i2 : Player) {
if(IsPlayerConnected(i2)) {
if(strcmp(HouseInfo[i][Owner],pName(i2),false )== 0) {
PlayerInfo[i2][hOwned] = 0;
PlayerInfo[i2][hID] = 0;
format(string,sizeof string,"Administrator %s Has Reseted Your House",pName(playerid));
SendClientMessage(i2,0x33AA33AA,string);
}
}
}
}
HouseInfo[i][Owned] = 0;
strmid(HouseInfo[i][Owner],"NULL", 0, strlen("NULL"), 255);
DestroyDynamicPickup(HousePickup[i]);
HousePickup[i] = CreateDynamicPickup(1273, 23, HouseInfo[i][HX], HouseInfo[i][HY], HouseInfo[i][HZ]);
UpdateDynamic3DTextLabelText(hTextInfo[i],0x00FF00FF,"Not Owned");
DestroyDynamicMapIcon(housemapicon[i]);
housemapicon[i] = CreateDynamicMapIcon(HouseInfo[i][HX], HouseInfo[i][HY], HouseInfo[i][HZ],31,c_y);
format(string,sizeof string,"You've Successfully Sold This house [ ID: %d ]",i);
SendClientMessage(playerid, 0x33AA33AA, string);
format(string,sizeof string,"Administrator %s(IP: %s) Has Rested House ID: %d",pName(playerid),pIP(playerid),i);
SaveToFile("resetlog",string);
MessageToAdmins(red ,string);
} else return SendClientMessage(playerid, 0xDC143CAA, "ERROR: You need to be rcon to use this command");
return 1;
}
Re: Mysql cmd admin error -
JasonRiggs - 13.06.2018
Show us the mysql_log to know the exact problem.
Re: Mysql cmd admin error -
nbx2000 - 13.06.2018
Quote:
Originally Posted by JasonRiggs
Show us the mysql_log to know the exact problem.
|
the problem is the command when using the sell house command do not change the value to 0 hID
clean mysql log
Re: Mysql cmd admin error -
Slawi - 13.06.2018
Check the column if it is correct (Name) and table (accounts)
Re: Mysql cmd admin error -
Calisthenics - 13.06.2018
Bad design. Your tables have duplicates.
Table "accounts" should have only the main data of player (id, name, ip, password etc.)
Table "houses" is enough for you to extract data only once and having the same data on another table is not good.
Column "Owner" should have been an integer (userid) and be a FOREIGN KEY to link the two tables. Using JOINs, you can retrieve name of owner and/or which house (if any) the player owns upon logging in.
Re: Mysql cmd admin error -
GTLS - 13.06.2018
This is Jlalt's House system i guess? Log in to your phpmyadmin and make sure, ID column is set to Auto Increment and Primary Key.