SA-MP Forums Archive
Player Variables problem - 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: Player Variables problem (/showthread.php?tid=159705)



Player Variables problem - oliverrud - 14.07.2010

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


Re: Player Variables problem - Hiddos - 14.07.2010

Are you deleting them before you set their position?


Re: Player Variables problem - oliverrud - 14.07.2010

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");
                }



Re: Player Variables problem - Hiddos - 14.07.2010

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);


Re: Player Variables problem - oliverrud - 14.07.2010

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


Re: Player Variables problem - ikey07 - 14.07.2010

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.


Re: Player Variables problem - Hiddos - 14.07.2010

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)


Re: Player Variables problem - oliverrud - 14.07.2010

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

Gonna try and PrintF first the stuff when I enter.


Re: Player Variables problem - oliverrud - 14.07.2010

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()


Re: Player Variables problem - Hiddos - 14.07.2010

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