View Single Post
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