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

Keydown not working?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-01-2011 , 13:02   Keydown not working?
Reply With Quote #1

So i tried to make a hero with - Beam, 2 weapon models and respawn upon death. When i enter my server and choose the hero, there is no +power key showing like this..



And when i look in console it says

Code:
Unknown command: -setlaser
And some of the things does not work too:
Health, Speed (not knifespeed), Armor and Gravity.

Here is my sma code
PHP 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 Beam
new gSmoke
new gBurnDecal

new pCvarDmgpCvarCoolpCvarMultiShotpCvarBurnDecals

public plugin_init()

    
//Public plugin info, do not change the cvars, use the cvars in the .sma, use the cvars in the shconfig.
    
register_plugin("SUPERHERO Ultimater""1.0""MuzzMikkel")
    
    
//cvars
    
new pCvarLevel register_cvar("ultimater_level""15")
    new 
pCvarKnifeSpeed register_cvar("ultimater_knifespeed""450")
    new 
pCvarArmor register_cvar("ultimater_armor""250")
    new 
pCvarGrav register_cvar("ultimater_grav""2.5")
    new 
pCvarHealth register_cvar("ultimater_health""500")
    new 
pCvarSpeed register_cvar("ultimater_speed""300")
    
pCvarCool register_cvar("ultimater_cooldown""15")
    
pCvarDmg register_cvar("ultimater_dmg""100")
    
pCvarMultiShot register_cvar("ultimater_multishot""0.1")
    
pCvarBurnDecals register_cvar("ultimater_burndecals""1")
    
    
//Creates your hero
    
gHeroID sh_create_hero(gHeroNamepCvarLevel)
    
sh_set_hero_info(gHeroID"Ultimater strongest hero in town!""Beam, Respawn upon death, Powerfull knife & deagle.")
    
    
//Sets the hero's powers
    
sh_set_hero_speed(gHeroIDpCvarKnifeSpeed, {29}, 1)
    
sh_set_hero_hpap(gHeroID0pCvarArmor)
    
sh_set_hero_grav(gHeroIDpCvarGrav)
    
sh_set_hero_hpap(gHeroIDpCvarHealth0)
    
sh_set_hero_speed(gHeroIDpCvarSpeed)
    
    
// 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()
{
    
precache_sound(gReviveSound)
    
precache_sound(gLaserSound)
    
Beam precache_model("sprites/shmod/beam.spr")
    
gSmoke precache_model("sprites/steam1.spr")
    
precache_model(gUltimaterKnife)
    
precache_model(gUltimaterDeagle)
}

public 
sh_hero_init(idheroIDmode)
{
    if (
gHeroID != heroID) return
    
    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
(idCSW_DEAGLEtrue)
        }
    }
}           

public 
sh_hero_key(idheroIDkey)  
{  
    
    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")
            }
            
            if ( 
gPlayerInCooldown[id] )
            {
                
sh_sound_deny(id)
                return
            }
        }
        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(idseconds)
            
            
gUsingLaser[id] = false
        
}
    }
}     

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(id1
        } 
    } 
}

Ultimater_weapons(id

if (
sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    
sh_give_weapon(idCSW_DEAGLE

}

switch_model(id

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

if ( 
get_user_weapon(id) == CSW_KNIFE)  

    
set_pev(idpev_viewmodel2gUltimaterKnife)  


else if ( 
get_user_weapon(id) == CSW_DEAGLE 

    
set_pev(idpev_viewmodel2gUltimaterDeagle



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

public 
sh_client_death(victimattacker)
{
if ( !
sh_is_active() || !sh_is_inround() ) return
if ( !
is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(12) != || gPlayerInCooldown[victim]) return
if ( 
victim == attacker ) return // avoid the call on change team, use of kill command...

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

emit_sound(idCHAN_STATICgReviveSound1.0ATTN_NORM0PITCH_NORM)

sh_chat_message(idgHeroID"You used Ultimater's Voodoo 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
}

public 
fire_attack(id)  
{   
new 
tidtbodydamage  

damage 
get_pcvar_num(pCvarDmg)   

get_user_aiming(idtidtbody)  


attack_effects(id)


if ( 
is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
{  
    
sh_extra_damage(tididdamage"Ultimater")  
}
}  

public 
attack_effects(id)
{
new 
aimvec[3]  
get_user_origin(idaimvec3

emit_sound(idCHAN_ITEMgLaserSoundVOL_NORMATTN_NORM0PITCH_NORM)

new 
origin[3]
get_user_origin(idorigin1)

// Beam effect between two points
message_begin(MSG_BROADCASTSVC_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(Beam)
write_byte(1)        // framestart
write_byte(5)        // framerate
write_byte(2)        // life
write_byte(40)        // width
write_byte(0)        // noise
write_byte(0)        // r, g, b
write_byte(0)        // r, g, b
write_byte(0)        // r, g, b
write_byte(200)        // brightness
write_byte(200)        // speed
message_end()

// DELIGHT
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
write_byte(27)
write_coord(origin[0])    //pos
write_coord(origin[1])
write_coord(origin[2])
write_byte(10)
write_byte(0)            // r, g, b
write_byte(0)            // r, g, b
write_byte(0)            // r, g, b
write_byte(2)            // life
write_byte(1)            // decay
message_end()

// Sparks
message_begin(MSG_PVSSVC_TEMPENTITY)
write_byte(TE_SPARKS)    // 9
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
message_end()

// Smoke
message_begin(MSG_BROADCASTSVC_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_BROADCASTSVC_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 == (18))    //decal
    
message_end()
    
}
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by MuzzMikkel; 06-01-2011 at 13:17.
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-01-2011 , 13:35   Re: Keydown not working?
Reply With Quote #2

Quote:
Originally Posted by MuzzMikkel View Post
So i tried to make a hero with - Beam, 2 weapon models and respawn upon death. When i enter my server and choose the hero, there is no +power key showing like this..



And when i look in console it says

Code:
Unknown command: -setlaser
And some of the things does not work too:
Health, Speed (not knifespeed), Armor and Gravity.

Here is my sma code
PHP 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 Beam
new gSmoke
new gBurnDecal

new pCvarDmgpCvarCoolpCvarMultiShotpCvarBurnDecals

public plugin_init()

    
//Public plugin info, do not change the cvars, use the cvars in the .sma, use the cvars in the shconfig.
    
register_plugin("SUPERHERO Ultimater""1.0""MuzzMikkel")
    
    
//cvars
    
new pCvarLevel register_cvar("ultimater_level""15")
    new 
pCvarKnifeSpeed register_cvar("ultimater_knifespeed""450")
    new 
pCvarArmor register_cvar("ultimater_armor""250")
    new 
pCvarGrav register_cvar("ultimater_grav""2.5")
    new 
pCvarHealth register_cvar("ultimater_health""500")
    new 
pCvarSpeed register_cvar("ultimater_speed""300")
    
pCvarCool register_cvar("ultimater_cooldown""15")
    
pCvarDmg register_cvar("ultimater_dmg""100")
    
pCvarMultiShot register_cvar("ultimater_multishot""0.1")
    
pCvarBurnDecals register_cvar("ultimater_burndecals""1")
    
    
//Creates your hero
    
gHeroID sh_create_hero(gHeroNamepCvarLevel)
    
sh_set_hero_info(gHeroID"Ultimater strongest hero in town!""Beam, Respawn upon death, Powerfull knife & deagle.")
    
    
//Sets the hero's powers
    
sh_set_hero_speed(gHeroIDpCvarKnifeSpeed, {29}, 1)
    
sh_set_hero_hpap(gHeroID0pCvarArmor)
    
sh_set_hero_grav(gHeroIDpCvarGrav)
    
sh_set_hero_hpap(gHeroIDpCvarHealth0)
    
sh_set_hero_speed(gHeroIDpCvarSpeed)
    
    
// 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()
{
    
precache_sound(gReviveSound)
    
precache_sound(gLaserSound)
    
Beam precache_model("sprites/shmod/beam.spr")
    
gSmoke precache_model("sprites/steam1.spr")
    
precache_model(gUltimaterKnife)
    
precache_model(gUltimaterDeagle)
}

public 
sh_hero_init(idheroIDmode)
{
    if (
gHeroID != heroID) return
    
    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
(idCSW_DEAGLEtrue)
        }
    }
}           

public 
sh_hero_key(idheroIDkey)  
{  
    
    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")
            }
            
            if ( 
gPlayerInCooldown[id] )
            {
                
sh_sound_deny(id)
                return
            }
        }
        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(idseconds)
            
            
gUsingLaser[id] = false
        
}
    }
}     

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(id1
        } 
    } 
}

Ultimater_weapons(id

if (
sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    
sh_give_weapon(idCSW_DEAGLE

}

switch_model(id

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

if ( 
get_user_weapon(id) == CSW_KNIFE)  

    
set_pev(idpev_viewmodel2gUltimaterKnife)  


else if ( 
get_user_weapon(id) == CSW_DEAGLE 

    
set_pev(idpev_viewmodel2gUltimaterDeagle



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

public 
sh_client_death(victimattacker)
{
if ( !
sh_is_active() || !sh_is_inround() ) return
if ( !
is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(12) != || gPlayerInCooldown[victim]) return
if ( 
victim == attacker ) return // avoid the call on change team, use of kill command...

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

emit_sound(idCHAN_STATICgReviveSound1.0ATTN_NORM0PITCH_NORM)

sh_chat_message(idgHeroID"You used Ultimater's Voodoo 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
}

public 
fire_attack(id)  
{   
new 
tidtbodydamage  

damage 
get_pcvar_num(pCvarDmg)   

get_user_aiming(idtidtbody)  


attack_effects(id)


if ( 
is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
{  
    
sh_extra_damage(tididdamage"Ultimater")  
}
}  

public 
attack_effects(id)
{
new 
aimvec[3]  
get_user_origin(idaimvec3

emit_sound(idCHAN_ITEMgLaserSoundVOL_NORMATTN_NORM0PITCH_NORM)

new 
origin[3]
get_user_origin(idorigin1)

// Beam effect between two points
message_begin(MSG_BROADCASTSVC_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(Beam)
write_byte(1)        // framestart
write_byte(5)        // framerate
write_byte(2)        // life
write_byte(40)        // width
write_byte(0)        // noise
write_byte(0)        // r, g, b
write_byte(0)        // r, g, b
write_byte(0)        // r, g, b
write_byte(200)        // brightness
write_byte(200)        // speed
message_end()

// DELIGHT
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
write_byte(27)
write_coord(origin[0])    //pos
write_coord(origin[1])
write_coord(origin[2])
write_byte(10)
write_byte(0)            // r, g, b
write_byte(0)            // r, g, b
write_byte(0)            // r, g, b
write_byte(2)            // life
write_byte(1)            // decay
message_end()

// Sparks
message_begin(MSG_PVSSVC_TEMPENTITY)
write_byte(TE_SPARKS)    // 9
write_coord(aimvec[0])
write_coord(aimvec[1])
write_coord(aimvec[2])
message_end()

// Smoke
message_begin(MSG_BROADCASTSVC_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_BROADCASTSVC_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 == (18))    //decal
    
message_end()
    
}
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1030{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 
this!!! fire_attack(id) add in SH_KEYDOWN

first make sh_set_hero_hpap(gHeroID, 0, pCvarArmor), sh_set_hero_hpap(gHeroID, pCvarHealth, 0) to:

sh_set_hero_hpap(gHeroID, pCvarHealth, pCvarArmor)

and stop making new floats and intergers if you're only using them once... use the cvars instead!!

use this too instead: sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM, true)

i dont think you can use set_user_hero_speed twice and for knife speed do this: sh_set_hero_speed(gHeroID, pCvarKnifeSpeed, {CSW_KNIFE})

and i dont know if it helps but on SH_KEYDOWN add
gUsingLaser[id] = true

and

Code:
        case SH_HERO_ADD:
        {
            gHasUltimater[id] = true
            gPlayerInCooldown[id] = false
            Ultimater_weapons(id)
            switch_model(id)
            }
to:

Code:
        case SH_HERO_ADD:
        {
            gHasUltimater[id] = true
            gPlayerInCooldown[id] = false
            Ultimater_weapons(id)
            switch_model(id)
        }

change attack_effects
(id) to attack_effects(id, aimvec)

change this also: public attack_effects(id) to
public attack_effects(id, aimvec[3])

instead of setting the gravity higher then 1.0 set it lower then 1.0.... the lower the less gravity lik this: 0.4 would give a nice grav...

Last edited by RollerBlades; 06-01-2011 at 14:45.
RollerBlades is offline
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-01-2011 , 15:46   Re: Keydown not working?
Reply With Quote #3

Quote:
Originally Posted by RollerBlades
this!!! fire_attack(id) add in SH_KEYDOWN
That's allready in SH_KEYDOWN

PHP Code:
case SH_KEYDOWN:
        {
            new 
Float:delayTime get_pcvar_float(pCvarMultiShot)
            if ( 
delayTime >= 0.1 )
            {
                
set_task(delayTime"fire_attack"id__"b")
            }
            
            if ( 
gPlayerInCooldown[id] )
            {
                
sh_sound_deny(id)
                return
            }
        } 
Quote:
Originally Posted by RollerBlades
and stop making new floats and intergers if you're only using them once... use the cvars instead!!
Show what i should delete/edit.

Quote:
Originally Posted by RollerBlades
use this too instead: sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM, true)
Where should that be?
Otherwise i understood everything ;)
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-01-2011 , 15:57   Re: Keydown not working?
Reply With Quote #4

yes i know you made a task in sh_keydown with it saying fire_attack but this itself: fire_attack(id) should be there like this:

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 = True
}

well you're only using sh_extra_dmg once in the code so i guess you should know the location of that place since it's your ripped code

and about floats and intergers you dont have to delete them if you ripped the code if your a lazy ass. it just makes the code longer and its unecessary

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

Got the KEYDOWN to work, but now i got a problem about the burn decal..
What the hell is wrong?



The new sma is:

PHP 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 Beam 
new gSmoke
new gBurnDecal

new pCvarDmgpCvarCoolpCvarMultiShotpCvarBurnDecalspCvarHealthpCvarArmorpCvarGravpCvarSpeedpCvarKnifeMultpCvarDeagleMult


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(gHeroNamepCvarLevel)  
    
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(gHeroIDpCvarHealthpCvarArmor)
    
sh_set_hero_grav(gHeroIDpCvarGrav)
    
sh_set_hero_speed(gHeroIDpCvarSpeed)
    
sh_set_hero_dmgmult(gHeroIDpCvarKnifeMultCSW_KNIFE)
    
sh_set_hero_dmgmult(gHeroIDpCvarDeagleMultCSW_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()  
{  
    
Beam precache_model("sprites/shmod/beam.spr"
    
gSmoke precache_model("sprites/steam1.spr")
    
precache_sound(gLaserSound)
    
precache_sound(gReviveSound)
    
precache_model(gUltimaterKnife)
    
precache_model(gUltimaterDeagle)
}   

public 
sh_hero_init(idheroidmode)
{
    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
(idCSW_DEAGLEtrue)
        }
    }
}
public 
sh_hero_key(idheroIDkey)  
{  
    
    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")
            }
            
            if ( 
gPlayerInCooldown[id] )
            {
                
sh_sound_deny(id)
                return
            }
        }
        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(idseconds)
            
            
gUsingLaser[id] = false
        
}
    }
}
public 
sh_client_spawn(id)   
{   
    if (
gHasUltimater[id])  
    {      
        
gPlayerInCooldown[id] = false   
        Ultimater_weapons
(id)
    }  
}   
public 
fire_attack(id)  
{   
    new 
tidtbodydamage  
    
    damage 
get_pcvar_num(pCvarDmg)   
    
    
get_user_aiming(idtidtbody)  
    
    
    
attack_effects(id)
    
    
    if ( 
is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
    {  
        
sh_extra_damage(tididdamage"Ultimater")  
    }
}

public 
attack_effects(id)
{
    new 
aimvec[3]  
    
get_user_origin(idaimvec3
    
    
emit_sound(idCHAN_ITEMgLaserSoundVOL_NORMATTN_NORM0PITCH_NORM)
    
    new 
origin[3]
    
get_user_origin(idorigin1)
    
    
// Beam effect between two points
    
message_begin(MSG_BROADCASTSVC_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(Beam)
    
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_BROADCASTSVC_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_PVSSVC_TEMPENTITY)
    
write_byte(TE_SPARKS)    // 9
    
write_coord(aimvec[0])
    
write_coord(aimvec[1])
    
write_coord(aimvec[2])
    
message_end()
    
    
// Smoke
    
message_begin(MSG_BROADCASTSVC_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_BROADCASTSVC_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 == (28))    //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(id1
        } 
    } 
}

Ultimater_weapons(id

if (
sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    
sh_give_weapon(idCSW_DEAGLE

}

switch_model(id

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

if ( 
get_user_weapon(id) == CSW_KNIFE)  

    
set_pev(idpev_viewmodel2gUltimaterKnife)  


else if ( 
get_user_weapon(id) == CSW_DEAGLE 

    
set_pev(idpev_viewmodel2gUltimaterDeagle

}

public 
sh_client_death(victimattacker)
{
if ( !
sh_is_active() || !sh_is_inround() ) return
if ( !
is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(12) != || 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_RoundRespawnid)

emit_sound(idCHAN_STATICgReviveSound1.0ATTN_NORM0PITCH_NORM)

sh_chat_message(idgHeroID"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


Last edited by MuzzMikkel; 06-01-2011 at 17:51.
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-02-2011 , 04:16   Re: Keydown not working?
Reply With Quote #6

take new aimvec[3]
get_user_origin(id, aimvec, 3
) from public attack_effects(id)

and put them in public fire_attack(id)

then in public attack_effects(id) change to attack_effects(id, aimvec[3])
<<< You dont have to do it but i think it will help.. i have no clue

also reduce the size off the burndecal from 28 to 18..

so try now

like i fucking said!

use this as keydown:


Code:
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 = True
}


change:
sh_extra_damage(tid, id, damage, "Ultimater") in public fire attack(id) to sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM) )

Last edited by RollerBlades; 06-02-2011 at 04:39.
RollerBlades is offline
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-02-2011 , 10:35   Re: Keydown not working?
Reply With Quote #7

Quote:
Originally Posted by RollerBlades View Post
take new aimvec[3]
get_user_origin(id, aimvec, 3
) from public attack_effects(id)

and put them in public fire_attack(id)

then in public attack_effects(id) change to attack_effects(id, aimvec[3])
<<< You dont have to do it but i think it will help.. i have no clue

also reduce the size off the burndecal from 28 to 18..

so try now

like i fucking said!

use this as keydown:


Code:
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 = True
}


change:
sh_extra_damage(tid, id, damage, "Ultimater") in public fire attack(id) to sh_extra_damage(tid, id, damage, "Ultimater", SH_DMG_NORM) )
Still dosent work, it still makes the Bomsite B burn decal
MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 06-02-2011 , 11:45   Re: Keydown not working?
Reply With Quote #8

show me the sma.
RollerBlades is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-02-2011 , 12:02   Re: Keydown not working?
Reply With Quote #9

haha, does it make a B as a burn decal?

Then you obviously are using the wrong decal to print on the wall. Look in cyclops again to see which decal is used.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
MuzzMikkel
Member
Join Date: Aug 2010
Location: Denmark
Old 06-02-2011 , 12:53   Re: Keydown not working?
Reply With Quote #10

Quote:
Originally Posted by Jelle View Post
haha, does it make a B as a burn decal?

Then you obviously are using the wrong decal to print on the wall. Look in cyclops again to see which decal is used.
Still dosent work, help please..

SMA:

PHP 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 Beam 
new gSmoke
new gBurnDecal

new pCvarDmgpCvarCoolpCvarMultiShotpCvarBurnDecalspCvarHealthpCvarArmorpCvarGravpCvarSpeedpCvarKnifeMultpCvarDeagleMult


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""750")
    
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(gHeroNamepCvarLevel)  
    
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(gHeroIDpCvarHealthpCvarArmor)
    
sh_set_hero_grav(gHeroIDpCvarGrav)
    
sh_set_hero_speed(gHeroIDpCvarSpeed)
    
sh_set_hero_dmgmult(gHeroIDpCvarKnifeMultCSW_KNIFE)
    
sh_set_hero_dmgmult(gHeroIDpCvarDeagleMultCSW_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()  
{  
    
Beam precache_model("sprites/shmod/beam.spr"
    
gSmoke precache_model("sprites/steam1.spr")
    
precache_sound(gLaserSound)
    
precache_sound(gReviveSound)
    
precache_model(gUltimaterKnife)
    
precache_model(gUltimaterDeagle)
}   

public 
sh_hero_init(idheroidmode)
{
    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
(idCSW_DEAGLEtrue)
        }
    }
}

public 
sh_hero_key(idheroIDkey)  
{  
    
    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(idseconds)
            
            
gUsingLaser[id] = false
        
}
    }
}

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

public 
fire_attack(id)  
{   
    new 
tidtbodydamage  
    
    damage 
get_pcvar_num(pCvarDmg)   
    
    
get_user_aiming(idtidtbody)  
    
    
    
attack_effects(id)
    
    
    if ( 
is_user_alive(tid) && (cs_get_user_team(id) != cs_get_user_team(tid) || sh_friendlyfire_on()) )  
    {  
        
sh_extra_damage(tididdamage"Ultimater")  
    }    
}  

public 
attack_effects(id)
{
    new 
aimvec[3]  
    
get_user_origin(idaimvec3
    
    
emit_sound(idCHAN_ITEMgLaserSoundVOL_NORMATTN_NORM0PITCH_NORM)
    
    new 
origin[3]
    
get_user_origin(idorigin1)
    
    
// Beam effect between two points
    
message_begin(MSG_BROADCASTSVC_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(Beam)
    
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()
    
    
// Sparks
    
message_begin(MSG_PVSSVC_TEMPENTITY)
    
write_byte(TE_SPARKS)    // 9
    
write_coord(aimvec[0])
    
write_coord(aimvec[1])
    
write_coord(aimvec[2])
    
message_end()
    
    
// Smoke
    
message_begin(MSG_BROADCASTSVC_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_BROADCASTSVC_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 == (18))    //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(id1
        } 
    } 
}

Ultimater_weapons(id

if (
sh_is_active() && is_user_alive(id) && gHasUltimater[id] ) 
{  
    
sh_give_weapon(idCSW_DEAGLE

}

switch_model(id

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

if ( 
get_user_weapon(id) == CSW_KNIFE)  

    
set_pev(idpev_viewmodel2gUltimaterKnife)  


else if ( 
get_user_weapon(id) == CSW_DEAGLE 

    
set_pev(idpev_viewmodel2gUltimaterDeagle

}

public 
sh_client_death(victimattacker)
{
if ( !
sh_is_active() || !sh_is_inround() ) return
if ( !
is_user_connected(victim) || is_user_alive(victim) || !gHasUltimater[victim] || random_num(12) != || 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_RoundRespawnid)

emit_sound(idCHAN_STATICgReviveSound1.0ATTN_NORM0PITCH_NORM)

sh_chat_message(idgHeroID"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

MuzzMikkel is offline
Send a message via MSN to MuzzMikkel
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 00:51.


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