/hexit command bugged
#1

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;

Reply
#2

/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;

Reply
#3

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

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

What do you mean?
Reply
#6

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

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?
Reply
#8

Show the files you have. sscanf params? where?
Reply
#9



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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)