Hnext command doesn't work correctly
#1

I want the /hnext command to see the next house that is available to place but the problem is the house needs to be owned in order to see the next house in /hnext but I want it so it will be shown when the house is placed

command:

PHP код:
CMD:hnext(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || PlayerInfo[playerid][pShopTech] >= 1)
    {
        
SendClientMessageEx(playeridCOLOR_RED"* Listing next available house...");
        for(new 
x;x<MAX_HOUSES;x++)
        {
            if(
HouseInfo[x][hOwned] == 0)
            {
                new 
string[128];
                
format(stringsizeof(string), "%d is available to use."x);
                
SendClientMessageEx(playeridCOLOR_WHITEstring);
                break;
            }
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2"You are not authorized to use that command.");
        return 
1;
    }
    return 
1;

I tried to change if(HouseInfo[x][hOwned] == 0) to if(HouseInfo[x][hOwned] == 1) but then it shows house ID 0 is available to place but ID 0 is not a valid house as it skipped in the mysql
Reply
#2

try to check with owner's name (if u have)
Reply
#3

PHP код:
        for(new 1x<MAX_HOUSES x++) 
        { 
            if(
HouseInfo[x][hOwned] == 1
            { 
                new 
string[128]; 
                
format(stringsizeof(string), "%d is available to use."x); 
                
SendClientMessageEx(playeridCOLOR_WHITEstring); 
                break; 
            } 
        } 
Did you tried that way? I probably misunderstood what you tried to do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)