Player Variables problem
#1

Hey my problem is basically: (House System)

When you enter:
pawn Код:
SetPVarInt(playerid,"HouseID",HouseInfo[i][ID]);
(This is to make sure you exit the same place once you exit since theres more houses with the same interior)


When you exit:
pawn Код:
DeletePVar(playerid,"HouseID");
but for some reason it wont delete it again. I tried by first going into the house with ID 0 then after that I exited and went into house ID 1 but ended up getting out at ID 0 and not ID 1
Reply
#2

Are you deleting them before you set their position?
Reply
#3

No, I'm deleting right after, I don't know maybe it goes too fast, it's like this: That's the stuff for when your exiting
pawn Код:
{
                    SetPlayerPos(playerid,HouseInfo[GetPVarInt(playerid,"HouseID")][SpawnX],HouseInfo[GetPVarInt(playerid,"HouseID")][SpawnY],HouseInfo[GetPVarInt(playerid,"HouseID")][SpawnZ]);
                    SetPlayerInterior(playerid,0);
                    SetPlayerVirtualWorld(playerid,0);
                    DeletePVar(playerid,"HouseID");
                }
Reply
#4

I guess you're not saving HouseInfo[bla][ID] good, and I don't see a reason to save it in an array.

SetPVarInt(playerid,"HouseID",i);
Reply
#5

Nevermind I don't think that's the fault, Just tried entering House ID 1 first and still got out at house id 0.
Reply
#6

Why you need to make it so hard?

Make like this, when you enter house its get house ID, example: PlayerHouseID[playerid] = houseid;
and when /exit its simply send you to
pawn Код:
SetPlayerPos(playerid,HouseInfo[houseid][SpawnX],HouseInfo[houseid][SpawnY],HouseInfo[houseid][SpawnZ]);
                    SetPlayerInterior(playerid,0);
                    SetPlayerVirtualWorld(playerid,0);
atleast I use this way.
Reply
#7

That's not an answer to his question, plus I already posted that.

Print out some variables at /exit. Check for the house ID's X/Y/Z co-ords, and print the house ID (Before deleting the PVar)
Reply
#8

Gonna try with a PlayerHouseID[playerid] instead of the Player Variables

Gonna try and PrintF first the stuff when I enter.
Reply
#9

It should do right according to the output:

Код:
[10:54:25] Alfo entered house id: 1
[10:54:27] Alfo exited house id: 1
[10:54:27] Alfo exited house id: 0
[10:54:27] Alfo exited house id: 0
Was with GetPVarInt() & SetPVarInt()
Reply
#10

According to that, it performs the exit 3 times. Can you show me the full CMD?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)