Checking a players house key and a house id
#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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
Reply
#5

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)