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

[csgo] knife delay request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klew
New Member
Join Date: Jun 2016
Old 07-23-2016 , 14:51   [csgo] knife delay request
Reply With Quote #1

is there anybody who is able/willing to help me with me making a 5 second knife delay ?
klew is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 07-23-2016 , 15:38   Re: [csgo] knife delay request
Reply With Quote #2

what do you mean with "knife delay"? spawn a knife on round begin with 5 sec delay or deal the damage with 5 sec delay or what?
__________________
coding & free software
shanapu is offline
klew
New Member
Join Date: Jun 2016
Old 07-24-2016 , 09:45   Re: [csgo] knife delay request
Reply With Quote #3

a 5 second delay after knifing someone, so you cant knife them again for 5 seconds. but still able to knife somebody you have not already hurt..
klew is offline
thedudeguy1
Senior Member
Join Date: Oct 2014
Location: 127.0.0.1
Old 08-01-2016 , 22:30   Re: [csgo] knife delay request
Reply With Quote #4

I'm interested in a plugin like this as well. I searched around but I couldn't find any uncompiled scripts or compiled plugins. If somebody could point me in the right direction with a snippet of code I might be able to do the rest.
__________________
A computer is like an Old Testament god, with a lot of rules and no mercy. -Joseph Campbell
thedudeguy1 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 08-05-2016 , 04:45   Re: [csgo] knife delay request
Reply With Quote #5

You might want to try this quicks script :
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <multicolors>

#define PLUGIN_AUTHOR     "Arkarr"
#define PLUGIN_VERSION     "1.00"

bool Marked[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "[ANY] Knife Attack Delay"
    
author PLUGIN_AUTHOR
    
description "Set a delay between each attack on the same player."
    
version PLUGIN_VERSION
    
url "http://www.sourcemod.net"
};

public 
void OnPluginStart()
{
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
            
SDKHook(iSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    
char sWeapon[32];
    
GetEdictClassname(inflictorsWeaponsizeof(sWeapon));
    
    if (
StrContains(sWeapon"knife"))
    {
        if(!
Marked[victim])
        {
            
ImmunePlayer(victim);    
        }            
        else
        {
            
CPrintToChat(attacker"{fullred}This player can't be knifed now !");
            return 
Plugin_Handled;
        }
    }
    
    return 
Plugin_Continue;
}

public 
void ImmunePlayer(int client)
{
    
Marked[client] = true;
    
SetEntityRenderMode(clientRENDER_TRANSCOLOR);
    
SetEntityRenderColor(client100255100200);
    
    
CreateTimer(5.0TMR_Unmarkclient);
}

public 
Action TMR_Unmark(Handle tmrany client)
{
    
Marked[client] = false;
    
SetEntityRenderMode(clientRENDER_TRANSCOLOR);
    
SetEntityRenderColor(client255255255255);

Donate if you enjoy my work (I need DOOM so bad)
__________________
Want to check my plugins ?
Arkarr is offline
thedudeguy1
Senior Member
Join Date: Oct 2014
Location: 127.0.0.1
Old 02-27-2017 , 18:58   Re: [csgo] knife delay request
Reply With Quote #6

Quote:
Originally Posted by Arkarr View Post
You might want to try this quicks script
I tried it and I made a few fixes. First of all, the damage hooking was a bit off such that if a player took damage from the world, they would be invulnerable to all attacks. I used a different hook. After that, the long test inside the if statement at the start of OnTakeDamage is to ignore if the damage came from the world which would be client index zero. Without this handling, there would be errors about how the zero index doesn't represent a player or something along those lines.
PHP Code:
#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 

#define PLUGIN_AUTHOR     "Arkarr, thedudeguy1" 
#define PLUGIN_VERSION     "1.3" 

bool Marked[MAXPLAYERS 1]; 

public 
Plugin myinfo =  

    
name "[ANY] Knife Attack Delay",  
    
author PLUGIN_AUTHOR,  
    
description "Set a delay between each attack on the same player.",  
    
version PLUGIN_VERSION,  
    
url "https://forums.alliedmods.net/showpost.php?p=2499248&postcount=6" 
}; 

public 
void OnPluginStart() 

    for (new 
1<= MaxClientsi++) 
    { 
        if (
IsClientInGame(i)) 
            
SDKHook(iSDKHook_OnTakeDamageOnTakeDamage); 
    } 


public 
void OnClientPutInServer(int client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype

    if (
victim || victim MaxClients || attacker || attacker MaxClients
        return 
Plugin_Continue
        
    
char weapon[64]; 
    
GetClientWeapon(attackerweaponsizeof(weapon)); 
     
    if (
StrEqual(weapon"weapon_knife"false)) 
    { 
        if (!
Marked[victim]) 
        { 
            
ImmunePlayer(victim);     
        }             
        else 
        { 
            return 
Plugin_Handled
        } 
    } 
     
    return 
Plugin_Continue


public 
void ImmunePlayer(int client

    
Marked[client] = true
    
SetEntityRenderMode(clientRENDER_TRANSCOLOR); 
    
SetEntityRenderColor(client100255100200); 
     
    
CreateTimer(3.0TMR_Unmarkclient); 


public 
Action TMR_Unmark(Handle tmrany client

    
Marked[client] = false
    
SetEntityRenderMode(clientRENDER_TRANSCOLOR); 
    
SetEntityRenderColor(client255255255255); 

Attached Files
File Type: sp Get Plugin or Get Source (knife-attack-delay.sp - 630 views - 1.8 KB)
__________________
A computer is like an Old Testament god, with a lot of rules and no mercy. -Joseph Campbell

Last edited by thedudeguy1; 02-27-2017 at 19:01. Reason: Updated plugin URL to this post
thedudeguy1 is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 02-28-2017 , 03:15   Re: [csgo] knife delay request
Reply With Quote #7

Damn that necro-bump hahaha. But you did well. I mean, I quickly wrote the code, without having any return from the original author (wich mad me very sad) I gave up on it.
__________________
Want to check my plugins ?
Arkarr is offline
thedudeguy1
Senior Member
Join Date: Oct 2014
Location: 127.0.0.1
Old 02-28-2017 , 07:05   Re: [csgo] knife delay request
Reply With Quote #8

Yeah sorry about the necro. I haven't had a real chance to actually try and make sure the plugin worked until recently. Mods pls have mercy . Anyways, thanks for your work. You might want to see if you can make a plugin thread for it.
__________________
A computer is like an Old Testament god, with a lot of rules and no mercy. -Joseph Campbell
thedudeguy1 is offline
sdz
Senior Member
Join Date: Feb 2012
Old 02-28-2017 , 15:33   Re: [csgo] knife delay request
Reply With Quote #9

Quote:
Originally Posted by Arkarr View Post
Damn that necro-bump hahaha. But you did well. I mean, I quickly wrote the code, without having any return from the original author (wich mad me very sad) I gave up on it.
sorry to chime in my two cents but
PHP Code:
if (StrContains(sWeapon"knife") != -1
is what you'd want

although anything below 1 will technically be false; on the contrary to true.

Last edited by sdz; 02-28-2017 at 15:34.
sdz is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 02-28-2017 , 16:25   Re: [csgo] knife delay request
Reply With Quote #10

That's actually completly true. I should fix that.
__________________
Want to check my plugins ?
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 07:38.


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