Raised This Month: $32 Target: $400
 8% 

Hey I need some help with 1. time scripting =)


Post New Thread Reply   
 
Thread Tools Display Modes
jacker
Junior Member
Join Date: Apr 2008
Old 09-01-2010 , 07:38   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #11

Hey after using Jelle's TUT and compiling the .sma I ran into another problem
it doesn't give deagle on spawn or at choocing... though it gives M4A1
it doesn't give speed when u pull ur M4A1 out, but if u buy a DEagle u get the speed bonus...
it doesn't give any models, player, M4A1 & DEagle...

atm. I can't think of other issues I've encountered...
so, can any of u out there plz help me ? =)
PHP Code:
/* CVARS - copy and paste to shconfig.cfg
//Soldat
Soldat_level 1
Soldat_health 1000  //Hvor meget liv du får (normal 100)
Soldat_armor 200  //Hvor meget pansring du får (normal 0)
Soldat_gravity 0.25  //Hvor højt du kan hoppe (normal 1.0)
Soldat_speed 750  //Hvor hurtigt du kan løbe (normal 400)
Soldat_mult 2.5   //Hvor mange % din skade bliver (normal 1=100%)
*/
#include<superheromod>  
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Soldat" //creates a string varr to hold the hero name
new bool:gHasSuperPower[SH_MAXSLOTS+1//creates a varr with an aray, with 1 slot per player  
new const gSuperPlayer[] = "models/player/Soldat/PLAYER_MODEL.mdl"
new const gSuperWeapon[] = "models/player/Soldat/v_m4a1.mdl"
new const gSuperWeapon2[] = "models/player/Soldat/v_deagle.mdl"
public plugin_init()
{
    
//This registers the plugin with amx mod x. This is what is shown when you type amx_plugins in console
    
register_plugin("SUPERHERO Soldat""1.2""Soldateen")
    new 
pcvarLevel register_cvar("Soldat_level""0")
    new 
pcvarHealth register_cvar("Soldat_health""1000")
    new 
pcvarArmor register_cvar("Soldat_armor""200")
    new 
pcvarGrav register_cvar("Soldat_grav""0.25")
    new 
pcvarSpeed register_cvar("Soldat_speed""750")
    new 
pcvarMult register_cvar("Soldat_mult""5")
    
register_event("CurWeapon""weapon_change""be""1=1")
 
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)    
    
sh_set_hero_info(gHeroID"Du er nu blevet en æret soldat""Du er nu blevet uddannet soldat, gå i krig med dine nye våben og kom hjem med ære!")
    
sh_set_hero_hpap(gHeroIDpcvarHealth0)
    
sh_set_hero_hpap(gHeroID0pcvarArmor)
    
sh_set_hero_grav(gHeroIDpcvarGrav)
    
sh_set_hero_speed(gHeroIDpcvarSpeed, {CSW_M4A1}, 1)
    
sh_set_hero_speed(gHeroIDpcvarSpeed, {CSW_DEAGLE}, 1)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_M4A1)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_DEAGLE)
 
    
//if you were used to the old method you will notice that there is no need to register the init anymore therefor nothing more is required
}
public 
sh_hero_init(idheroIDmode)
{
    
//if no power return
    
if (gHeroID != heroID) return
 
    
//This is what runs when someone drops or picks the hero
    
switch(mode)
    {
        
//if the hero is added
        
case SH_HERO_ADD:
        {
            
//it is true that client has the hero
            
gHasSuperPower[id] = true
     super_morph
(id)
     
super_weapon(id)
        }
        
//if the hero is dropped
        
case SH_HERO_DROP:
        {
            
//it is false that the client has the hero
            
gHasSuperPower[id] = false
     super_unmorph
(id)
     if (
is_user_alive(id))
            {
      
sh_drop_weapon(idCSW_M4A1true)
  
sh_drop_weapon(idCSW_DEAGLEtrue)
    }
        }
    }
}
public 
plugin_precache()
{
precache_model(gSuperPlayer)
}
public 
sh_client_spawn(id)
{
 if (
gHasSuperPower[id])
    {
     
super_morph(id)
 
super_weapon(id)
    }
}
super_morph(id)
{
 
cs_set_user_model(id"Soldat")
}
super_unmorph(id)
{
 
cs_reset_user_model(id)
}  
super_weapon(id)
{
 if (
shModActive() && is_user_alive(id) && gHasSuperPower[id] )
    {
     
sh_give_weapon(idCSW_M4A1)
    }
}
public 
weapon_change(id)
{
 if ( !
sh_is_active() || !gHasSuperPower[id] ) return
 new 
weaponID read_data(2)
 {
  
sh_reload_ammo(id1)
 }
}
switch_model(id)
{
 if (!
shModActive() || !is_user_alive(id) || !gHasSuperPower[id] ) return
 if (
get_user_weapon(id) == CSW_M4A1)
 {
  
set_pev(idpev_viewmodel2gSuperWeapon)
 }
 if (
get_user_weapon(id) == CSW_DEAGLE)
 {
    
set_pev(idpev_viewmodel2gSuperWeapon)
 }

- Jacker

btw, don't mind the Danish lang in there, I'm just gonna use it on a LAN server with some of my friends =)

Last edited by jacker; 09-01-2010 at 07:40.
jacker is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-01-2010 , 12:41   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #12

Playermodel issue:

PHP Code:
new const gSuperPlayer[] = "models/player/Soldat/PLAYER_MODEL.mdl"

super_morph(id)
{
    
cs_set_user_model(id"Soldat")

You type the name of the model, which is your case is "PLAYER_MODEL.mdl", so in cs_set_user_model() it should be "PLAYER_MODEL", and not Soldat.

PHP Code:
sh_set_hero_hpap(gHeroIDpcvarHealth0)
sh_set_hero_hpap(gHeroID0pcvarArmor
As explained in the tutorial, these two can be merged together. See the natives name "hpap", meaning both HP and AP. ALLOT of people is constantly mistaken about this, I really don't know why. Read the comment I made for it in the tutorial again, and try to understand it. This is how you merge them:

PHP Code:
sh_set_hero_hpap(gHeroIDpcvarHealthpcvarArmor
But please, if you are confused by this, read the comment once again.

As I told you, make the speed as an array, like this:

PHP Code:
new gWeapons[3] = {
     
CSW_M4A1,
     
CSW_DEAGLE
}

public 
plugin_init()
{
     
sh_set_hero_speed(gHeroIDpcvarSpeedgWeapons2)

PHP Code:
super_weapon(id)
{
    if (
shModActive() && is_user_alive(id) && gHasSuperPower[id] )
    {
        
sh_give_weapon(idCSW_M4A1)
    }

This is why you are not getting the deagle. Add a native more to give you the deagle.

PHP Code:
public weapon_change(id)
{
    if ( !
sh_is_active() || !gHasSuperPower[id] ) return
    new 
weaponID read_data(2)
    {
        
sh_reload_ammo(id1)
    }

The unlimited ammo MUST be screwed up, this is also why your gun models is screwed up. This is how it should be:

PHP Code:
public weapon_change(id)
{
    if ( !
sh_is_active() || !gHasSuperPower[id] ) return
    new 
weaponID read_data(2)
    
    if ( 
weaponID != CSW_M4A1 || weaponID != CSW_DEAGLE ) return
    
    
switch_model(id)
    
    if ( 
read_data(3) == )
    {
        
sh_reload_ammo(id1)
    }

Take a good look at it, and notice the difference.

Last, and least, you need to run the forward "switch_model" when the hero is added. This ensures, that if you pick the hero, and have M4A1, or deagle out, you still get the weapon model, without the need to change the weapons, so add switch_model(id) in SH_HERO_ADD, like this:

PHP Code:
        case SH_HERO_ADD:
        {
            
//it is true that client has the hero
            
gHasSuperPower[id] = true
            super_morph
(id)
            
super_weapon(id)
            
switch_model(id)
        } 
Try that and see what happens.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 09-01-2010 , 14:52   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #13

Quote:
Originally Posted by Jelle View Post
Playermodel issue:

PHP Code:
new const gSuperPlayer[] = "models/player/Soldat/PLAYER_MODEL.mdl"

super_morph(id)
{
    
cs_set_user_model(id"Soldat")

models/player/Soldat/PLAYER_MODEL.mdl



models/player/Soldat/Soldat.mdl

or

models/player/PLAYER_MODEL/PLAYER_MODEL.mdl

cs_set_user_model(id, "PLAYER_MODEL")
__________________
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 09-01-2010 , 15:56   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #14

PHP Code:
switch_model(id)
{
 if (!
shModActive() || !is_user_alive(id) || !gHasSuperPower[id] ) return
 if (
get_user_weapon(id) == CSW_M4A1)
 {
  
set_pev(idpev_viewmodel2gSuperWeapon)
 }
 if (
get_user_weapon(id) == CSW_DEAGLE)
 {
    
set_pev(idpev_viewmodel2gSuperWeapon)
 }

You used gSuperWeapon twice. Meaning, if they switch to deagle, they would get the M4A1 model.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
jacker
Junior Member
Join Date: Apr 2008
Old 09-02-2010 , 13:39   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #15

Hey again =)
maybe it's just me who totally suck to do this :S

but I can't get the models( weapon & player ) or the unlimited ammo to work

btw, can i from fpsbanana just download a skin for fx. l33t and then use it as a hero model ?
cuz, that's what i've done..

PHP Code:
/* CVARS - copy and paste to shconfig.cfg
//Soldat
Soldat_level 1
Soldat_health 1000  //Hvor meget liv du får (normal 100)
Soldat_armor 200  //Hvor meget pansring du får (normal 0)
Soldat_gravity 0.25  //Hvor højt du kan hoppe (normal 1.0)
Soldat_speed 750  //Hvor hurtigt du kan løbe (normal 400)
Soldat_mult 2.5   //Hvor mange % din skade bliver (normal 1=100%)
*/
#include<superheromod>  
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Soldat" //creates a string varr to hold the hero name
new bool:gHasSuperPower[SH_MAXSLOTS+1//creates a varr with an aray, with 1 slot per player  
new const gSuperPlayer[] = "models/player/Soldat/PLAYER_MODEL.mdl"
new const gSuperWeapon[] = "models/player/Soldat/v_m4a1.mdl"
new const gSuperWeapon2[] = "models/player/Soldat/v_deagle.mdl"
public plugin_init()
{
    
//This registers the plugin with amx mod x. This is what is shown when you type amx_plugins in console
    
register_plugin("SUPERHERO Soldat""1.2""Soldateen")
    new 
pcvarLevel register_cvar("Soldat_level""0")
    new 
pcvarHealth register_cvar("Soldat_health""1000")
    new 
pcvarArmor register_cvar("Soldat_armor""200")
    new 
pcvarGrav register_cvar("Soldat_grav""0.25")
    new 
pcvarSpeed register_cvar("Soldat_speed""750")
    new 
pcvarMult register_cvar("Soldat_mult""2.5")
    new 
gWeapons[3] = 
    {
     
CSW_M4A1,
 
CSW_DEAGLE
    
}
    
register_event("CurWeapon""weapon_change""be""1=1")
    
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)    
    
sh_set_hero_info(gHeroID"Du er nu blevet en æret soldat""Du er nu blevet uddannet soldat, gå i krig med dine nye våben og kom hjem med ære!")
    
sh_set_hero_hpap(gHeroIDpcvarHealthpcvarArmor)
    
sh_set_hero_grav(gHeroIDpcvarGrav)
    
sh_set_hero_speed(gHeroIDpcvarSpeedgWeapons2)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_M4A1)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_DEAGLE)
    
    
//if you were used to the old method you will notice that there is no need to register the init anymore therefor nothing more is required
}
public 
sh_hero_init(idheroIDmode)
{
    
//if no power return
    
if (gHeroID != heroID) return
    
    
//This is what runs when someone drops or picks the hero
    
switch(mode)
    {
        
//if the hero is added
        
case SH_HERO_ADD:
        {
            
//it is true that client has the hero
            
gHasSuperPower[id] = true
     super_morph
(id)
     
super_weapon(id)
     
switch_model(id)
        }
        
//if the hero is dropped
        
case SH_HERO_DROP:
        {
            
//it is false that the client has the hero
            
gHasSuperPower[id] = false
     super_unmorph
(id)
     if (
is_user_alive(id))
            {
      
sh_drop_weapon(idCSW_M4A1true)
  
sh_drop_weapon(idCSW_DEAGLEtrue)
    }
        }
    }
}
public 
plugin_precache()
{
precache_model(gSuperPlayer)
}
public 
sh_client_spawn(id)
{
 if (
gHasSuperPower[id])
    {
     
super_morph(id)
 
super_weapon(id)
    }
}
super_morph(id)
{
 
cs_set_user_model(id"PLAYER_MODEL")
}
super_unmorph(id)
{
 
cs_reset_user_model(id)
}  
super_weapon(id)
{
 if (
shModActive() && is_user_alive(id) && gHasSuperPower[id] )
    {
     
sh_give_weapon(idCSW_M4A1)
 
sh_give_weapon(idCSW_DEAGLE)
    }
}
public 
weapon_change(id)
{
    if ( !
sh_is_active() || !gHasSuperPower[id] ) return
    new 
weaponID read_data(2)
    
    if ( 
weaponID != CSW_M4A1 || weaponID != CSW_DEAGLE ) return
    
    
switch_model(id)
    
    if ( 
read_data(3) == )
    {
        
sh_reload_ammo(id1)
    }
}  
switch_model(id)
{
 if (!
shModActive() || !is_user_alive(id) || !gHasSuperPower[id] ) return
 if (
get_user_weapon(id) == CSW_M4A1)
 {
  
set_pev(idpev_viewmodel2gSuperWeapon)
 }
 if (
get_user_weapon(id) == CSW_DEAGLE)
 {
    
set_pev(idpev_viewmodel2gSuperWeapon2)
 }

any ideas ? =)
jacker is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-02-2010 , 15:25   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #16

PHP Code:
new gWeapons[3] = {
     
CSW_M4A1,
     
CSW_DEAGLE
}

public 
plugin_init()
{
     
sh_set_hero_speed(gHeroIDpcvarSpeedgWeapons2)

</SPAN></SPAN>

I made the array OUTSIDE of plugin_init, not inside. I am not actually sure if that has anything to do with it.

PHP Code:
public plugin_precache()
{
precache_model(gSuperPlayer)

</SPAN>

You didn't precache the models you are using, only the playermodel.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
jacker
Junior Member
Join Date: Apr 2008
Old 09-03-2010 , 09:17   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #17

Models & unl. ammo still ain't working

PHP Code:
/* CVARS - copy and paste to shconfig.cfg
//Soldat
Soldat_level 1
Soldat_health 1000  //Hvor meget liv du får (normal 100)
Soldat_armor 200  //Hvor meget pansring du får (normal 0)
Soldat_gravity 0.25  //Hvor højt du kan hoppe (normal 1.0)
Soldat_speed 750  //Hvor hurtigt du kan løbe (normal 400)
Soldat_mult 2.5   //Hvor mange % din skade bliver (normal 1=100%)
*/
#include<superheromod>  
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Soldat" //creates a string varr to hold the hero name
new bool:gHasSuperPower[SH_MAXSLOTS+1//creates a varr with an aray, with 1 slot per player  
new const gSuperPlayer[] = "models/player/Soldat/PLAYER_MODEL.mdl"
new const gSuperWeapon[] = "models/player/Soldat/v_m4a1.mdl"
new const gSuperWeapon2[] = "models/player/Soldat/v_deagle.mdl"
new gWeapons[3] = 
    {
     
CSW_M4A1,
 
CSW_DEAGLE
    
}
public 
plugin_init()
{
    
//This registers the plugin with amx mod x. This is what is shown when you type amx_plugins in console
    
register_plugin("SUPERHERO Soldat""1.2""Soldateen")
    new 
pcvarLevel register_cvar("Soldat_level""0")
    new 
pcvarHealth register_cvar("Soldat_health""1000")
    new 
pcvarArmor register_cvar("Soldat_armor""200")
    new 
pcvarGrav register_cvar("Soldat_grav""0.25")
    new 
pcvarSpeed register_cvar("Soldat_speed""750")
    new 
pcvarMult register_cvar("Soldat_mult""5")
    
register_event("CurWeapon""weapon_change""be""1=1")
    
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)    
    
sh_set_hero_info(gHeroID"Du er nu blevet en æret soldat""Du er nu blevet uddannet soldat, gå i krig med dine nye våben og kom hjem med ære!")
    
sh_set_hero_hpap(gHeroIDpcvarHealthpcvarArmor)
    
sh_set_hero_grav(gHeroIDpcvarGrav)
    
sh_set_hero_speed(gHeroIDpcvarSpeedgWeapons2)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_M4A1)
    
sh_set_hero_dmgmult(gHeroIDpcvarMultCSW_DEAGLE)
    
    
//if you were used to the old method you will notice that there is no need to register the init anymore therefor nothing more is required
}
public 
sh_hero_init(idheroIDmode)
{
    
//if no power return
    
if (gHeroID != heroID) return
    
    
//This is what runs when someone drops or picks the hero
    
switch(mode)
    {
        
//if the hero is added
        
case SH_HERO_ADD:
        {
            
//it is true that client has the hero
            
gHasSuperPower[id] = true
     super_morph
(id)
     
super_weapon(id)
     
switch_model(id)
        }
        
//if the hero is dropped
        
case SH_HERO_DROP:
        {
            
//it is false that the client has the hero
            
gHasSuperPower[id] = false
     super_unmorph
(id)
     if (
is_user_alive(id))
            {
      
sh_drop_weapon(idCSW_M4A1true)
  
sh_drop_weapon(idCSW_DEAGLEtrue)
    }
        }
    }
}
public 
plugin_precache()
{
precache_model(gSuperPlayer)
precache_model(gSuperWeapon)
precache_model(gSuperWeapon2)
}
public 
sh_client_spawn(id)
{
 if (
gHasSuperPower[id])
    {
     
super_morph(id)
 
super_weapon(id)
    }
}
super_morph(id)
{
 
cs_set_user_model(id"PLAYER_MODEL")
}
super_unmorph(id)
{
 
cs_reset_user_model(id)
}  
super_weapon(id)
{
 if (
shModActive() && is_user_alive(id) && gHasSuperPower[id] )
    {
     
sh_give_weapon(idCSW_M4A1)
 
sh_give_weapon(idCSW_DEAGLE)
    }
}
public 
weapon_change(id)
{
    if ( !
sh_is_active() || !gHasSuperPower[id] ) return
    new 
weaponID read_data(2)
    
    if ( 
weaponID != CSW_M4A1 || weaponID != CSW_DEAGLE ) return
    
    
switch_model(id)
    
    if ( 
read_data(3) == )
    {
        
sh_reload_ammo(id1)
    }
}  
switch_model(id)
{
 if (!
shModActive() || !is_user_alive(id) || !gHasSuperPower[id] ) return
 if (
get_user_weapon(id) == CSW_M4A1)
 {
  
set_pev(idpev_viewmodel2gSuperWeapon)
 }
 if (
get_user_weapon(id) == CSW_DEAGLE)
 {
    
set_pev(idpev_viewmodel2gSuperWeapon2)
 }

jacker is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-03-2010 , 15:37   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #18

Are you sure you have even picked that hero? It seems like you haven't, as I really can't see anything wrong with the code.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 09-03-2010 , 16:03   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #19

Try changing gHasSuperPower to gHasSoldat and change super_******* to soldat_******** instead. I can't figure out why it helped but it have helped for me (I didnt try with this code). I might have changed something else when I did it aswell, but it's worth a shot.
__________________
Jelle (1): I LOVE YOU
Jelle (1): Yeah. omg you are so awesome!
--------------
Jelle (1): You know when a poo is about to exit but it is too big?
Jelle (1): God my ass still hurts
Exploited is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 09-03-2010 , 16:55   Re: Hey I need some help with 1. time scripting =)
Reply With Quote #20

Exploited, that would make no difference whatsoever.
He should overlook his checks in weapon_change and actually read what I said in my last post. Then it'll work.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
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 23:19.


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