SA-MP Forums Archive
Player info. bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Player info. bug (/showthread.php?tid=219730)



Player info. bug - leong124 - 02.02.2011

I don't know if it's reported before,
but I found that you can't get the players' interior,health,armour,etc. instantly after you changing them.
Example:
pawn Код:
SetPlayerInterior(playerid,100);
printf("%d",GetPlayerInterior(playerid));
Same for SetPlayerHealth and SetPlayerArmour.
This problem makes me unable to make a anti lock health,
and it also cause problems on object streamers.


Re: Player info. bug - Krx17 - 02.02.2011

Don't think that's a bug. afaik it's just a side affect of the afk packet pool. The stat is set AFTER sending the info packet to the client. If the client is AFK, then the packet is put in a pool and the stat isn't changed.


Re: Player info. bug - leong124 - 02.02.2011

So you'll need to set a timer to check that on the next client update?


Re: Player info. bug - Slice - 02.02.2011

Quote:
Originally Posted by me
When you set a player's interior a packet will get sent that's basically saying "set interior to x" (obviously not in plain english, lol). When the player recieves that message and is unpaused the interior will change and the player sends a message back saying basically "my interior just changed to x". After that is recieved by the server, GetPlayerInterior will show that new interior.
When you set the interior, OnPlayerInteriorChange will be called when the client changes the interior and sends it back to the server.
If the player is paused, for example, the interior change will be delayed.

Why would you need to read the new interior that fast, anyways?


Re: Player info. bug - admantis - 02.02.2011

Quote:
Originally Posted by Slice
Посмотреть сообщение
When you set the interior, OnPlayerInteriorChange will be called when the client changes the interior and sends it back to the server.
If the player is paused, for example, the interior change will be delayed.

Why would you need to read the new interior that fast, anyways?
He stated the interior as an example
Quote:

This problem makes me unable to make a anti lock health,.......




Re: Player info. bug - Slice - 02.02.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
He stated the interior as an example
Same goes for health, aswell. Making anti-lock health isn't that easy, sorry.

You have to realize that GetPlayerHealth returns the health value that was most recently sent by the client. Why would you want GetPlayerHealth to show something that it isn't? That's just stupid.