/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(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new houseid = PlayerInfo[playerid][pVW];
if (PlayerInfo[playerid][pAdmin] > 1336)
{
new path[22];
format(path, sizeof(path), "Houses/House_%04d.ini", houseid);
if(!fexist(path))
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid house ID.");
return 1;
}
new string[90];
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
DOF2_SetFloat(path, "ExX", x, "General");
DOF2_SetFloat(path, "ExY", y, "General");
DOF2_SetFloat(path, "ExZ", z, "General");
GetPlayerFacingAngle(playerid, z);
if(z < 180)
{
z = z + 180;
}
else
{
z = z - 180;
}
DOF2_SetFloat(path, "ExA", z, "General");
DOF2_SaveFile();
format(string, sizeof(string), "SERVER: You have successfully set the exit of house ID %d", houseid);
SendClientMessage(playerid, COLOR_ADMIN, string);
}
else
{
SendClientMessage(playerid, COLOR_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(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new businessid = PlayerInfo[playerid][pVW]-1000;
if (PlayerInfo[playerid][pAdmin] > 1336)
{
new path[27];
format(path, sizeof(path), "Businesses/Business_%02d.ini", businessid);
if(!fexist(path))
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid business ID.");
return 1;
}
new string[90];
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
DOF2_SetFloat(path, "ExX", x, "General");
DOF2_SetFloat(path, "ExY", y, "General");
DOF2_SetFloat(path, "ExZ", z, "General");
GetPlayerFacingAngle(playerid, z);
if(z < 180)
{
z = z + 180;
}
else
{
z = z - 180;
}
DOF2_SetFloat(path, "ExA", z, "General");
DOF2_SaveFile();
format(string, sizeof(string), "SERVER: You have successfully set the exit of business ID %d", businessid);
SendClientMessage(playerid, COLOR_ADMIN, string);
}
else
{
SendClientMessage(playerid, COLOR_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(playerid, COLOR_GREY, "USAGE: /hexit [houseid]");
return 1;
}
Re: /hexit command bugged -
Threshold - 21.08.2016
Why are you using %04d and %02d? Just use %d ...