20.08.2016, 16:39
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;
}