YCP - Yaheli's Checkpoint Streamer - OnPlayerUpdate CP Streamer!

Y

Yaheli

Guest
  • Yaheli's Checkpoint Streamer

    - 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
    • SetStreamCheckpoint(Float:x, Float:y, Float:z, Float:size, Float:View_Distance);
    • DisableStreamCheckpoint(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);
    • 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
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

I hate streamers :wow:.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Well then how do you plan on having more then 1 checkpoint? Or what would you do without an object streamer for SA-FE? :tongue:
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Nice streamer Yaheli :)
But I still prefer YSI´s Checkpoint streamer.

Some suggestion:
Code:
public YCP_OnGameModeInit()
{
	CPCount = 0;
	for(new i; i < MAX_CP; i++)
	{
	    Checkpoints[i][cX] = 0;
	    Checkpoints[i][cY] = 0;
	    Checkpoints[i][cZ] = 0;
	    Checkpoints[i][Radius] = 0;
	    Checkpoints[i][ViewDistance] = 0;
	}
}
This is useless, because all uninitializies variables are already set to 0 in pawno.

2. Dont use OnPlayerUpdate for this, it will be called more than 100 times in a second. Your "Update amount" wount help for this, so a timer is better for this task.


I will test it soon with speed tests and other tests. NICE STREAMER

btw YPC_OnGameModeInit() a typo.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Remis said:
Nice streamer Yaheli :)
But I still prefer YSI´s Checkpoint streamer.

Some suggestion:
Code:
public YCP_OnGameModeInit()
{
	CPCount = 0;
	for(new i; i < MAX_CP; i++)
	{
	    Checkpoints[i][cX] = 0;
	    Checkpoints[i][cY] = 0;
	    Checkpoints[i][cZ] = 0;
	    Checkpoints[i][Radius] = 0;
	    Checkpoints[i][ViewDistance] = 0;
	}
}
This is useless, because all uninitializies variables are already set to 0 in pawno.

2. Dont use OnPlayerUpdate for this, it will be called more than 100 times in a second. Your "Update amount" wount help for this, so a timer is better for this task.


I will test it soon with speed tests and other tests. NICE STREAMER

btw YPC_OnGameModeInit() a typo.

1. Actually it isn't useless since you need it for when you GMX, same reason why object streamer have this.

2. Actually no, kye even said that it is better to use on player update an UPDDATE_AMOUNT will help, OnPlayerUpdate is called 5-20 times per second.
Adding another timer that would have to loop through all checkpoints AND players would just be a waste of resources when there is already a timer called for each player separately.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Ok..
I tested it now, SetStreamCheckpointViewDistance(checkpointid, Float:View_Distance) doesnt work because it doesnt even exist as function. You are using the define SetStreamObjectViewDistance instead, but it doesn´t work. That is the only bug I have found.

But all in one it is working pretty good and fast :)
I cant wait seeing it in SA_FE!
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Yaheli said:
OnPlayerUpdate is called 5-20 times per second.

Per player. It might work with one or two people connected, but with 200, your looking at 1000 - 4000 calls a second.

EDIT:
Nvm, I just looked at the code, OnPlayerUpdate is simple enough to set slide.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA1 - OnPlayerUpdate CP Streamer!

Bugs fixed, re-download :)

CPU usage has also been lowered by setting variables instead of repeating a function. GetDistanceToCheckpoint has replaced GetCheckpointDistance and IsPlayerInStreamCheckpoint has been added.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

If you create a checkpoint (id 1 for example), disable it, and create a new one, it has id 2 instead the free of the disabled checkpoints. So if you disable all checkpoints, you cant recreate them or create new ones. Is it a bug?
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

Remis said:
If you create a checkpoint (id 1 for example), disable it, and create a new one, it has id 2 instead the free of the disabled checkpoints. So if you disable all checkpoints, you cant recreate them or create new ones. Is it a bug?

Yes, thanks for pointing that out :)

Nevermind, to actually spawn the checkpoint itself I use SetPlayerCheckpoint which doesn't assign ID's or raise the ammout.

Also, I am going to edit it now to show the closest CP since it isn't actually coded to do that ATM.

EDIT: Uploaded :wink:

EDIT2: Found a mistake in the equation for figuring out CP distance from a certain point that caused all measurements to be in something similar to ingame inches.
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

um... any suggestions?
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

Yaheli said:
um... any suggestions?

Yeah, make epic updates on SA-FE :T
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

Thanks Yaheli ! :T

:love: :celebrate: :hug:
 
Re: YCP - Yaheli's Checkpoint Streamer BETA2 - OnPlayerUpdate CP Streamer!

lol, you'll get more info later. :wink:

Should I make an OnPlayerExitStreamCheckpoint callback?
 
Back
Top Bottom