SA-MP Forums Archive
Checking a players house key and a house id - 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: Checking a players house key and a house id (/showthread.php?tid=329747)



Checking a players house key and a house id - Luis- - 30.03.2012

Hi, I have my own house system but i'm confused. I have it set so that when a player buys a house it sets their House Key var to the House's ID, this works perfectly but when it comes to checking the house key and house id it just doesn't work.

pawn Код:
if(PlayerInfo[playerid][pHouse] > -1) {
        SetPlayerPosEx(playerid, HouseInfo[PlayerInfo[playerid][pHouse]][hX], HouseInfo[PlayerInfo[playerid][pHouse]][hY], HouseInfo[PlayerInfo[playerid][pHouse]][hZ]);
    }
There is the code to spawn a player who has just logged in at their house, thats if they have one. How would I script it?


Re: Checking a players house key and a house id - Skribblez - 30.03.2012

When someone buys a house, are you updating or saving it when the player disconnects? Might have missed that part.

Edit: And I mean both player and house info.


Re: Checking a players house key and a house id - Joshb93 - 30.03.2012

You know, oddly, i had this same problem before, and i searched everywhere, and i had everything right.
What i did, and it fixed my problem, was i defined -1 as INVALID_HOUSE_ID.

So,

#define INVALID_HOUSE_ID -1

Then, in your code

pawn Код:
if(PlayerInfo[playerid][pHouse] != INVALID_HOUSE_ID)
And it fixed it for me, idk what was up with it, as it should have been the same, but it did the job.

Maybe that will help, idk.


Re: Checking a players house key and a house id - Joshb93 - 30.03.2012

Oh, i found a bug in your script.

I joined your server, and i see "AFK TIME: 175 MINUTES" in the center of my screen. :P


Re: Checking a players house key and a house id - Luis- - 30.03.2012

Would I check the players house key like this?
pawn Код:
HouseInfo[PlayerInfo[playerid][pHouse]][hX]
Notice the PlayerInfo[playerid][pHouse] inside.


Re: Checking a players house key and a house id - Twisted_Insane - 30.03.2012

I don't know about your enum, but I'd rather guess on the following line:

pawn Код:
HouseInfo(PlayerInfo[playerid][pHouse][hX])



Re: Checking a players house key and a house id - Luis- - 30.03.2012

Just gives me errors, it worked before, just have no idea why it isn't now.