SA-MP Forums Archive
Hnext command doesn't work correctly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hnext command doesn't work correctly (/showthread.php?tid=649891)



Hnext command doesn't work correctly - IndependentGaming - 16.02.2018

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


Re: Hnext command doesn't work correctly - Mugala - 17.02.2018

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


Re: Hnext command doesn't work correctly - Dayrion - 17.02.2018

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.