AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why isnt dod_set_stamina working? (https://forums.alliedmods.net/showthread.php?t=48572)

SweatyBanana 12-14-2006 20:37

Why isnt dod_set_stamina working?
 
Code:

public damage(id)
{
    if(id && is_user_alive(id) && get_pcvar_num(cvar2) == 1)
    {
        new health = get_user_health(id);
        if(health>100)
        {
            health = 100;
        }

        dod_set_stamina(id,STAMINA_SET,0,health);
    }
}


Emp` 12-14-2006 21:04

Re: Why isnt dod_set_stamina working?
 
heres a comparison for CS:NS:DOD on setting speed/stamina. (Note that it's from PokeMod)
Code:
 //--Sets Speed Correctly--//  public SetSpeed(id)  {     if(FreezeTime || !PMon()) return     //thanks to a plugin i wrote and used     new Float:speed=0.0, Float:toadd=0.0     new clip, ammo, weapon = get_user_weapon(id, clip, ammo)     switch(weapon)     {         #if MOD==CS             case    CSW_P228,CSW_HEGRENADE,CSW_C4,CSW_MAC10,CSW_SMOKEGRENADE,                     CSW_ELITE,CSW_FIVESEVEN,CSW_UMP45,CSW_USP,CSW_GLOCK18,CSW_MP5NAVY,                     CSW_TMP,CSW_FLASHBANG,CSW_DEAGLE,CSW_KNIFE: speed = 250.0             case    CSW_SCOUT: speed = 260.0             case    CSW_XM1014,CSW_AUG,CSW_GALI,CSW_FAMAS: speed = 240.0             case    CSW_SG550,CSW_AWP,CSW_G3SG1: speed = 210.0             case    CSW_M249: speed = 220.0             case    CSW_M3,CSW_M4A1: speed = 230.0             case    CSW_SG552: speed = 235.0             case    CSW_AK47: speed = 221.0             case    CSW_P90: speed = 245.0             default: speed = 240.0  //if for some reason it aint here, this is the average speed         #endif         #if MOD==DOD             default: speed = 100.0 //all weapons in dod have 600, but were setting stamina, so lets set to 100.0 (default stamina)         #endif         #if MOD==NS             default:{                 speed = float(ns_get_maxspeed(id))                 ns_set_speedchange(id)                 toadd = float(ns_get_speedchange(id))             }         #endif     }     //Pokemon that affect speed     if(Pokemon[id]==AERODACTYL){         new pid = HasPokemon(id,AERODACTYL)         toadd += float(LevelPercent(id,(FASTSPEED+PlayersLevel(id,pid)),pid))     }     if(Pokemon[id]==SNORLAX)         toadd += (-1.0*SLOWSPEED) + LevelPercent(id,SLOWSPEED,HasPokemon(id,SNORLAX))     //Items that affect speed     if(g_Status[id][BIKE])         toadd += FASTSPEED     if(Item[id][CARBOS])         toadd += (Item[id][CARBOS]*STATADD)     //Statuses that affect speed     if(g_Status[id][SLOW] || g_Status[id][FROZEN])         toadd -= SLOWSPEED     if(g_Status[id][PARALYZE] || g_Status[id][ASLEEP] || g_Status[id][OAK_STOP]){         #if MOD==CS || MOD==DOD             speed = 1.0             toadd = 0.0         #endif         #if MOD==NS             toadd = -1.0*MAX_SPEED             speed = 1.0         #endif     }     if(toadd>MAX_SPEED)         toadd = 1.0*MAX_SPEED     if(is_user_alive(id)){     #if MOD==CS         set_user_maxspeed(id, speed+toadd)     #endif     #if MOD==DOD         dod_set_stamina(id,STAMINA_SET,clamp(floatround(toadd),0,99),clamp(floatround(speed+toadd),1,100))     #endif     #if MOD==NS         ns_set_speedchange(id, floatround(toadd))         set_user_maxspeed(id, speed)     #endif     }  }

SweatyBanana 12-14-2006 21:50

Re: Why isnt dod_set_stamina working?
 
Naw I figured it out.. I was using a bad damage event.


All times are GMT -4. The time now is 06:55.

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