Raised This Month: $ Target: $400
 0% 

[CSGO] Plugin Idea.


Post New Thread Reply   
 
Thread Tools Display Modes
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-25-2012 , 07:16   Re: [CSGO] Plugin Idea.
Reply With Quote #11

Work in progress:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#define PLUGIN_VERSION "dev"
#define DEFAULT_RESPAWNWAVE_TIME 10
#define RESPAWNWAVE_TIMER_INTERVAL 1.0
#define RESPAWNWAVE_TIMER_FLAGS TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE

public Plugin:myinfo =
{
    
name "CSS Respawn waves",
    
author "FaTony",
    
description "...",
    
version PLUGIN_VERSION,
    
url "http://fatony.com/"
};

static 
Handle:RespawnWaveTimer INVALID_HANDLE;
static 
Handle:RespawnWaveCvarT INVALID_HANDLE;
static 
Handle:RespawnWaveCvarCT INVALID_HANDLE;
static 
RespawnWaveTimeT DEFAULT_RESPAWNWAVE_TIME;
static 
RespawnWaveTimeCT DEFAULT_RESPAWNWAVE_TIME;
static 
RespawnWaveCurrentTimeT 1;
static 
RespawnWaveCurrentTimeCT 1;
static 
PlayerRespawnTime[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
RespawnWave_Init();
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
OnMapEnd()
{
    
RespawnWave_EndTimer();
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if ((
GetTeamClientCount(CS_TEAM_T) == 0) && (GetTeamClientCount(CS_TEAM_CT) == 0))
    {
        return 
Plugin_Continue;
    }
    
RespawnWave_StartTimer();
    return 
Plugin_Continue;
}

public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
RespawnWave_EndTimer();
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
RespawnWave_SetupClient(client);
}

RespawnWave_Init()
{
    
RespawnWaveCvarT CreateConVar("ftz_respawnwavetime_t""10""The delay between terrorist respawn waves in seconds."0true0.0);
    
HookConVarChange(RespawnWaveCvarTRespawnWave_TimeChanged);
    
RespawnWaveCvarCT CreateConVar("ftz_respawnwavetime_ct""10""The delay between counter-terrorist respawn waves in seconds."0true0.0);
    
HookConVarChange(RespawnWaveCvarCTRespawnWave_TimeChanged);
}

public 
RespawnWave_TimeChanged(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if (
convar == RespawnWaveCvarT)
    {
        
RespawnWaveTimeT GetConVarInt(convar);
    }
    else if (
convar == RespawnWaveCvarCT)
    {
        
RespawnWaveTimeCT GetConVarInt(convar);
    }
}

RespawnWave_StartTimer()
{
    if (
RespawnWaveTimer != INVALID_HANDLE)
    {
        
LogError("RespawnWave_StartTimer called when timer is still running.");
        
CloseHandle(RespawnWaveTimer);
    }
    
RespawnWaveTimer CreateTimer(RESPAWNWAVE_TIMER_INTERVALRespawnWave_TimerCallback_RESPAWNWAVE_TIMER_FLAGS);
}

RespawnWave_EndTimer()
{
    if (
RespawnWaveTimer == INVALID_HANDLE)
    {
        return;
    }
    
CloseHandle(RespawnWaveTimer);
    
RespawnWaveTimer INVALID_HANDLE;
}

RespawnWave_SetupClient(const client)
{
    switch (
GetClientTeam(client))
    {
        case 
CS_TEAM_T:
        {
            
PlayerRespawnTime[client] = RespawnWaveTimeT RespawnWaveCurrentTimeT;
        }
        case 
CS_TEAM_CT:
        {
            
PlayerRespawnTime[client] = RespawnWaveTimeCT RespawnWaveCurrentTimeCT;
        }
    }
}

public 
Action:RespawnWave_TimerCallback(Handle:timer)
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && (GetClientTeam(i) > CS_TEAM_SPECTATOR) && (!IsPlayerAlive(i)))
        {
            if (
PlayerRespawnTime[i] > 0)
            {
                
PlayerRespawnTime[i]--;
            }
            if (
PlayerRespawnTime[i] > 0)
            {
                
PrintCenterText(i"You will respawn in %d."PlayerRespawnTime[i]);
            }
            else
            {
                
CS_RespawnPlayer(i);
            }
        }
    }
    
RespawnWaveCurrentTimeT--;
    if (
RespawnWaveCurrentTimeT == 0)
    {
        
RespawnWaveCurrentTimeT RespawnWaveTimeT;
    }
    
RespawnWaveCurrentTimeCT--;
    if (
RespawnWaveCurrentTimeCT == 0)
    {
        
RespawnWaveCurrentTimeCT RespawnWaveTimeCT;
    }

PHP Code:
#include <sourcemod>
#include <smlib/clients>

#define PLUGIN_VERSION "dev"

#define MAX_CLIENT_WEAPONS 5

public Plugin:myinfo =
{
    
name "CSS Weapon saving",
    
author "FaTony",
    
description "...",
    
version PLUGIN_VERSION,
    
url "http://fatony.com/"
};

new 
bool:ShouldRestoreWeapons[MAXPLAYERS 1];
new 
String:ClientWeapons[MAXPLAYERS 1][MAX_CLIENT_WEAPONS][MAX_WEAPON_STRING];

public 
OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
    
HookEvent("player_hurt"Event_PlayerHurt);
    
AddCommandListener(Command_Suicide"kill");
    
AddCommandListener(Command_Suicide"explode");
}

public 
OnClientDisconnect(client)
{
    
ClearClientWeapons(client)
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
RestoreClientWeapons(client);
}

public 
Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    new 
victimhealth GetClientHealth(victim);
    if (
victimhealth <= 0)
    {
        
SaveClientWeapons(victim);
    }
}

public 
Action:Command_Suicide(client, const String:command[], argc)
{
    if ((
client <= 0) || (client MaxClients))
    {
        return 
Plugin_Continue;
    }
    if (
IsPlayerAlive(client))
    {
        
SaveClientWeapons(client);
    }
    return 
Plugin_Continue;
}

SaveClientWeapons(const client)
{
    
ShouldRestoreWeapons[client] = true;
    new 
weapon;
    
decl String:weaponclassname[MAX_WEAPON_STRING];
    new 
0;
    for (new 
0offset Client_GetWeaponsOffset(client); MAX_WEAPONSi++, offset += 4)
    {
        
weapon GetEntDataEnt2(clientoffset);
        if (!
Weapon_IsValid(weapon))
        {
            break;
        }
        
GetEdictClassname(weaponweaponclassnameMAX_WEAPON_STRING);
        if ((!
StrEqual(weaponclassname"weapon_knife")) && (!StrEqual(weaponclassname"weapon_c4")))
        {
            
strcopy(ClientWeapons[client][j], MAX_WEAPON_STRINGweaponclassname);
            
j++;
            if (
== MAX_CLIENT_WEAPONS)
            {
                return;
            }
        }
    }
    
ClientWeapons[client][j][0] = '\0';
}

RestoreClientWeapons(const client)
{
    for (new 
0MAX_CLIENT_WEAPONSi++)
    {
        if (
ClientWeapons[client][i][0] == '\0')
        {
            return;
        }
        
Client_GiveWeapon(clientClientWeapons[client][i], false);
    }
    
ShouldRestoreWeapons[client] = false;
}

ClearClientWeapons(const client)
{
    for (new 
0MAX_CLIENT_WEAPONSi++)
    {
        
ShouldRestoreWeapons[client] = false;
        
ClientWeapons[client][i][0] = '\0';
    }

__________________
FaTony is offline
mercgrinder
Junior Member
Join Date: Sep 2012
Old 10-31-2012 , 12:06   Re: [CSGO] Plugin Idea.
Reply With Quote #12

Superb Fatony, let me know if you need any further suggestions. Thanks mate

Last edited by mercgrinder; 10-31-2012 at 12:12.
mercgrinder is offline
mercgrinder
Junior Member
Join Date: Sep 2012
Old 11-10-2012 , 13:28   Re: [CSGO] Plugin Idea.
Reply With Quote #13

Any update on this. Thanks
mercgrinder is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 11-10-2012 , 14:00   Re: [CSGO] Plugin Idea.
Reply With Quote #14

Quote:
Originally Posted by mercgrinder View Post
Any update on this. Thanks
makes sense he'll update it when ever hes probably not banned
Mitchell is offline
mercgrinder
Junior Member
Join Date: Sep 2012
Old 11-27-2012 , 04:49   Re: [CSGO] Plugin Idea.
Reply With Quote #15

I have just noticed he has been banned, is there anyone that can take over this plugin. If i had the time and knowledge i would give it a go myself but unfortunately i dont.

My CSGO server is now getting very busy and 99% complete, this is the only thing that i need to finish it off.
mercgrinder is offline
mercgrinder
Junior Member
Join Date: Sep 2012
Old 01-07-2013 , 09:47   Re: [CSGO] Plugin Idea.
Reply With Quote #16

I would like to bump this up to try again and get someone to make this mod for me please

thanks
mercgrinder 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 15:53.


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