the plugin by @101 worked, the player respawns after 5 seconds. it doesn't have the options to randomize respawn items :c
easy .. but I felt that this mod doesn't make sense without managing players actions [awards/penalties]
this is a simple structure of a new l4d-mode with a bad experience 'Unluckily' :
Spoiler
PHP Code:
#include <sdktools>
Handle Plugin_Handle[6];
float LastValidPos[3],slot_range[5];
int i_TimeCounter;
public APLRes AskPluginLoad2(Handle yourself, bool late, char[] error, int err_max) {
CreateNative("GetRemainingTime", GetRemainingTime);
CreateNative("ExtendRoundTime", ExtendRoundTime);
return APLRes_Success;
}
public int GetRemainingTime(Handle plugin, int parameter) { // usage from other plugins example : int x = GetRemainingTime();
return GetConVarBool(Plugin_Handle[1]) ? i_TimeCounter : -1; // if returned value was -1 : Plugin is disabled
}
public int ExtendRoundTime(Handle plugin, int parameter) { // usage from other plugins : ExtendRoundTime(30 , "Killing a tank"); or ExtendRoundTime(-10 , "Death Penalty");
static char Reason[128];
if ( GetConVarBool(Plugin_Handle[1]) ){
GetNativeString(2, Reason, 128);
ExtendCurrentRound( GetNativeCell(1) , Reason);
return i_TimeCounter;
}
return -1;
}
ExtendCurrentRound( int value , char[] reason){
if (!value) return;
i_TimeCounter += value;
PrintToChatAll("Round time was %s by %d seconds [%s] .\nRemaining Time : %d seconds ." , value < 0 ? "Shortened" : "Extended" , value , reason , i_TimeCounter);
}
public event_player_death(Handle event, char[] event_name, bool dontBroadcast){
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client && GetClientTeam(client) == 2){
if ( GetEntityFlags(client) & FL_ONGROUND || !(GetEventInt(event, "type") & 1048608) ){
// 1048608 : DMG_FALL|DMG_CHOKE (no much exp in l4d so you can add more filters)
GetClientAbsOrigin(client, LastValidPos);
}
CreateTimer( GetConVarFloat(Plugin_Handle[2]) ,Timer_Respawn ,client);
}
}
public Action Timer_GetValidPoint(Handle timer, any client){
if (!LastValidPos[0] && client && IsClientInGame(client))
GetClientAbsOrigin(client, LastValidPos);
return Plugin_Handled;
}
public Action Timer_Respawn(Handle timer, any client){
if (client && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsPlayerAlive(client)){ // for an Unknown reason events sometimes pass client with 0 index (Invalid User Id)!
int ent = CreateEntityByName("info_survivor_rescue");
if (ent != -1){
DispatchKeyValueVector(ent, "origin", LastValidPos);
DispatchSpawn(ent);
SetEntPropEnt(ent, Prop_Send, "m_survivor",client);
AcceptEntityInput(ent, "Rescue");
}
SetEntityHealth(client, GetConVarInt(Plugin_Handle[4]));
int slot = -1 , Items = GetConVarInt(Plugin_Handle[5]);
int Flags = GetCommandFlags("give");
SetCommandFlags("give", Flags & ~FCVAR_CHEAT);
while (++slot < Items){
FakeClientCommand(client,"give %s" , X_Weapons[ GetRandomInt( RoundToFloor(slot_range[slot]) , RoundToNearest(FloatFraction(slot_range[slot]) * 100.0) ) ] );
}
SetCommandFlags("give",Flags);
}
return Plugin_Handled;
}
* Notes :
- its a beta version and it will be the final version .
- I've replaced first-spawn method of sdkcall by rescue-spawn method , so the survivors stats of the current round won't be destroyed. FFS .
- I couldn't find a better way to end round in l4d1 [I missed scenario_end effects] .
- I couldn't find a function that display the remaining time on the top corner of screen . [I know that there is a complex one for l4d2 , but I prefer a standard one that supports both games] .
- Plugin has two natives , so you can manage Round time limit from another plugin [extend/shortened] the round time based on game events and players actions , example :