SA-MP Forums Archive
/hexit command bugged - 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: /hexit command bugged (/showthread.php?tid=615300)



/hexit command bugged - NealPeteros - 20.08.2016

Hi there! /hexit is simply defining the exit place of a house. The bug is that when I use it IG, it says "Invalid House ID" Here's the code.

PHP код:
CMD:hexit(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        new 
houseid PlayerInfo[playerid][pVW];
        if (
PlayerInfo[playerid][pAdmin] > 1336)
        {
            new 
path[22];
            
format(pathsizeof(path), "Houses/House_%04d.ini"houseid);
            if(!
fexist(path))
            {
                
SendClientMessage(playeridCOLOR_RED"ERROR: Invalid house ID.");
                return 
1;
            }
            new 
string[90];
            new 
FloatxFloatyFloatz;
            
GetPlayerPos(playeridxyz);
            
DOF2_SetFloat(path"ExX"x"General");
            
DOF2_SetFloat(path"ExY"y"General");
            
DOF2_SetFloat(path"ExZ"z"General");
            
GetPlayerFacingAngle(playeridz);
            if(
180)
            {
                
180;
            }
            else
            {
                
180;
            }
            
DOF2_SetFloat(path"ExA"z"General");
            
DOF2_SaveFile();
            
format(stringsizeof(string), "SERVER: You have successfully set the exit of house ID %d"houseid);
            
SendClientMessage(playeridCOLOR_ADMINstring);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"ERROR: You don't have the premission to use that command.");
        }
    }
    return 
1;




Re: /hexit command bugged - NealPeteros - 20.08.2016

/bexit as well. It defines the exit place of a business. Same bug
PHP код:
CMD:bexit(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        new 
businessid PlayerInfo[playerid][pVW]-1000;
        if (
PlayerInfo[playerid][pAdmin] > 1336)
        {
            new 
path[27];
            
format(pathsizeof(path), "Businesses/Business_%02d.ini"businessid);
            if(!
fexist(path))
            {
                
SendClientMessage(playeridCOLOR_RED"ERROR: Invalid business ID.");
                return 
1;
            }
            new 
string[90];
            new 
FloatxFloatyFloatz;
            
GetPlayerPos(playeridxyz);
            
DOF2_SetFloat(path"ExX"x"General");
            
DOF2_SetFloat(path"ExY"y"General");
            
DOF2_SetFloat(path"ExZ"z"General");
            
GetPlayerFacingAngle(playeridz);
            if(
180)
            {
                
180;
            }
            else
            {
                
180;
            }
            
DOF2_SetFloat(path"ExA"z"General");
            
DOF2_SaveFile();
            
format(stringsizeof(string), "SERVER: You have successfully set the exit of business ID %d"businessid);
            
SendClientMessage(playeridCOLOR_ADMINstring);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"ERROR: You don't have the premission to use that command.");
        }
    }
    return 
1;




Re: /hexit command bugged - Shinja - 20.08.2016

This means from your code that file doesn't exist, does it?


Re: /hexit command bugged - Abagail - 20.08.2016

The path string is probably not what you want it to be.


Re: /hexit command bugged - NealPeteros - 20.08.2016

What do you mean?


Re: /hexit command bugged - Shinja - 20.08.2016

Make sure this file
PHP код:
"Houses/House_%04d.ini" 
exists, the folder, and the .ini file
Inside scriptfiles folder


Re: /hexit command bugged - NealPeteros - 21.08.2016

Yes, I do have it. I think the problem is the sscanf params. When an admin uses that command, the sscanf params must be shown. In this code, it wasn't shown. Am I right?


Re: /hexit command bugged - Shinja - 21.08.2016

Show the files you have. sscanf params? where?


Re: /hexit command bugged - NealPeteros - 21.08.2016



Isn't it supposed to have something like this:
PHP код:
        if(sscanf(params"i"houseid))
        {
            
SendClientMessage(playeridCOLOR_GREY"USAGE: /hexit [houseid]");
            return 
1;
        } 



Re: /hexit command bugged - Threshold - 21.08.2016

Why are you using %04d and %02d? Just use %d ...