SendPassengerSyncData

From NPC for VCMP 0.4 Servers
Revision as of 01:00, 22 December 2022 by Habi (talk | contribs) (Created page with "{{Welcome| desc= Sends a passenger sync packet to server. The NPC's position is updated in server corresponding to position of vehicle in which the bot is passenger.| params=<...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Description:
Sends a passenger sync packet to server. The NPC's position is updated in server corresponding to position of vehicle in which the bot is passenger.


Parameters:

NoParams


Return Values:
This function does not return any specific values.

Important Note:
This was added in v1.5 patch 1 and will not work in previous versions.

Example

pst <- null; //short for passenger sync timer
function OnNPCEnterVehicle(vehicleid, seatid) 
{ 
    if(seatid)
	{
		if( pst )
			KillTimer( pst );
		pst = SetTimerEx("RemainSeated",1000,0);
	}
}
function OnNPCConnect(myplayerid) 
{ 
    npcid <- myplayerid;
}
function RemainSeated()
{
	if( GetPlayerVehicleID(npcid) )
		SendPassengerSyncData();
	else KillTimer(pst);
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.