Raised This Month: $ Target: $400
 0% 

Keydown not working?


Post New Thread Reply   
 
Thread Tools Display Modes
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-03-2011 , 03:00   Re: Keydown not working?
Reply With Quote #21

There SEE!!! i can be more help then jelle and G-dog !


try with the beam model from cyclops

and as you see the write_byte line looks fine so why should the problem be there? maybe something else is causing it

Last edited by RollerBlades; 06-03-2011 at 03:17.
RollerBlades is offline
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-03-2011 , 03:22   Re: Keydown not working?
Reply With Quote #22

Quote:
Originally Posted by RollerBlades View Post
There SEE!!! i can be more help then jelle and G-dog !


try with the beam model from cyclops

and as you see the write_byte line looks fine so why should the problem be there? maybe something else is causing it
please try fix it, then you would be sweet
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-03-2011 , 03:29   Re: Keydown not working?
Reply With Quote #23

try this and download the laser model from cyclops and add it in the sprites/shmod folder

Code:
#include <superheromod> 

new gHeroID 
new gHeroName[] = "Ultimater" 
new bool:gHasUltimater[SH_MAXSLOTS+1]
new bool:gUsingLaser[SH_MAXSLOTS+1]
new const gReviveSound[] = "ambience/port_suckin1.wav"
new const gUltimaterKnife[] = "models/shmod/chucky_knife.mdl"
new const gUltimaterDeagle[] = "models/shmod/ultimater_deagle.mdl"
new gLaserSound[] = "weapons/electro5.wav" 

new gBeam 
new gSmoke
new gBurnDecal

new pCvarDmg, pCvarCool, pCvarMultiShot, pCvarBurnDecals, pCvarHealth, pCvarArmor, pCvarGrav, pCvarSpeed, pCvarKnifeMult, pCvarDeagleMult


public plugin_init() 
{ 
    
    register_plugin("SUPERHERO Beam Test", "0.1", "MuzzMikkel") 
    
    
    new pCvarLevel = register_cvar("Ultimater_level", "1") 
    pCvarHealth = register_cvar("Ultimater_health", "500")
    pCvarArmor = register_cvar("Ultimater_armor", "400")
    pCvarGrav = register_cvar("Ultimater_gravity", "0.4")
    pCvarSpeed = register_cvar("Ultimater_speed", "350")
    pCvarKnifeMult = register_cvar("Ultimater_knifemult", "3.5")
    pCvarDeagleMult = register_cvar("Ultimater_deaglemult", "3.0")
    pCvarCool = register_cvar("Ultimater_cooldown", "0.1") 
    pCvarDmg = register_cvar("Ultimater_dmg", "100")
    pCvarMultiShot = register_cvar("Ultimater_multishot", "0.1")
    pCvarBurnDecals = register_cvar("Ultimater_burndecals", "1")
    
    gHeroID = sh_create_hero(gHeroName, pCvarLevel)  
    sh_set_hero_info(gHeroID, "Ultimater strongest hero in town!", "Beam, Respawn upon death, Powerfull knife & deagle.") 
    sh_set_hero_bind(gHeroID)
    
    sh_set_hero_hpap(gHeroID, pCvarHealth, pCvarArmor)
    sh_set_hero_grav(gHeroID, pCvarGrav)
    sh_set_hero_speed(gHeroID, pCvarSpeed)
    sh_set_hero_dmgmult(gHeroID, pCvarKnifeMult, CSW_KNIFE)
    sh_set_hero_dmgmult(gHeroID, pCvarDeagleMult, CSW_DEAGLE)
    
    // Set to correct burn decals if mod is CZ or CS
    gBurnDecal = engfunc(EngFunc_DecalIndex, "{bigshot5")
    
    //CurWeapon
    register_event("CurWeapon", "weapon_change", "be", "1=1")
} 

public plugin_precache()  
{  
    gBeam = precache_model("sprites/shmod/beam.spr") 
    gSmoke = precache_model("sprites/laserbeam.spr")
    precache_sound(gLaserSound)
    precache_sound(gReviveSound)
    precache_model(gUltimaterKnife)
    precache_model(gUltimaterDeagle)
}   

public sh_hero_init(id, heroid, mode)
{
    if ( heroid == gHeroID )
        
    switch(mode)
    {
        case SH_HERO_ADD:
        {
            gHasUltimater[id] = true
            gPlayerInCooldown[id] = false
            Ultimater_weapons(id)
            switch_model(id)
            }
        case SH_HERO_DROP:
        {
            gHasUltimater[id] = false 
            sh_drop_weapon(id, CSW_DEAGLE, true)
        }
    }
}

public sh_hero_key(id, heroID, key)  
{  
    
    if (gHeroID != heroID || gPlayerInCooldown[id] || !is_user_alive(id)) return  
    
    switch(key)
    {
        case SH_KEYDOWN:
        {
            new Float:delayTime = get_pcvar_float(pCvarMultiShot)
            if ( delayTime >= 0.1 )
            {
                set_task(delayTime, "fire_attack", id, _, _, "b")
            }
            
       fire_attack(id)
       
            if ( gPlayerInCooldown[id] )
            {
                sh_sound_deny(id)
                return
            }
       
       gUsingLaser[id] = true
        }
        case SH_KEYUP: {
            remove_task(id)
            
            if ( sh_is_freezetime() || !gUsingLaser[id] ) return
            
            new Float:seconds = get_pcvar_float(pCvarCool)
            if ( seconds > 0.0 ) sh_set_cooldown(id, seconds)
            
            gUsingLaser[id] = false
        }
    }
}

public sh_client_spawn(id)   
{   
    if (gHasUltimater[id])  
    {
        remove_task(id)
        gUsingLaser[id] = false
        gPlayerInCooldown[id] = false   
        Ultimater_weapons(id)
    }  
}   

public fire_attack(id)  
{   
    new aimvec[3] 
    new tid, tbody, damage  
    
    damage = get_pcvar_num(pCvarDmg)   
    
    get_user_aiming(id, tid, tbody) 
    get_user_origin(id, aimvec, 3)
    
    attack_effects(id, aimvec)
    
    if ( is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
    {  
        sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM)  
    }
}

public attack_effects(id, aimvec[3])
{   
    emit_sound(id, CHAN_ITEM, gLaserSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    
    new origin[3]
    get_user_origin(id, origin, 1)
    
    // Beam effect between two points
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_BEAMPOINTS)    // 0
    write_coord(origin[0])
    write_coord(origin[1])
    write_coord(origin[2])
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    write_short(gBeam)
    write_byte(1)        // framestart
    write_byte(5)        // framerate
    write_byte(2)        // life
    write_byte(40)        // width
    write_byte(0)        // noise
    write_byte(255)        // r, g, b
    write_byte(250)        // r, g, b
    write_byte(250)        // r, g, b
    write_byte(200)        // brightness
    write_byte(200)        // speed
    message_end()
    
    // DELIGHT
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(27)
    write_coord(origin[0])    //pos
    write_coord(origin[1])
    write_coord(origin[2])
    write_byte(10)
    write_byte(255)            // r, g, b
    write_byte(250)        // r, g, b
    write_byte(250)            // r, g, b
    write_byte(2)            // life
    write_byte(1)            // decay
    message_end()
    
    // Sparks
    message_begin(MSG_PVS, SVC_TEMPENTITY)
    write_byte(TE_SPARKS)    // 9
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    message_end()
    
    // Smoke
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_SMOKE)    // 5
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    write_short(gSmoke)
    write_byte(22)        // 10
    write_byte(10)        // 10
    message_end()
    
    if ( get_pcvar_num(pCvarBurnDecals) )
    {
        // decal and ricochet sound
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(109)    // TE_GUNSHOTDECAL
        write_coord(aimvec[0])    //pos
        write_coord(aimvec[1])
        write_coord(aimvec[2])
        write_short(0)        // I have no idea what thats supposed to be
        write_byte(gBurnDecal + random_num(0, 4))   //decal
        message_end()
        
    }
}

public weapon_change(id) 
{ 
    
    if ( !sh_is_active() || !gHasUltimater[id] ) return   
    
    if(read_data(2) == CSW_KNIFE || read_data(2) == CSW_DEAGLE)
    {
        switch_model(id) 
            
        if (read_data(3) == 0) 
        { 
            sh_reload_ammo(id, 1) 
        } 
    } 
}

Ultimater_weapons(id) 
{ 
if (sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    sh_give_weapon(id, CSW_DEAGLE) 
} 
}

switch_model(id) 
{ 
if (!sh_is_active() || !is_user_alive(id) || !gHasUltimater[id] ) return 

if ( get_user_weapon(id) == CSW_KNIFE)  
{ 
    set_pev(id, pev_viewmodel2, gUltimaterKnife)  
} 

else if ( get_user_weapon(id) == CSW_DEAGLE ) 
{ 
    set_pev(id, pev_viewmodel2, gUltimaterDeagle) 
} 
}

public sh_client_death(victim, attacker)
{
if ( !sh_is_active() || !sh_is_inround() ) return
if ( !is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(1, 2) != 1 || gPlayerInCooldown[victim]) return
if ( victim == attacker ) return

set_task(0.5, "Ultimater_respawn", victim)
}

public Ultimater_respawn(id)
{
if ( !is_user_connected(id) || is_user_alive(id) || !sh_is_inround() ) return

ExecuteHamB(Ham_CS_RoundRespawn, id)

emit_sound(id, CHAN_STATIC, gReviveSound, 1.0, ATTN_NORM, 0, PITCH_NORM)

sh_chat_message(id, gHeroID, "You used Ultimater's powers to revive yourself.")

new Float:cooldown = get_pcvar_float(pCvarCool)
if ( cooldown > 0.0 ) {
    gPlayerInCooldown[id] = true
    set_task(cooldown, "enable_ultimater", id)
}
}

public enable_ultimater(id) 
{
      gPlayerInCooldown[id] = false
}
RollerBlades is offline
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-03-2011 , 04:16   Re: Keydown not working?
Reply With Quote #24

Dosen't work either!
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-03-2011 , 04:22   Re: Keydown not working?
Reply With Quote #25

Code:
#include <superheromod> 

new gHeroID 
new gHeroName[] = "Ultimater" 
new bool:gHasUltimater[SH_MAXSLOTS+1]
new bool:gUsingLaser[SH_MAXSLOTS+1]
new const gReviveSound[] = "ambience/port_suckin1.wav"
new const gUltimaterKnife[] = "models/shmod/chucky_knife.mdl"
new const gUltimaterDeagle[] = "models/shmod/ultimater_deagle.mdl"
new gLaserSound[] = "weapons/electro5.wav" 

new gBeam 
new gSmoke
new gBurnDecal

new pCvarDmg, pCvarCool, pCvarMultiShot, pCvarBurnDecals, pCvarHealth, pCvarArmor, pCvarGrav, pCvarSpeed, pCvarKnifeMult, pCvarDeagleMult


public plugin_init() 
{ 
    
    register_plugin("SUPERHERO Beam Test", "0.1", "MuzzMikkel") 
    
    
    new pCvarLevel = register_cvar("Ultimater_level", "1") 
    pCvarHealth = register_cvar("Ultimater_health", "500")
    pCvarArmor = register_cvar("Ultimater_armor", "400")
    pCvarGrav = register_cvar("Ultimater_gravity", "0.4")
    pCvarSpeed = register_cvar("Ultimater_speed", "350")
    pCvarKnifeMult = register_cvar("Ultimater_knifemult", "3.5")
    pCvarDeagleMult = register_cvar("Ultimater_deaglemult", "3.0")
    pCvarCool = register_cvar("Ultimater_cooldown", "0.1") 
    pCvarDmg = register_cvar("Ultimater_dmg", "100")
    pCvarMultiShot = register_cvar("Ultimater_multishot", "0.1")
    pCvarBurnDecals = register_cvar("Ultimater_burndecals", "1")
    
    gHeroID = sh_create_hero(gHeroName, pCvarLevel)  
    sh_set_hero_info(gHeroID, "Ultimater strongest hero in town!", "Beam, Respawn upon death, Powerfull knife & deagle.") 
    sh_set_hero_bind(gHeroID)
    
    sh_set_hero_hpap(gHeroID, pCvarHealth, pCvarArmor)
    sh_set_hero_grav(gHeroID, pCvarGrav)
    sh_set_hero_speed(gHeroID, pCvarSpeed)
    sh_set_hero_dmgmult(gHeroID, pCvarKnifeMult, CSW_KNIFE)
    sh_set_hero_dmgmult(gHeroID, pCvarDeagleMult, CSW_DEAGLE)
    
    //CurWeapon
    register_event("CurWeapon", "weapon_change", "be", "1=1")
} 

public plugin_precache()  
{  
    gBeam = precache_model("sprites/shmod/beam.spr") 
    gSmoke = precache_model("sprites/laserbeam.spr")
    precache_sound(gLaserSound)
    precache_sound(gReviveSound)
    precache_model(gUltimaterKnife)
    precache_model(gUltimaterDeagle)
}   

public sh_hero_init(id, heroid, mode)
{
    if ( heroid == gHeroID )
        
    switch(mode)
    {
        case SH_HERO_ADD:
        {
            gHasUltimater[id] = true
            gPlayerInCooldown[id] = false
            Ultimater_weapons(id)
            switch_model(id)
            }
        case SH_HERO_DROP:
        {
            gHasUltimater[id] = false 
            sh_drop_weapon(id, CSW_DEAGLE, true)
        }
    }
}

public sh_hero_key(id, heroID, key)  
{  
    
    if (gHeroID != heroID || gPlayerInCooldown[id] || !is_user_alive(id)) return  
    
    switch(key)
    {
        case SH_KEYDOWN:
        {
            new Float:delayTime = get_pcvar_float(pCvarMultiShot)
            if ( delayTime >= 0.1 )
            {
                set_task(delayTime, "fire_attack", id, _, _, "b")
            }
            
       fire_attack(id)
       
            if ( gPlayerInCooldown[id] )
            {
                sh_sound_deny(id)
                return
            }
       
       gUsingLaser[id] = true
        }
        case SH_KEYUP: {
            remove_task(id)
            
            if ( sh_is_freezetime() || !gUsingLaser[id] ) return
            
            new Float:seconds = get_pcvar_float(pCvarCool)
            if ( seconds > 0.0 ) sh_set_cooldown(id, seconds)
            
            gUsingLaser[id] = false
        }
    }
}

public sh_client_spawn(id)   
{   
    if (gHasUltimater[id])  
    {
        remove_task(id)
        gUsingLaser[id] = false
        gPlayerInCooldown[id] = false   
        Ultimater_weapons(id)
    }  
}   

public fire_attack(id)  
{   
    new aimvec[3] 
    new tid, tbody, damage  
    
    damage = get_pcvar_num(pCvarDmg)   
    
    get_user_aiming(id, tid, tbody) 
    get_user_origin(id, aimvec, 3)
    
    attack_effects(id, aimvec)
    
    if ( is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
    {  
        sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM)  
    }
}

public attack_effects(id, aimvec[3])
{   
    emit_sound(id, CHAN_ITEM, gLaserSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    
    new origin[3]
    get_user_origin(id, origin, 1)
    
    // Beam effect between two points
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_BEAMPOINTS)    // 0
    write_coord(origin[0])
    write_coord(origin[1])
    write_coord(origin[2])
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    write_short(gBeam)
    write_byte(1)        // framestart
    write_byte(5)        // framerate
    write_byte(2)        // life
    write_byte(40)        // width
    write_byte(0)        // noise
    write_byte(255)        // r, g, b
    write_byte(250)        // r, g, b
    write_byte(250)        // r, g, b
    write_byte(200)        // brightness
    write_byte(200)        // speed
    message_end()
    
    // DELIGHT
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(27)
    write_coord(origin[0])    //pos
    write_coord(origin[1])
    write_coord(origin[2])
    write_byte(10)
    write_byte(255)            // r, g, b
    write_byte(250)        // r, g, b
    write_byte(250)            // r, g, b
    write_byte(2)            // life
    write_byte(1)            // decay
    message_end()
    
    // Sparks
    message_begin(MSG_PVS, SVC_TEMPENTITY)
    write_byte(TE_SPARKS)    // 9
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    message_end()
    
    // Smoke
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_SMOKE)    // 5
    write_coord(aimvec[0])
    write_coord(aimvec[1])
    write_coord(aimvec[2])
    write_short(gSmoke)
    write_byte(22)        // 10
    write_byte(10)        // 10
    message_end()
    
    if ( get_pcvar_num(pCvarBurnDecals) )
    {
        // decal and ricochet sound
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(109)    // TE_GUNSHOTDECAL
        write_coord(aimvec[0])    //pos
        write_coord(aimvec[1])
        write_coord(aimvec[2])
        write_short(0)        // I have no idea what thats supposed to be
        write_byte(gBurnDecal + random_num(0, 4))   //decal
        message_end()
        
    }
}

public weapon_change(id) 
{ 
    
    if ( !sh_is_active() || !gHasUltimater[id] ) return   
    
    if(read_data(2) == CSW_KNIFE || read_data(2) == CSW_DEAGLE)
    {
        switch_model(id) 
            
        if (read_data(3) == 0) 
        { 
            sh_reload_ammo(id, 1) 
        } 
    } 
}

Ultimater_weapons(id) 
{ 
if (sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    sh_give_weapon(id, CSW_DEAGLE) 
} 
}

switch_model(id) 
{ 
if (!sh_is_active() || !is_user_alive(id) || !gHasUltimater[id] ) return 

if ( get_user_weapon(id) == CSW_KNIFE)  
{ 
    set_pev(id, pev_viewmodel2, gUltimaterKnife)  
} 

else if ( get_user_weapon(id) == CSW_DEAGLE ) 
{ 
    set_pev(id, pev_viewmodel2, gUltimaterDeagle) 
} 
}

public sh_client_death(victim, attacker)
{
if ( !sh_is_active() || !sh_is_inround() ) return
if ( !is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(1, 2) != 1 || gPlayerInCooldown[victim]) return
if ( victim == attacker ) return

set_task(0.5, "Ultimater_respawn", victim)
}

public Ultimater_respawn(id)
{
if ( !is_user_connected(id) || is_user_alive(id) || !sh_is_inround() ) return

ExecuteHamB(Ham_CS_RoundRespawn, id)

emit_sound(id, CHAN_STATIC, gReviveSound, 1.0, ATTN_NORM, 0, PITCH_NORM)

sh_chat_message(id, gHeroID, "You used Ultimater's powers to revive yourself.")

new Float:cooldown = get_pcvar_float(pCvarCool)
if ( cooldown > 0.0 ) {
    gPlayerInCooldown[id] = true
    set_task(cooldown, "enable_ultimater", id)
}
}

public enable_ultimater(id) 
{
      gPlayerInCooldown[id] = false
}
if this doesn't work then its no use
RollerBlades is offline
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-03-2011 , 05:11   Re: Keydown not working?
Reply With Quote #26

Now its totally f**cked up!
what did you edit?


MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 06-03-2011 , 05:31   Re: Keydown not working?
Reply With Quote #27

What's it matter? This is cooler.

lol
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-03-2011 , 06:40   Re: Keydown not working?
Reply With Quote #28

Quote:
Originally Posted by G-Dog View Post
good point... nah still not enough! Must use the
Now quadruple facepalm seems to not be enough.

EDIT:
I found the appropriate one:

[IMG]http://img801.**************/img801/7023/eternalfacepalmeternalf.jpg[/IMG]

Quote:
Originally Posted by DarkGod View Post
What's it matter? This is cooler.

lol
They are geniuses, this looks so much cooler.

EDIT:
Code:
write_byte(gBurnDecal + random_num(0, 4))   //decal
WTF?
__________________
No idea what to write here...

Last edited by Jelle; 06-03-2011 at 06:53.
Jelle is offline
Send a message via MSN to Jelle
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 06-03-2011 , 07:36   Re: Keydown not working?
Reply With Quote #29

TROLOLOL


What the heck is going on lol....


Well the includes were as spooky as this is:

Code:
// write_byte(decal???)
But yeh, Im pretty sure it can't find a decal that has a random number to it....

@'dg: True words, dear sir! There should be a separate AMXX plugin or something... Would take server resources though.
__________________
The Art of War is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 06-03-2011 , 09:45   Re: Keydown not working?
Reply With Quote #30

Quote:
Originally Posted by Jelle View Post
Code:
write_byte(gBurnDecal + random_num(0, 4))   //decal
WTF?
look at cyclops in the latest release of superhero. Basically instead of hard coding the model indexes of 199 - 203 instead you find a base model index, which is the purpose of this line in plugin_init
PHP Code:
gBurnDecal engfunc(EngFunc_DecalIndex"{bigshot5"
and then add a random value between 0 and 4 to get the same effect as how the plugin was originally made. He just ended up redefining his index to 18 which just happened to be the model index for the B site sprite. RollerBlades latest version removed the base index so it's now using index's 0 - 4, thus the latest wave of incorrect decals.
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
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 04:35.


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