SA-MP Forums Archive
State changes when entering and exiting a vehicle - 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: State changes when entering and exiting a vehicle (/showthread.php?tid=581517)



State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

Another post from me guys - this is separate to what I wrote about the objects disappearing when I exit a vehicle.
I decided to log what states the player goes into when entering and exiting a vehicle

When entering the vehicle it showed:
[17:43:06] Marcus_Williams changed state to 2 from 1
[17:43:09] Marcus_Williams changed state to 8 from 1

When exiting the vehicle it showed:
[17:43:09] Marcus_Williams changed state to 1 from 2
[17:43:10] Marcus_Williams changed state to 1 from 8

I need a second opinion on this because I find it really strange that the breakdown is like this
ONFOOT > DRIVER
ONFOOT > SPAWNED

DRIVER > ONFOOT
SPAWNED > ONFOOT

Is this normal? I thought I was already spawned when these logs showed up
[17:40:55] [join] Marcus_Williams has joined the server
[17:41:00] Marcus_Williams changed state to 9 from 0
[17:41:03] Marcus_Williams changed state to 8 from 9
[17:41:03] Marcus_Williams changed state to 1 from 8


Re: State changes when entering and exiting a vehicle - gurmani11 - 13.07.2015

Is there any?

pawn Код:
SetPlayerVirtualWorld(playerid,worldid);



Re: State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
Is there any?

pawn Код:
SetPlayerVirtualWorld(playerid,worldid);
Where should I look for this?
There is some scattered around the script but not in the OnPlayerStateChange


Re: State changes when entering and exiting a vehicle - gurmani11 - 13.07.2015

where ever have you added this

printf function

there it must be


Re: State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
where ever have you added this

printf function

there it must be
Are you sure this has something to do with virtual worlds?
From what I've read around SA-MP, PLAYER_STATE_SPAWNED is called when you initially spawn and shouldn't be called again.
I'm not sure it has anything to do with virtual worlds and from what I've seen, when I changed virtual worlds - my state doesn't change


Re: State changes when entering and exiting a vehicle - gurmani11 - 13.07.2015

indeed because worlds are changing
at least show some code ....


Re: State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

Quote:
Originally Posted by gurmani11
Посмотреть сообщение
indeed because worlds are changing
at least show some code ....
That doesn't have anything to do with spawning, I've tested changing virtual worlds and it doesn't trigger OnPlayerStateChange


Re: State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

I've tested some conditions before and after the entering and exiting the vehicle

I used IsPlayerAttachedObjectSlotUsed(playerid, slot) before and during being inside the vehicle.
The slot was used and the clothing object was still attached.

Only when I exited the vehicle and the object was removed did IsPlayerAttachedObjectSlotUsed empty itself, so in the process somewhere - the script thinks the player has spawned?
I don't know how this is possible because I never actually respawned or noticed any difference and OnPlayerSpawn was not called.


Re: State changes when entering and exiting a vehicle - HarrisonC - 13.07.2015

The issue turns out to be with Slice's weapon-config include.
Not sure what causes it but when I took this out of my script, everything went back to as expected.