Raised This Month: $51 Target: $400
 12% 

Limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mau5
Member
Join Date: Feb 2012
Old 03-15-2012 , 14:22   Limit
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <cstrike>

public Plugin:myinfo 
{
    
name "Deathrun respawn",
    
author "necavi",
    
description "Deathrun respawn",
    
version "0.1",
    
url "http://necavi.com/"
}

public 
OnPluginStart()
{
    
HookEvent("player_death",Event_PlayerDeath);
}
public 
Event_PlayerDeath(Handle:event,const String:name[],bool:dontBroadcast)
{
    if(
GetGameTime()<=20.0)
    {
        
printtochat(Second Chance!)
        new 
client GetClientOfUserId(GetEventInt(event,"userid"));
        
CS_RespawnPlayer(client);
    }
    if (
GetClientTeam(Terrorist))
    {
       do 
nothing
    
}   

How do you limit it to one respawn per round?

Last edited by mau5; 03-15-2012 at 14:23.
mau5 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-15-2012 , 15:03   Re: Limit
Reply With Quote #2

Do it really need make new topic ??
[CSS] Respawn after 20secs
Bacardi is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 03-15-2012 , 17:24   Re: Limit
Reply With Quote #3

>printtochat(Second Chance!)

what.
Is this pseudocode or something, or actual attempt at plugin writing?
__________________

Last edited by Lord Canistra; 03-15-2012 at 17:25.
Lord Canistra is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 03-15-2012 , 18:37   Re: Limit
Reply With Quote #4

Don't be mean guys!
Here you go:
PHP Code:
#include <sourcemod>
#include <cstrike>

new tries[MAXPLAYERS+1];

public 
Plugin:myinfo =
{
    
name "Deathrun respawn",
    
author "necavi",
    
description "Deathrun respawn",
    
version "0.1",
    
url "http://necavi.com/"
}

public 
OnPluginStart()
{

    
HookEvent("player_death",Event_PlayerDeath);
}
public 
Event_PlayerDeath(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
GetClientTeam(client) == 2)
    {
        return;
    }
    else if(
GetClientTeam(client) == && GetGameTime() <= 20.0 && tries[client] << 0)
    {
        
CreateTimer(5.0Timer_Respawnclient);
        
PrintToChat(client"Respawning in 5 seconds.");
    }
    else
    {
        return;
    }
}

public 
Action:Timer_Respawn(Handle:timerany:client)
{
    
PrintToChat(client"Second Chance!");
    
CS_RespawnPlayer(client);
    
tries[client]++;

Let me know if you need any more additions to it and I'll be willing to do it for you, or if you actually want to learn how to do this (And how I did this).
I haven't tested this but it should work.
The plugin has also been attached.
Rename the plugin if necessary.
P.S. I haven't changed the author section because I was lazy, if you actually need me doing this, then just tell me and I'll do it (Wow, it takes more time to actually type this than go ahead and change the author field)
Attached Files
File Type: sp Get Plugin or Get Source (deathrun.sp - 114 views - 907 Bytes)
minimoney1 is offline
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 23:24.


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