Raised This Month: $ Target: $400
 0% 

Respawn limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 07-18-2014 , 13:28   Re: Respawn limit
Reply With Quote #1

Here, take this :
PHP Code:
#include <sourcemod>
#include <cstrike>

#define MAX_RESPAWN_CT 3
#define MAX_RESPAWN_T 6
#define TEAM_CT 3
#define TEAM_T 2

new DeathCount[MAXPLAYERS+1];

public 
Plugin:myinfo =  
{  
    
name "More Respawn",  
    
author "Arkarr",  
    
description "Respawn players depend their team.",  
    
version "1.0",  
    
url "http://www.sourcemod.net/"  
}; 

public 
OnPluginStart()  

    
HookEvent("player_death"Event_PlayerDeath);
}

public 
OnClientConnected(client)
{
    
DeathCount[client] = 0;
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    new 
team GetClientTeam(victim);
    if((
team == TEAM_CT && DeathCount[victim] < MAX_RESPAWN_CT) || (team == TEAM_T && DeathCount[victim] < MAX_RESPAWN_T))
    {
        
CreateTimer(5.0TMR_RespawnPlayervictim);
        
PrintHintText(victim"Respawning in 5 seconds ! Be ready !");
    }
}

new 
Handle:TMR_RespawnPlayer(Handle:tmrany:client)
{
    
CS_RespawnPlayer(client);
    
DeathCount[client]++;

Not tested but should work !
__________________
Want to check my plugins ?

Last edited by Arkarr; 07-18-2014 at 13:30.
Arkarr 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 11:59.


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