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

compile error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucianomc
New Member
Join Date: Jul 2014
Old 09-04-2014 , 15:20   compile error
Reply With Quote #1

hello i was trying to do a hero but wen i compile it i get this error



and here is my sma

Code:
#include<superheromod>

new gHeroID
new const gHeroName[] = "Odst"
new bool:gHasOdstPower[SH_MAXSLOTS+1]
new const gOdstPlayer[] = "models/player/Odst/Odst.mdl"
new const gOdstWeapon[] = "models/shmod/odst_usp_v.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 Odst", "1.0", "Lucianomc")
register_event("CurWeapon", "weapon_change", "be", "1=1")

//now we register the cvars
//you can make the "pcvarLevel" to what ever you want, but make sure it matches this each time you use it
new pcvarLevel = register_cvar("Odst_level", "0") //this is what level the hero should be avalible at
new pcvarHealth = register_cvar("Odst_health", "150")
new pcvarArmor = register_cvar("Odst_armor", "200")
new pcvarGrav = register_cvar("Odst_grav", "1.0")
new pcvarMult = register_cvar("Odst._uspmult", "5")

//This is what creates the hero remember the pcvarLevel is pointing at the level for the hero
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
//This is setting the hero info. It pretty much explains itself
sh_set_hero_info(gHeroID, "gives a usp model and a halo 3 odst armor", "...")
sh_set_hero_hpap(gHeroID, pcvarHealth, 0)
sh_set_hero_hpap(gHeroID, 0, pcvarArmor)
sh_set_hero_grav(gHeroID, pcvarGrav)
sh_set_hero_dmgmult(gHeroID, pcvarMult, CSW_USP)


//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(id, heroID, mode)
{
//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
gHasOdstPower[id] = true
Odst_morph(id)
Odst_weapon(id)
switch_model(id)
}
//if the hero is dropped
case SH_HERO_DROP:
{
//it is false that the client has the hero
gHasOdstPower[id] = false
//this is also new.
//If the client has the hero and then drops it, we want to take his playermodel from him so we go to super_unmorph and do that there
//same here this only runs when the user drops the hero
Odst_unmorph(id)
if (is_user_alive(id))
{

sh_drop_weapon(id, USP, true)
}
}
} 

//we need to precache the playermodel before we can use it (this means the client has to download it or he will not be able to see it
public plugin_precache()
{
//remember to use the function precache_model for models
precache_model(gOdstPlayer) //I already told where the playermodel is located, so all I have to do is just write the global variable
precache_model(gOdstWeapon)
}

//this runs each time a player is spawning but you probably figured that one out by the name
public sh_client_spawn(id)
{
//first we check if the user has the hero or not
if (gHasOdstPower[id])
{
//then we can go and set the playermodel
Odst_morph(id)
Odst_weapon(id)

}
}

Odst_weapon(id)
{
//before we just handle the gun out to this crazy maniac we have to check if sh is actually running and that the user is alive and he has the hero
if (sh_is_active() && is_user_alive(id) && gHasOdstPower[id] )
{
//if all this is true we can safely give him his gun
sh_give_weapon(id, CSW_USP)
}
}

//it is here where we set the playermodel for the player
Odst_morph(id)
{
//remember that after the id you have to write the filename witch has to be the model. In this case super.mdl is our model. Do not write .mdl after the filename
cs_set_user_model(id, "Odst")
}

//it is here where we take off the playermodel if a user dropped the hero
Odst_unmorph(id)
{
//yeah, we just reset the playermodel to the original one
cs_reset_user_model(id)
} 

//now we use the registered event
public weapon_change(id)
{
//do nothing if client does not have hero or sh is off
if ( !sh_is_active() || !gHasOdstPower[id] ) return

//the read data is reading the weapon the client has out
new weaponID = read_data(2)
//and if the client does not have the m4a1 out just do nothing
if (weaponID !=CSW_USP) return

//now we checked if the user does not have the m4a1 out. If he does not the code stops here
//if he does have m4a1 out then we continue so now we set the weapon model for the m4a1 since he is having that gun out
//yes we are going to do it in switch_models since that makes most sense
switch_model(id)

//now, we do not want the guy to run out of ammo so we just give him an unlimited amout of it
//this is reading how many bullets there are left in the gun
if (read_data(3) == 0)
{
//so if he is out of ammo just reload it
sh_reload_ammo(id, 1)
/*after the id I made a 1 number
look at the superheromod.inc and you will see this
0 - follow server sh_reloadmode CVAR
1 - continuous shooting, no reload
2 - fill the backpack (must reload)
3 - drop the gun and get a new one with full clip
That should explain it*/
}
}

switch_model(id)
{
//if the sh mod is off the client is dead or he does not have the hero we do not want to let him have the weapon model!
if (!sh_is_active() || !is_user_alive(id) || !gHasOdstPower[id] ) return

//and now we check again if he still has the m4a1 out
if (get_user_weapon(id) == CSW_USP)
{
//now he has all the requirements to have the weapon model so we also need to give it to him
set_pev(id, pev_viewmodel2, gOdstWeapon)
}
}

Last edited by lucianomc; 09-04-2014 at 21:19.
lucianomc 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 02:59.


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