CMD:Exit does not get the right house - 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: CMD:Exit does not get the right house (
/showthread.php?tid=450701)
CMD:Exit does not get the right house -
thimo - 14.07.2013
Okay so i got this:
pawn Код:
CMD:exit(playerid, params[])
{
if(APlayerData[playerid][CurrentHouse] > -1)
{
new HouseID;
APlayerData[playerid][CurrentHouse] = HouseID;
SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
APlayerData[playerid][CurrentHouse] = -1;
}
else
SendClientMessage(playerid, 0xFFFFFF, "{FF0000}You are not in a house!");
return 1;
}
But it always gets me to the ID 0. While CurrentHouse is for example 2. I debugged that it is 2 so why does this not get the positions?
AW: CMD:Exit does not get the right house -
Macronix - 14.07.2013
Yes, because "new HouseID" returns 0 and you assign your CurrentHouse variable to this.
You have to store the houseID when you enter the house
Respuesta: CMD:Exit does not get the right house -
Xabi - 14.07.2013
new HouseID;
When you make that, you are initializing the variable to 0, that's why it is allways the house in the id 0, you don't change that value.
Re: CMD:Exit does not get the right house -
thimo - 14.07.2013
CurrentHouse is assigned to the houseID when you enter the house.
Respuesta: Re: CMD:Exit does not get the right house -
Xabi - 14.07.2013
Quote:
Originally Posted by thimo
CurrentHouse is assigned to the houseID when you enter the house.
|
So, maybe you want to do this:
pawn Код:
new HouseID = APlayerData[playerid][CurrentHouse];
Re: CMD:Exit does not get the right house -
thimo - 14.07.2013
My bad. Sorry xD