buyhouse command problem
#3

PHP код:
CMD:buy(playerid,params[])
{
    new 
count;
    for(new 
0MAX_HOUSES;i++)//Loop threw all houses.
    
{
        if(
IsPlayerInRangeOfPoint(playerid,8.0hInfo[i][HouseEX],hInfo[i][HouseEY], hInfo[i][HouseEZ]))
        {
            
count++;
            
//if(GetPlayerMoney(playerid) < HInfo[i][Price]) return SendClientMessage(playerid,-1,"You don't have enough money");//Checking the players money, to see if he has enough to buy the house.
            //GivePlayerMoney(playerid, -hInfo[i][HousePrice]);
            // CHECK IF PLAYER ALREADY OWN A HOUSE
            
if(hInfo[i][HouseOwned] == 1) return SendClientMessage(playerid,-1,"This house is already owned");//Checking if the house is already owned.
            
hInfo[i][HouseOwned] = 1;//Setting the house owned var to 1.
            
new hName[24],string[145], query[100];//Creating the necessary vars.
            
GetPlayerName(playerid,hName,sizeof(hName));//Retrieving the player's name.
            // WHAT IS HouseEX?? HouseID should be there.
            
format(querysizeof(query), "UPDATE `houses` SET `HouseOwner` = '%s', `HouseOwned` = '1' WHERE `HouseEX` = '%f'"hNamehInfo[playerid][HouseEX]);
            
mysql_tquery(dbHandlequery);
            
format(string145"{FFD700}House Title(%i): {FFFFFF}%s\n{FFD700}House Owner: {FFFFFF}%s\n {FFD700}House Price: {FFFFFF}$%d"hInfo[i][HouseID], hInfo[i][HouseTitle], hInfo[i][HousePrice]);
            
Update3DTextLabelText(hInfo[i][HouseDetails],0xFF0000FF,string);//Updating the label with a red color
            
SendClientMessage(playerid, -1"House bought.");
        }
        return 
1;
    }
    if(!
count) return SendClientMessage(playerid, -1"You aren't near a house!");
    return 
1;

Reply


Messages In This Thread
buyhouse command problem - by div - 05.07.2018, 08:02
Re: buyhouse command problem - by Libbyphay - 05.07.2018, 08:26
Re: buyhouse command problem - by kovac - 05.07.2018, 11:01

Forum Jump:


Users browsing this thread: 2 Guest(s)