Admin /asellallhouse command
#1

Hi, I want to make an order to ease my work, the order is to sell all the houses at once, can someone help me? Here is the model from / asellhouse you can modify it or something? Please help me

CMD:asellhouse(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
new house;
if(sscanf(params, "d", house)) return SendClientMessage(playerid, 0xFFFFFFFF, "{B8DBFF}Synthax: /asellhouse <House ID>");
if (PlayerInfo[playerid][pAdmin] >= 5)
{
new ownerh[64],field[128];
format(field,128,"SELECT `Owner` FROM `houses` WHERE `ID`='%d'",house);
mysql_query(SQL,field);
mysql_store_result();
if(mysql_retrieve_row())
{
mysql_fetch_field_row(ownerh, "Owner");
}
mysql_free_result();
HouseInfo[house][hHel] = 0;
HouseInfo[house][hArm] = 0;
HouseInfo[house][hLock] = 0;
HouseInfo[house][hOwned] = 0;
strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new str2[256];
format(str2,sizeof(str2),"UPDATE `houses` SET `Hel`='0',`Arm`='0',`Lockk`='0',`Owned`='0',`Owner `='The State' WHERE `ID`='%d'",house);
mysql_query(SQL,str2);
format(str2,sizeof(str2),"UPDATE users SET `House`='999' WHERE `name`='%s'",ownerh);
mysql_query(SQL,str2);
OnPropTextdrawUpdate(1, house);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{5CAD5C}Error: Your admin level isn't high enough to use this command.");
}
}
return 1;
}
Reply
#2

To start with use the [ pawn]Code goes in here[/ pawn] tags because this just hurts our eyes.

To make it sell all houses, just remove the sscanf line, create a loop which loops through all houses, and put the code inside that loop, so it does exactly the same, but without params.
Reply
#3

Can you show me?
Reply
#4

To start with, i need to know what the max houses are, as you'll have to loop them all
i've used MAX_HOUSES, and i don't know what you used
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)