[Include] [INC]YCP - Yaheli's Checkpoint Streamer - OnPlayerUpdate CP Streamer!
#1

  • Yaheli's Checkpoint Streamer
    v1.1
    __________________________________________________ __________________________________________________ _________________________________________________

    - Description
    • This .inc file adds functions which allow you to stream checkpoints. The include uses OnPlayerUpdate to stream the checkpoints and update player location.
    - Included Functions

    pawn Code:
    SetStreamCheckpoint(Float:x, Float:y, Float:z, Float:size, Float:View_Distance);

    DisableStreamCheckpoint(checkpointid);

    SetPlayerStreamCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size, Float:View_Distance);

    DisablePlayerStreamCheckpoint(playerid, checkpointid);

    SetStreamCheckpointPos(checkpointid, Float:x, Float:y, Float:z);

    SetStreamCheckpointSize(checkpointid, Float:radius);

    SetStreamCheckpointViewDistance(checkpointid, Float:View_Distance);

    StreamCheckpointsForPlayer(playerid);

    GetDistanceToCheckpoint(Float:X, Float:Y, Float:Z, checkpointid);

    IsPlayerInStreamCheckpoint(playerid, checkpointid);
    pawn Code:
    YCP_OnGameModeInit(); - Must be placed in OnGameModeInit for the streamer to work.

    YCP_OnPlayerConnect(playerid); - Must be placed in OnPlayerConnect for the streamer to work.

    YCP_OnPlayerUpdate(playerid); - Must be placed in OnPlayerUpdate for the streamer to work. // NOTE: It can be placed under a timer to but it must be somewhere for the streamer to work.

    YCP_OnPlayerEnterCheckpoint(playerid); - Must be placed in OnPlayerEnterCheckpoint for the streamer to work.
    - Callbacks
    • OnPlayerEnterStreamCheckpoint(playerid, checkpointid);
      • In order to compile with no errors you must add this public into the GM or FS.
        You will use this as a "new" OnPlayerEnterCheckpoint and it even includes a 'checkpointid' parameter.
    • OnPlayerExitStreamCheckpoint(playerid, checkpointid);
      • To add this callback to your GM just add this code:
Code:
forward OnPlayerExitStreamCheckpoint(playerid, checkpointid);
public OnPlayerExitStreamCheckpoint(playerid, checkpointid)
{
  return 1;
}
- Download

http://www.zezombia.com/upload/Yaheli/YCP.inc

Reply
#2

Why not just use a timer? I heared that OnPlayerUpdate gets called about 15 times per second, per player. Imagine a server with 200 players using it.
Reply
#3

Nice job men.
Reply
#4

Quote:
Originally Posted by Stevelo
Why not just use a timer? I heared that OnPlayerUpdate gets called about 15 times per second, per player. Imagine a server with 200 players using it.
Why make another timer that would have to loop through 200 players even when only 1 is connected?
Reply
#5

The idea is pretty nice! Lets make every streamer work with OnPlayerUpdate.
Reply
#6

Nice job Yaheli .
Reply
#7

Good job mate!
Reply
#8

Quote:
Originally Posted by Yaheli
Why make another timer that would have to loop through 200 players even when only 1 is connected?
It would be much more efficient in terms of what this modification was created for. People seem to think that a 200 player loop causes a load of lag. This is a multi player modification, so scripting something that is only designed for one player isn't very relevant.

Calling a timer every second or so with a 200 byte loop would take about 0.001 seconds to allocate in pawn depending on what it does per loop. It would be much better than calling it from a function that, if say was being used on a server full of 200 people, would be getting called more than 3000 times a second.
Reply
#9

Quote:
Originally Posted by Stevelo
Quote:
Originally Posted by Yaheli
Why make another timer that would have to loop through 200 players even when only 1 is connected?
It would be much more efficient in terms of what this modification was created for. People seem to think that a 200 player loop causes a load of lag. This is a multi player modification, so scripting something that is only designed for one player isn't very relevant.

Calling a timer every second or so with a 200 byte loop would take about 0.0001 seconds to allocate in pawn depending on what it does per loop. It would be much better than calling it from a function that, if say was being used on a server full of 200 people, would be getting called more than 3000 times a second.
You haven't actually looked at the scripthave you? It won't be near 3000 a second unless you set UPDATE_AMMOUNT to 1.
Reply
#10

Nice. Maybe useful in the RPG Script?

Leopard
Reply
#11

Quote:
Originally Posted by Yaheli
You haven't actually looked at the scripthave you? It won't be near 3000 a second unless you set UPDATE_AMMOUNT to 1.
I have looked at it. The callback still get's called 3000 times a second, whether there are some var size checks before it calls the function or not, it would still be more efficient to just use a timer.
Reply
#12

Quote:
Originally Posted by [K4L
Leopard ]
Nice. Maybe useful in the RPG Script?

Leopard
Could be

Quote:
Originally Posted by Stevelo
Quote:
Originally Posted by Yaheli
You haven't actually looked at the scripthave you? It won't be near 3000 a second unless you set UPDATE_AMMOUNT to 1.
I recall Kye saying once in IRC that it would be more efficient to use OnPlayerUpdate for streamers if it was called every 20-30 OnPlayerUpdates.

I have looked at it. The callback still get's called 3000 times a second, whether there are some var size checks before it calls the function or not, it would still be more efficient to just use a timer.
Reply
#13

So what? When Kye said that he probably didn't mean every possible streamer working in the same way. Try reading my posts and understanding.

Maybe with other streamers OnPlayerUpdate would be better, it totally depends on what it's streaming and how it works. With the possibility of it being called over 3000 times a second, personally, I wouldn't use OnPlayerUpdate for anything.
Reply
#14

Quote:
Originally Posted by Stevelo
So what? When Kye said that he probably didn't mean every possible streamer working in the same way. Try reading my posts and understanding.

Maybe with other streamers OnPlayerUpdate would be better, it totally depends on what it's streaming and how it works. With the possibility of it being called over 3000 times a second, personally, I wouldn't use OnPlayerUpdate for anything.
How exactly is YCP_OnPlayerUpdate gonna get called every 3000 seconds?
Reply
#15

Quote:
Originally Posted by Yaheli
How exactly is YCP_OnPlayerUpdate gonna get called every 3000 seconds?
I didn't say YCP_OnPlayerUpdate would get called more than 3000 times a second, but by changing the define to 1, it will.

Nevermind, I feel like I'm wasting my time.
Reply
#16

Quote:
Originally Posted by Stevelo
Why not just use a timer? I heared that OnPlayerUpdate gets called about 15 times per second, per player. Imagine a server with 200 players using it.
OnPlayerUpdate gets used when player sends a pack.
Reply
#17

Update!
Added SetPlayerStreamCheckpoint and DestroyPlayerStreamCheckpoint - creates a streamed checkpoint for only one player.

Link updated.
Reply
#18

nvm, nice script.
Reply
#19

I want on you INC to example. But i dont know.

Example:

Code:
new lspark;
new caligulas;
new fourdragons;
Code:
lspark = SetPlayerCheckpoint(playerid, 1277.8204,-2039.3345,59.0079, 3.0); // Los Santos Parkı
caligulas = SetPlayerCheckpoint(playerid, 2159.1150,1680.2651,10.6953, 3.0); // Caligula's Gazinosu
fourdragons = SetPlayerCheckpoint(playerid, 2040.9434,1007.0724,10.6719, 3.0); // Four Dragon's Gazinosu
Code:
if(checkpoint == lspark)
{
	GivePlayerWeapon(playerid,31,500);
}
if(checkpoint == caligulas)
{
	GivePlayerWeapon(playerid,37,500);
}
if(checkpoint == fourdragons)
{
	GivePlayerWeapon(playerid,35,500);
}
Help...

My English is Bad...
Reply
#20

switch checkpoint with checkpointid?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)