Raised This Month: $ Target: $400
 0% 

[l4d2]Can anyone make this plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 16:12   [l4d2]Can anyone make this plugin?
Reply With Quote #1

Well i am trying right now to make a plugin where when you die a timer shows up and when that timer is up you can spawn back. Please help.

Well haven't worked on it for a while but here is some of the code:
Code:
#include <sourcemod>
new Handle:PlayerDeathTimer = INVALID_HANDLE;
new Handle:Enabled = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "OnPlayer_Death",
author = "gamemann",
description = "When a player dies they get a timer and when the timer is finished they spawn back again.",
version = "1.1".
url = "http://sourcemod.net/",
};
public OnPluginStart()
{
HookEvent("player_death", PlayerDeath);
Enabled = CreateConVar("sm_enabled", "1", "toggles if the plugin is enabled or not");
AutoExecConfig(true, "l4d2_On_player_death");
}
public PlayerDeath(Handle:Event, const String:name[],bool:dontBroadcast)
{
if(GetConVarBool(Enabled)) {
CreateTimer(45.0, PlayerDeath);
public Action:PlayerDeath(Handle:timer)
{
HookEvent("defibrillator_used", PlayerUp);
public PlayerUp(Handle:Event, const String:name[],bool:dontBroadcast)
{
if(GetConVarBool(Enabled)) {
decl String:PlayerUp[128];
GetConVarString(PlayerUp, PlayerUp, 128);
}
return Plugin_Handled;
}
remember this was a while ago but am starting to work on it now.
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 16:51   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #2

Well just was working on it and redid everything and here is the code:
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_functions>
#define FCVAR_FLAGS 1
 
new Handle:PlayerDeathTimer = INVALID_HANDLE;
new Handle:PlayerDeathTimerTimer = INVALID_HANDLE;
new Handle:Enabled = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "OnPlayer_Death",
author = "gamemann",
description = "When a player dies they get a timer and when the timer is finished they spawn back again.",
version = "1.1".
url = "http://sourcemod.net/",
};
public OnPluginStart()
{
CreateConVar("sm_plugin_version", "1", "the plugins version", FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_death", PlayerDeath);
Enabled = CreateConVar("sm_enabled", "1", "toggles wheather the plugin is enabled or not");
PlayerDeathTimer = CreateConVar("sm_player_spawn_time", "45", "how many seconds it takes until the player spawns", FCVAR_FLAGS,true,1.0);
SetConVarBounds(PlayerDeathTimer, ConVarBound_Upper, 1.0);
//////////
//Hooking ConVarChanges
//////////
HookConvarChange(PlayerDeathTimer, PDT);
////
//load our config
////
AutoExecConfig(true, "l4d2_player_death_timer_spawner");
}
public PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
PlayerDeathTimerTimer = CreateTimer(PlayerDeathTimer, PlayerDeathT, TIMER_REPEAT);
}
public Action:PlayerDeathT(Handle:htimer, any:Client)
{
SpawnFakeClient()
}
SpawnFakeClient()
{
new bot = CreateFakeClient("bot1");
if (bot == 0);
return;

ChangeClientTeam(bot, 2);
DispatchKeyValue(Bot, "classname", "survivorbot");
DispatchSpawn(bot);
CreateTimer(0.1, BotKicker, Bot);
}
public Action:BotKicker(Handle:hTimer, any:Client)
{
if(IsClientConnected(Client) && IsFakeClient(Client))
{
KickClient(Client, "Kicking Fake Client.");
}
return Plugin_Handled;
}
 
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 17:25   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #3

ok here is a update with the errors in them:
plugin scripting code:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools>
#define FCVAR_FLAGS
#define PLUGIN_VERSION "1.0.0"
&#12288;
new Handle:PlayerDeathTimer INVALID_HANDLE;
new 
Handle:PlayerDeathTimerTimer INVALID_HANDLE;
new 
Handle:Enabled INVALID_HANDLE;
public 
Plugin:myinfo =
{
name "OnPlayerDeath",
author "gamemann",
description "When a player dies they get a timer and when the timer is finished they spawn back again.",
version PLUGIN_VERSION,
url "http://sourcemod.net/",
};
public 
OnPluginStart()
{
CreateConVar("sm_plugin_version"PLUGIN_VERSION"the plugins version",FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_death",PlayerDeath);
Enabled CreateConVar("sm_enabled""1""toggles wheather the plugin is enabled or not");
PlayerDeathTimer CreateConVar("sm_player_spawn_time""45""how many seconds it takes until the player spawns"FCVAR_FLAGS,true,1.0);
SetConVarBounds(PlayerDeathTimerConVarBound_Lowertrue,1.0);
////
//load our config
////
AutoExecConfig(true"l4d2_player_death_timer_spawner");
}
public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
PlayerDeathTimerTimer CreateTimer(PlayerDeathTimerPlayerDeathT);
}
public 
Action:PlayerDeathT(Handle:timerany:Client)
{
SpawnFakeClient()
}
SpawnFakeClient()
{
new 
bot CreateFakeClient("bot1");
if (
bot == 0) return;
 
ChangeClientTeam(bot,2);
DispatchKeyValue(bot,"classname","survivorbot");
DispatchSpawn(bot);
CreateTimer(0.1,BotKicker,bot);
}
public 
Action:BotKicker(Handle:Timerany:Client)
{
if(
IsClientConnected(Client) && IsFakeClient(Client))
{
KickClient(Client"Kicking Fake Client.");
}
return 
Plugin_Handled;
}
&
#12288;
 
[/code]
 
Here is the errors code:
[
code]
error 029invalid expressionassumed zero
error 001
Expected tocken";" but found ">"
error 029invalid expressionassumed zero
fatol error 127
to many error messages on one line
warning 215
:express has no effect
warning 215
expression has no effect 
anyway i can get rid of all of that and what does the numbers stand for such has error 025 the number and how do i find them.

[edit]
And get it up and running corectly???
Attached Files
File Type: sp Get Plugin or Get Source (OnPlayer_Death.sp - 115 views - 1.8 KB)

Last edited by gamemann; 01-16-2010 at 17:47.
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 18:44   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #4

new update: just got it to compile but with 6 warnings which usually means it may compile but still wont work didn't test it yet but i will here is the code:
PHP Code:
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools>
#define PLUGIN_VERSION "1.0.0"
&#12288;
new Handle:PlayerDeathTimer INVALID_HANDLE;
new 
Handle:PlayerDeathTimerTimer INVALID_HANDLE;
public 
Plugin:myinfo =
{
name "OnPlayerDeath",
author "gamemann",
description "When a player dies they get a timer and when the timer is finished they spawn back again.",
version PLUGIN_VERSION,
url "http://sourcemod.net/",
};
public 
OnPluginStart()
{
PlayerDeathTimer CreateConVar("sm_player_spawn_time""45""how many seconds it takes until the player spawns"FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_SPONLYtrue1.00true900.00);
SetConVarBounds(PlayerDeathTimerConVarBound_Lowertrue,1.00);
CreateConVar("sm_plugin_version"PLUGIN_VERSION"the plugins version"FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("player_death"PlayerDeath);
HookEvent("round_end"RoundEnd);
////////
//hooking convarchanges
////////
////
//load our config
////
AutoExecConfig(true"l4d2playerdeathtimerspawner");
}
public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
PlayerDeathTimerTimer CreateTimer(PlayerDeathTimerPlayerDeathT);
}
public 
Action:PlayerDeathT(Handle:timerany:Client)
{
SpawnFakeClient()
}
SpawnFakeClient()
{
// Spawn bot survivor.
new Bot CreateFakeClient("SurvivorBot");
if (
Bot == 0) return;
ChangeClientTeam(Bot2);
DispatchKeyValue(Bot"classname""SurvivorBot");
CreateTimer(0.1,BotKickerBot);
}
public 
Action:BotKicker(Handle:Timerany:Client)
{
if(
IsClientConnected(Client) && IsFakeClient(Client))
{
KickClient(Client"Kicking Fake Client.");
}
return 
Plugin_Handled;
}
public 
RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
return 
Plugin_Handled;
}
public 
OnRoundLost(Handle:event)
{
new 
statement GetEventInt(event"PlayerDeath")
if (
statement == 1
RoundEnd == false;
return 
Plugin_Stop;
}
&
#12288; 
So what i am also trying to do is when you die the round does that end at all you just spawn in 45 seconds thats all. but the server is going to be very hard tho. Also i still need to put it so when you die a HintText comes up tells you the countdown. So you can test it kno too! IF you want to kno the warnings please compile the scripting...
[edit] everyone rememeber that i am new to sourcemod.
</SPAN>
Attached Files
File Type: sp Get Plugin or Get Source (OnPlayer_Death.sp - 393 views - 2.0 KB)
File Type: smx OnPlayer_Death.smx (3.1 KB, 114 views)

Last edited by gamemann; 01-16-2010 at 18:46.
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 19:07   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #5

Ok it works sorta well still trying to fix alot of bugs... Here are the bugs if anyone can tell me how to fix them:
- the bots disapear at spawn (only about 1\10 of them spawn but the others disapear(think it may be because the timer isn't kicking them intime(may reduce the kick client times))
- i am not sure if they do spawn correctly will the client be alble to take controll of them.
- the round does not end when i die(trying to fix)

so thats all the bugs which i will fix.
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-16-2010 , 21:51   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #6

Can someone please help me fix those bugs and for some reason it makes the server sometimes crashes and lags please tell me what to fix.
gamemann is offline
Send a message via Skype™ to gamemann
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 01-17-2010 , 18:38   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #7

Why dont you add spaces and indentation first so other people might READ the code.
AtomicStryker is offline
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-17-2010 , 18:51   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #8

PHP Code:
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools>
#define PLUGIN_VERSION "1.0.0"
&#12288;
new Handle:PlayerDeathTimer INVALID_HANDLE;
new 
Handle:PlayerDeathTimerTimer INVALID_HANDLE;
new 
Handle:BotKickerTimer INVALID_HANDLE;
 
public 
Plugin:myinfo =
{
      
name "OnPlayerDeath",
      
author "gamemann",
      
description "When a player dies they get a timer and when the timer is finished they spawn back again.",
      
version PLUGIN_VERSION,
      
url "http://sourcemod.net/",
};
public 
OnPluginStart()
{
      
BotKickerTimer CreateConVar("sm_bot_kicker_time""10.0""the time it takes until a bot gets kick out of idle"FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_SPONLYtrue5.00true100.00); 
 
      
PlayerDeathTimer CreateConVar("sm_player_spawn_time""45""how many seconds it takes until the player spawns"FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_SPONLYtrue10.00true900.00);
      
SetConVarBounds(PlayerDeathTimerConVarBound_Lowertrue,10.00);
 
      
CreateConVar("sm_plugin_version"PLUGIN_VERSION"the plugins version"FCVAR_PLUGIN|FCVAR_REPLICATED|FCVAR_NOTIFY);
 
      
HookEvent("player_death"PlayerDeath);
 
      
HookEvent("round_end"RoundEnd);
////////
//hooking convarchanges
////////
////
//load our config
////
      
AutoExecConfig(true"l4d2playerdeathtimerspawner");
}
 
public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        
PlayerDeathTimerTimer CreateTimer(PlayerDeathTimerPlayerDeathT);
 
      
decl String:UserID[180]
 
      new 
victimId GetEventInt(event"userid");
 
      
GetEventString(event"UserID"UserIDsizeof(UserID))
 
      
decl String:NameId[180]
 
      new 
victim GetClientOfUserId(victimId)
 
      
GetClientName(victimNameIdsizeof(NameId))
 
 
PrintHintText(victim"you will spawn in (PlayerDeathTimer \"%s\") seconds",victim,NameId,UserID,PlayerDeathTimer);
 
return 
Plugin_Handled;
}
 
 
public 
Action:PlayerDeathT(Handle:timerany:Client)
{
SpawnFakeClient()
}
 
 
SpawnFakeClient()
{
// Spawn bot survivor.
new Bot CreateClient();
 
if (
Bot == 0) return;
 
ChangeClientTeam(Bot2);
 
DispatchKeyValue(Bot"classname""SurvivorBot");
 
CreateTimer(BotKickerTimer,BotKickerBot);
}
 
public 
Action:BotKicker(Handle:Timerany:Client)
{
        if(
IsClientConnected(Client) && IsFakeClient(Client))
        {
         
KickClient(Client"Kicking Fake Client.");
         }
         return 
Plugin_Handled;
}
 
public 
RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
return 
Plugin_Stop;


Last edited by gamemann; 01-17-2010 at 19:16.
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-17-2010 , 19:26   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #9

The only problem is:
- well i am trying to find a command that spawns the client back that doesn't make a new one such and CreateFakeClient command makes a new one, then it lags really bad and crashs the server due to all the bots getting put in the game


- this could also be causing the lag but when a bot dies and the timer spawns a bot the bot just teleports some how...
gamemann is offline
Send a message via Skype™ to gamemann
gamemann
Veteran Member
Join Date: Sep 2009
Location: Mullica Hill, New Jersey
Old 01-22-2010 , 20:34   Re: [l4d2]Can anyone make this plugin?
Reply With Quote #10

Can someone please help?
gamemann is offline
Send a message via Skype™ to gamemann
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode