AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   These plugins wont function in latest sm build (https://forums.alliedmods.net/showthread.php?t=300525)

deville 08-20-2017 07:22

These plugins wont function in latest sm build
 
Hi. 2 of the plugins I am running on my server/s are being loaded but simply doesn't function. Can't find any output regarding this in the error logs. I thought maybe someone can see an immediate fix or maybe I have to wait until a new build? Im running linux btw

Here they are:


knife delay by Arkarr & thedudeguy1.
Source: https://forums.alliedmods.net/showpo...48&postcount=6

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);  



Antibackstab by unknown:

PHP Code:

#include <sdkhooks> 

public void OnPluginStart() 

    for (new 
client 1client <= MaxClientsclient++) 
    { 
        if (!
IsClientInGame(client)) 
            continue; 
             
        
OnClientPutInServer(client); 
         
    }     

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

    if (
damage 55.0
    { 
        
char weapon[64]; 
        
GetClientWeapon(attackerweaponsizeof(weapon)); 
        if (
StrEqual(weapon"weapon_knife"false)) 
        { 
            
damage 55.0
            return 
Plugin_Changed
        } 
    } 
    return 
Plugin_Continue


I've tried look up in the discussion thread of what I may change in order to fix it but couldn't find out much about it. Appreciate any help

Totenfluch 08-20-2017 08:46

Re: These plugins wont function in latest sm build
 
I've noticed those kind of plugins only not working with bayonetts. Normal knifes work fine for me

deville 08-20-2017 08:48

Re: These plugins wont function in latest sm build
 
Quote:

Originally Posted by Totenfluch (Post 2543046)
I've noticed those kind of plugins only not working with bayonetts. Normal knifes work fine for me

I know there was something similar with prestrafing on kztimer. I'll check once i get back. Thank you!

OSWO 08-20-2017 08:52

Re: These plugins wont function in latest sm build
 
Bayonets have had their name changed.

deville 08-20-2017 09:26

Re: These plugins wont function in latest sm build
 
Yup this seems to be the issue. How would I approach to resolving this issue in the code?

OfficialSikari 08-20-2017 09:31

Re: These plugins wont function in latest sm build
 
Code:

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) 

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

Into

Code:

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) 

    if (victim < 1 || victim > MaxClients || attacker < 1 || attacker > MaxClients) 
        return Plugin_Continue; 
         
    char weapon[64]; 
    GetClientWeapon(attacker, weapon, sizeof(weapon)); 
     
    if (StrEqual(weapon, "weapon_knife", false) ||
      StrEqual(weapon, "weapon_bayonet", false) ||
      StrContains(weapon, "weapon_knife_", false) != -1)
    { 
        if (!Marked[victim]) 
        { 
            ImmunePlayer(victim);     
        }             
        else 
        { 
            return Plugin_Handled; 
        } 
    } 
     
    return Plugin_Continue; 
}


deville 08-20-2017 10:56

Re: These plugins wont function in latest sm build
 
Quote:

Originally Posted by OfficialSikari (Post 2543060)
Code:

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) 

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

Into

Code:

public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) 

    if (victim < 1 || victim > MaxClients || attacker < 1 || attacker > MaxClients) 
        return Plugin_Continue; 
         
    char weapon[64]; 
    GetClientWeapon(attacker, weapon, sizeof(weapon)); 
     
    if (StrEqual(weapon, "weapon_knife", false) ||
      StrEqual(weapon, "weapon_bayonet", false) ||
      StrContains(weapon, "weapon_knife_", false) != -1)
    { 
        if (!Marked[victim]) 
        { 
            ImmunePlayer(victim);     
        }             
        else 
        { 
            return Plugin_Handled; 
        } 
    } 
     
    return Plugin_Continue; 
}


Thanks a lot Sikari! This one fixed it for both plugins. I didn't really know what exactly got changed in the weapon index so I didn't know what to do. Now I understand.

A moderator can mark this as solved, or however things work in these forums :p


All times are GMT -4. The time now is 23:40.

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