my /enter system only works for house 1 - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: my /enter system only works for house 1 (
/showthread.php?tid=93724)
my /enter system only works for house 1 -
Paladin - 26.08.2009
Hey, I made a house system, every time a house is placed, it is assigned a unique ID (HouseID) and my /enter command is failing since I can only enter the house of HouseId 1.
The house id is also the virtual world it sets them to.
pawn Код:
if(strcmp(cmd, "/enter", true) == 0)
{
for(new i = 0; i < houses; i++)
{
if(PlayerToPoint(2.0, playerid,HouseInfo[i][hHousex], HouseInfo[i][hHousey], HouseInfo[i][hHousez]))
{
SetPlayerInt(playerid,HouseInfo[i][hHouseInterior]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hHouseId]);
PlayerInfo[playerid][pInside] = 1;
GetPlayerPos(playerid, x, y, z);
PlayerInfo[playerid][pExitx] = x;
PlayerInfo[playerid][pExity] = y;
PlayerInfo[playerid][pExitz] = z;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near an entrace");
return 1;
}
}
}
the variable "houses" is read from a file.
Re: my /enter system only works for house 1 -
James_Alex - 26.08.2009
remove the 2 "return 1;"
Re: my /enter system only works for house 1 -
Paladin - 26.08.2009
pawn Код:
if(strcmp(cmd, "/enter", true) == 0)
{
for(new i = 0; i < houses; i++)
{
if(PlayerToPoint(2.0, playerid,HouseInfo[i][hHousex], HouseInfo[i][hHousey], HouseInfo[i][hHousez]))
{
SetPlayerInt(playerid,HouseInfo[i][hHouseInterior]);
SetPlayerVirtualWorld(playerid, HouseInfo[i][hHouseId]);
PlayerInfo[playerid][pInside] = 1;
GetPlayerPos(playerid, x, y, z);
PlayerInfo[playerid][pExitx] = x;
PlayerInfo[playerid][pExity] = y;
PlayerInfo[playerid][pExitz] = z;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near an entrace");
}
}
}
Works like a broken charm, I can now enter and exit all houses, but even when I do it gives me this "SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near an entrace");"