Raised This Month: $27 Target: $400
 6% 

Plugin for DOD:S for an endless stamina


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hindrum
Junior Member
Join Date: Aug 2017
Old 03-27-2025 , 21:25   Plugin for DOD:S for an endless stamina
Reply With Quote #1

Hello everyone I am looking for a plugin that gives endless stamina when a player has a knife or a shovel in his hand
hindrum is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-29-2025 , 15:24   Re: Plugin for DOD:S for an endless stamina
Reply With Quote #2

Here is one version.
- Holding weapon_amerknife or weapon_spade you not loose stamina while sprinting.
PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
HookEventEx("player_spawn"player_spawn);
}

public 
void player_spawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));

    
//send fake callback, update "weapon"
    
OnPlayerRunCmdPre(client00, {0.0,0.0,0.0}, {0.0,0.0,0.0}, -10000, {0,0});
}


public 
void OnPlayerRunCmdPre(int clientint buttonsint impulse, const float vel[3], const float angles[3], int weaponint subtypeint cmdnumint tickcountint seed, const int mouse[2])
{
    static 
bool correctweapon[MAXPLAYERS+1];
    static 
float oldstamina[MAXPLAYERS+1];

    
float stamina GetEntPropFloat(clientProp_Send"m_flStamina");

    
//PrintToServer("   stamina %0.2f weapon %i", stamina, weapon);

    
if(weapon MaxClients)
    {
        
correctweapon[client] = false;

        
char clsname[60];
        
GetEntityClassname(weaponclsnamesizeof(clsname));
        
        if(
StrEqual(clsname"weapon_amerknife"false) || StrEqual(clsname"weapon_spade"false))
            
correctweapon[client] = true;
    }
    else if(
weapon == -1)
    {
        
correctweapon[client] = false;
    }


    if(
correctweapon[client])
    {
        if(
oldstamina[client] - stamina 0.0)
        {
            
stamina stamina + (oldstamina[client] - stamina);
            
SetEntPropFloat(clientProp_Send"m_flStamina"stamina);
        }
    }

    
oldstamina[client] = stamina;






I also got plugin work with DHooks and get in more advance, but it works 32bit SRCDS and crash 64bit SRCDS... so I decided push it a side for now.
__________________
Do not Private Message @me
Bacardi is offline
Reply


Thread Tools
Display Modes

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 22:20.


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