[Include] Streamer Position Compensation
#1

Streamer position compensation!

So many people complain about setting players on streamed objects. The problem is that these people are setting the player on the objects before the objects are actually streamed in for the player to land on. This will work around that.
__________________________________________________ __________________________________________________

Description:

The only function included is as follows:
pawn Код:
SetPlayerCompensatedPos(playerid, Float:X, Float:Y, Float:Z, wait_time = 1000)
There are two basic usages for this.

1. Absolutely on the ground:
  • The position you specify is exactly where the player would be if they were standing on the ground. You can set wait_time to 0 so the player won't be controllable until the objects are definitely streamed.
2. Probably on the ground:
  • The position you specify MAY be on the ground. Just set the wait_time (which defaults to 1 second) to how long the script will wait for the objects to stream. If the objects are detected the player will be set controllable. If the objects do not stream before wait_time is over the player will be released then.
Or if you set the wait_time to 0 and the ground never streams (or if you set the position too high or low) then the player will be frozen forever (or until you release them).


You can predefine define `TP_WAIT_TIME` before including this to set the default wait time.
Slice recommended really high wait times, at least 5 seconds.


Also, on a side note, I haven't tested this yet... Yes, I know I should've tested it before I released it, but I didn't! I don't have any lag to spare. If someone could confirm it works that'd be great. Here's how you can test:
  1. Create a bunch of objects somewhere (THOUSANDS, seriously, a hundred thousand dispersed across an area of about 500x500 should do the trick).
  2. Create a plane object (anything flat and thin) above them.
  3. Spawn a player far away from them.
  4. Set the player on the plane with SetPlayerPos.
  5. Repeat #3.
  6. Repeat #4 using SetPlayerCompensatedPos with wait time 0.
  7. Repeat #3.
  8. Repeat #4 using SetPlayerCompensatedPos with wait time 5000.
  9. Repeat #3.
  10. Repeat #4 using SetPlayerCompensatedPos with wait time 5000 this time higher than the ground, like 2 units higher.
4 should fail if the player is lagging enough or if the objects don't stream fast enough. 6 and 8 should compensate the lag perfectly. 10 should wait 5 seconds and drop the player.
__________________________________________________ __________________________________________________

Credits:

Thanks to Slice and Incognito for the ideas implemented here (combined their ideas).
No thanks to me! I take no credit for this, except sparking Incognito's idea.
__________________________________________________ __________________________________________________

Download!
Reply


Messages In This Thread
Streamer Position Compensation - by Crayder - 24.02.2016, 17:28
Re: Streamer Position Compensation - by SecretBoss - 24.02.2016, 17:38
Re: Streamer Position Compensation - by AliDollar - 24.02.2016, 17:51
Re: Streamer Position Compensation - by Max_Andolini - 24.02.2016, 18:06
Re: Streamer Position Compensation - by DRIFT_HUNTER - 24.02.2016, 18:16
Re: Streamer Position Compensation - by Crayder - 24.02.2016, 19:45
Re: Streamer Position Compensation - by TheMallard - 28.02.2016, 11:19
Re: Streamer Position Compensation - by Crayder - 28.02.2016, 16:06
Re: Streamer Position Compensation - by Stanford - 29.02.2016, 15:55
Re: Streamer Position Compensation - by HydraHumza - 01.03.2016, 06:53

Forum Jump:


Users browsing this thread: 1 Guest(s)