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

Player model question


Post New Thread Reply   
 
Thread Tools Display Modes
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-01-2012 , 16:50   Re: Player model question
Reply With Quote #31

I can see why you have problems with the gun model, it should work now.
I have tried to make pcvars instead of normal cvars for the arrow cvar. Remember it is case sensitive, which means the cvars now are:

Code:
Noob_level 10
Noob_arrows 3
Noob_getdeagle 1
Remember that N is higher case, not lower case as you write it.

PHP Code:
#include <superheromod>

//basic hero stuff
new gHeroID
new gHasNoob[SH_MAXSLOTS+1]

//sprites
new laser
new laser_impact
new blast_shroom

//shots
new Noobs[SH_MAXSLOTS+1]

//test?f
new gLastWeapon[SH_MAXSLOTS+1]
new 
gLastClipCount[SH_MAXSLOTS+1]

//playermodel
new const gPlayerModel[] = "models/player/Noob/Noob.mdl"

//gun models
new const gvWeapon[] = "models/shmod/Noob_v.mdl"
new const gpWeapon[] = "models/shmod/Noob_p.mdl"

//cvars
new pcvarShots
new pcvarGetDeagle

public plugin_init()
{
    
register_plugin("SUPERHERO Noob w/models""1337""Jelle")
    
    new 
pcvarLevel register_cvar("Noob_level""10")
    
pcvarShots register_cvar("Noob_arrows""3")
    
pcvarGetDeagle register_cvar("Noob_getdeagle""1")
    
    
gHeroID sh_create_hero("Noob"pcvarLevel)
    
sh_set_hero_info(gHeroID"exploding deagle shots""Get a deagle with exploding shots")
    
    
//register new round
    
register_event("ResetHUD","newRound","b")
    
    
//register damage event
    
register_event("Damage""Noob_damage""b""2!0")
    
    
//register when someone shoots or changes weapon etc
    
register_event("CurWeapon""weapon_change""be""1=1")
}

public 
plugin_precache()
{
    
laser precache_model("sprites/laserbeam.spr")
    
laser_impact precache_model("sprites/zerogxplode.spr")
    
blast_shroom precache_model("sprites/mushroom.spr")
    
precache_model(gvWeapon)
    
precache_model(gpWeapon)
    
precache_model(gPlayerModel)
}

public 
sh_hero_init(idheroIDmode)
{
    if ( 
gHeroID != heroID ) return
    
    if ( 
mode == SH_HERO_ADD )
    {
        
gHasNoob[id] = true
        set_playermodel
(id)
        
switch_model(id)
        
give_gun(id)
    }
    
    else if ( 
mode == SH_HERO_DROP )
    {
        
gHasNoob[id] = false
        unset_playermodel
(id)
        
        if ( 
is_user_alive(id) )
        {
            
sh_drop_weapon(idCSW_DEAGLEtrue)
        }
    }
}

public 
sh_client_death(victim)
{
    if ( 
gHasNoob[victim] )
    {
        
unset_playermodel(victim)
    }
}

public 
sh_client_spawn(id)
{
    if ( 
gHasNoob[id] )
    {
        
set_playermodel(id)
        
give_gun(id)
    }
}

give_gun(id)
{
    if ( 
gHasNoob[id] && is_user_alive(id) )
    {
        
sh_give_weapon(idCSW_DEAGLE)
    }
}

public 
newRound(id)
{
if ( 
gHasNoob[id] )
{
    
Noobs[id] = get_pcvar_num(pcvarShots)
    
gLastWeapon[id] = -1  // I think the change Weapon automatically gets called on spawn death too...
    
    
if ( get_pcvar_num(pcvarGetDeagle) == )
    {
        
shGiveWeapon(id,"weapon_deagle")
    }
}
}

public 
Noob_damage(id)
{
    new 
damage read_data(2)
    new 
weaponbodypartattacker get_user_attacker(id,weapon,bodypart)
    
    if ( 
attacker || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE
    
    
if ( gHasNoob[attacker] && weapon == CSW_DEAGLE && is_user_alive(id) )
    {
        
switch_model(attacker)
        
        if ( 
Noobs[attacker] >= )
        {
            new 
health get_user_health(id)
            
            
// damage is less than 10%
            
if ( ( (1.0 damage) / (1.0 * (health damage) ) ) < 0.01 ) return PLUGIN_CONTINUE
            
            
new origin[3]
            
get_user_origin(idorigin)
            
            
// player fades..
            
set_user_rendering(idkRenderFxFadeSlow255255255kRenderTransColor4);
            
            
// beeeg explody!
            
message_begin(MSG_ALLSVC_TEMPENTITY)
            
write_byte(3)            // TE_EXPLOSION
            
write_coord(origin[0])
            
write_coord(origin[1])
            
write_coord(origin[2]-22)
            
write_short(blast_shroom)    // mushroom cloud
            
write_byte(40)            // scale in 0.1's
            
write_byte(12)            // frame rate
            
write_byte(12)            // TE_EXPLFLAG_NOPARTICLES & TE_EXPLFLAG_NOSOUND
            
message_end()
            
            
// do turn down that awful racket..to be replaced by a blood spurt!
            
message_begin(MSG_ALLSVC_TEMPENTITY)
            
write_byte(10)    // TE_LAVASPLASH
            
write_coord(origin[0])
            
write_coord(origin[1])
            
write_coord(origin[2]-26)
            
message_end()
            
            
// kill victim
            
user_kill(id1)
            
            
message_beginMSG_ALLget_user_msgid("DeathMsg"),{0,0,0},)
            
write_byte(attacker)
            
write_byte(id)
            
write_byte(0)
            
write_string("deagle")
            
message_end()
            
            
//Save Hummiliation
            
new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]
            
            
//Info On Attacker
            
get_user_name(attacker,namea,23)
            
get_user_team(attacker,teama,7)
            
get_user_authid(attacker,authida,19)
            
            
//Info On Victim
            
get_user_name(id,namev,23)
            
get_user_team(id,teamv,7)
            
get_user_authid(id,authidv,19)
            
            
//Log This Kill
            
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"Green Arrow^"",
            
namea,get_user_userid(attacker),authida,teama,namev,get_user_userid(id),authidv,teamv)
            
            
// team check!
            
new attacker_team[2], victim_team[2]
            
get_user_team(attackerattacker_team1)
            
get_user_team(idvictim_team1)
            
            
// for some reason this doesn't update in the hud until the next round.. whatever.
            
if (!equali(attacker_teamvictim_team))
            {
                
// diff. team;    $attacker gets credited for the kill and $250 and XP.
                //        $id gets their suicidal -1 frag back.
                
set_user_frags(attackerget_user_frags(attacker)+1)
                
                
cs_set_user_money(attackercs_get_user_money(attacker)+150)
                
                
sh_add_kill_xp(attackerid1.0)
            }
            
            else
            {
                
// same team;    $attacker loses a frag and $500 and XP.
                
set_user_frags(attackerget_user_frags(attacker)-1)
                
                
cs_set_user_money(attackercs_get_user_money(attacker)-5000)
                
                
sh_add_kill_xp(attackerid, -1.0)
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
Noob_fire(id)
{
    
    if ( !
gHasNoob[id] ) return PLUGIN_CONTINUE
    
    
new weap read_data(2)        // id of the weapon
    
new ammo read_data(3)        // ammo left in clip
    
    
if ( weap == CSW_DEAGLE && is_user_alive(id) )
    {
        
switch_model(id)
            
        if (
gLastWeapon[id] == 0gLastWeapon[id] = weap
        
        
if ( gLastClipCount[id] > ammo && gLastWeapon[id] == weap && Noobs[id] > )
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; where you are
            
get_user_origin(idvec24// termina; where your bullet goes
            
            // tracer beam
            
message_begin(MSG_PASSVC_TEMPENTITYvec1)
            
write_byte(0)        // TE_BEAMPOINTS
            
write_coord(vec1[0])
            
write_coord(vec1[1])
            
write_coord(vec1[2])
            
write_coord(vec2[0])
            
write_coord(vec2[1])
            
write_coord(vec2[2])
            
write_short(laser)    // laserbeam sprite
            
write_byte(0)        // starting frame
            
write_byte(10)        // frame rate
            
write_byte(2)        // life in 0.1s
            
write_byte(4)        // line width in 0.1u
            
write_byte(1)        // noise in 0.1u
            
write_byte(0)        // red
            
write_byte(153)        // green
            
write_byte(0)        // blue
            
write_byte(80)        // brightness
            
write_byte(100)        // scroll speed
            
message_end()
            
            
// bullet impact explosion
            
message_begin(MSG_PASSVC_TEMPENTITYvec2)
            
write_byte(3)        // TE_EXPLOSION
            
write_coord(vec2[0])    // end point of beam
            
write_coord(vec2[1])
            
write_coord(vec2[2])
            
write_short(laser_impact)    // blast sprite
            
write_byte(10)            // scale in 0.1u
            
write_byte(30)            // frame rate
            
write_byte(8)            // TE_EXPLFLAG_NOPARTICLES
            
message_end()            // ..unless i'm mistaken, noparticles helps avoid a crash
            
            
Noobs[id]--
            
            new 
message[128]
            
format(message127"You Have %d arrow(s) left",Noobs[id])
            
set_hudmessage(255,0,0,-1.0,0.3,0,0.25,1.0,0.0,0.0,4)
            
show_hudmessage(idmessage)
            
            if ( 
Noobs[id] == Noobs[id] = -1
        
}
        
        
gLastClipCount[id] = ammo
        gLastWeapon
[id] = weap
    
}
    return 
PLUGIN_CONTINUE
}

public 
weapon_change(id)
{
    if ( !
sh_is_active() || !gHasNoob[id] ) return
    
    new 
weaponID read_data(2)
    if (
weaponID != CSW_DEAGLE) return
    
    
switch_model(id)
    
    if (
read_data(3) == 0)
    {
        
sh_reload_ammo(id1)
    }
}

switch_model(id)
{
    if ( !
is_user_alive(id) || !gHasNoob[id] ) return
    
    if ( 
get_user_weapon(id) == CSW_DEAGLE )
    {
        
set_pev(idpev_viewmodel2gvWeapon)
        
set_pev(idpev_weaponmodel2gpWeapon)
    }
}    

set_playermodel(id)
{
    if ( 
is_user_alive(id) && gHasNoob[id] )
    {
        
cs_set_user_model(id"Noob")
    }
}

unset_playermodel(id)
{
    
cs_reset_user_model(id)

__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 11-02-2012 , 03:36   Re: Player model question
Reply With Quote #32

Thanks,now the gun model work's fine...but I still can't set a limit for arrows.
I use Noob and Punisher and with any bullet I can kill anyone with one shot.

L.E:
Maybe this will hep you...
Code:
L 11/02/2012 - 09:31:32: Invalid player id 0
L 11/02/2012 - 09:31:32: [AMXX] Run time error 10 (plugin "sh_noob.amxx") (native "get_user_attacker") - debug not enabled!
L 11/02/2012 - 09:31:32: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
It's the same think if I use debug or no...

Last edited by Bladell; 11-02-2012 at 03:42.
Bladell is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2012 , 09:23   Re: Player model question
Reply With Quote #33

The error you are describing is just because it is trying to get the attacking of ID 0, which is the server, and since the server can't die and be attacked it can't find the attacker since there is none.

Its just a cosmetic error and shouldn't affect the hero itself in any way.

Did you make sure that you are using the right higher/lower case letters in the cvars you are setting arrows with?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 11-02-2012 , 09:24   Re: Player model question
Reply With Quote #34

Yes,I'm 100% sure.

Can you add a model to Green Arrow...that hero do the same thing like Noob.

Last edited by Bladell; 11-02-2012 at 09:29.
Bladell is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2012 , 09:29   Re: Player model question
Reply With Quote #35

You can change this line:

PHP Code:
pcvarShots register_cvar("Noob_arrows""3"
The "3" is the number of arrows, it can be found almost at the top of the code (in plugin_init)

Change it to "5" to get 5 arrows etc.

Set it to what you want, do you still only get 3 arrows?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 11-02-2012 , 09:45   Re: Player model question
Reply With Quote #36

Nope...
I use your last posted .sma.
Code:
  pcvarShots = register_cvar("Noob_arrows", "3")
.
So,if this cvar would worked the max arrows woul be 3.But as I tell you,I can shot how much I want and I kill anyone with one shot.
Bladell is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2012 , 10:00   Re: Player model question
Reply With Quote #37

So you have unlimited noob shots?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Bladell
Senior Member
Join Date: Jun 2012
Old 11-02-2012 , 15:17   Re: Player model question
Reply With Quote #38

Yes,yes.
Bladell is offline
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 03:02.


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