Quote:
Similarly in escape vehicles
|
I've just now come across a plugin that already does this! l4d_rescue_vehicle_leave_timer by Harry Potter
I forgot the link:
https://github.com/fbef0102/L4D1_2-P...le_leave_timer
Here is how they determined if a player is in a rescue vehicle:
PHP Code:
int entity = -1;
while ((entity = FindEntityByClassname(entity, "trigger_multiple")) != -1)
{
int iHammerID = Entity_GetHammerId(entity);
for(int i=0;i<MAX_DATAS;++i)
{
if( iHammerID == g_iData[i] )
{
HookSingleEntityOutput(entity, "OnStartTouch", OnStartTouch);
HookSingleEntityOutput(entity, "OnEndTouch", OnEndTouch);
g_bFinalHasEscapeVehicle = true;
break;
}
}
}
OnStartTouch and OnEndTouch are simply functions where they set a per client boolean on whether the client is in the rescue vehicle. I'm more curious about the HammerID == g_iData[i] part though...
PHP Code:
bool LoadData()
{
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, sizeof(sPath), CONFIG_SPAWNS);
if( !FileExists(sPath) )
return false;
// Load config
KeyValues hFile = new KeyValues("rescue_vehicle");
if( !hFile.ImportFromFile(sPath) )
{
delete hFile;
return false;
}
// Check for current map in the config
char sMap[64];
GetCurrentMap(sMap, sizeof(sMap));
if( !hFile.JumpToKey(sMap) )
{
delete hFile;
return false;
}
// Retrieve how many rescue entities
int iCount = hFile.GetNum("num", 0);
if( iCount == 0 )
{
delete hFile;
return false;
}
// check limit
if( iCount > MAX_DATAS )
iCount = MAX_DATAS;
//get hammerid of each rescue entity
char sTemp[4];
for( int i = 1; i <= iCount; i++ )
{
IntToString(i, sTemp, sizeof(sTemp));
if( hFile.JumpToKey(sTemp) )
{
g_iData[i-1] = hFile.GetNum("hammerid", 0);
g_iCvarTime = hFile.GetNum("time", 60);
hFile.GoBack();
}
}
delete hFile;
return true;
}
From what I can tell, they read a list of hammer IDs for each of the rescue vehicles' trigger_multiples off a provided data file, and then they check if the trigger_multiple's IDs of the current map match up. Perhaps a similar method could be adapted for telling whether or not a player is in grouping up points in elevators or otherwise?
Quote:
Aren't the L4D_IsInFirstCheckpoint and L4D_IsInLastCheckpoint natives from Left 4 DHooks Direct enough to tell if a survivor is in either one of the saferooms?
|
That is true and I do plan on having molotov blocking just be based off of those.