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

[Tutorial] Learn to Superhero Script


Post New Thread Reply   
 
Thread Tools Display Modes
Russiaboy
BANNED
Join Date: May 2009
Location: ZombiePlague is my Home
Old 07-23-2009 , 14:43   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #101

+karma
Russiaboy is offline
Send a message via MSN to Russiaboy Send a message via Skype™ to Russiaboy
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 07-23-2009 , 18:06   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #102

this tutorial is really outdated. and a lot of thing don't working correctly... so forget it
Fr33m@n is offline
cafetao2
New Member
Join Date: Jul 2009
Old 07-31-2009 , 20:05   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #103

Hi staff, trying to create a hero with a model that I have, I tried to follow the tutorial, but it did not work.

I wanted someone to make a SMA, with only the code to put an outfit on a hero.


I did my (SMA), look like it was:

Code:
#include <amxmodx> 
#include <superheromod> 

new gHeroName[]="panico" //creates a string varr to hold your hearo's name

new bool:gHasSuperPower[SH_MAXSLOTS+1] //creates a varr with an aray, with 1 slot per player 

public plugin_init() {
    register_plugin("SUPERHERO panico", "1.0", "Rolnaaba"); //register plugin (you should know what this is)
   
    register_cvar("panico_level", "1"); //level required to select hero

    shCreateHero(gHeroName, "panico", "se transforme no panico", false, "panico_level"); 
    //superheromod.inc: 
    //stock  shCreateHero(heroName[], heroPower[], heroHelp[], bool:requiresKeyEvents, heroLevel[])

    register_srvcmd("panico_init", "panico_init"); //register your hero's init function with server
    
    shRegHeroInit(gHeroName, "panico_init"); //register your hero's init with superheromod

    public panico_init() {
    new temp[6]; //declare a temperary varriable
    read_argv(1,temp,5); //reading the first argument will give you the id of the person who selected your hero
    new id = str_to_num(temp); //transfer the string returned into a number and store it as the id

    read_argv(2,temp,5); //second argument is whether they have the power or not
    
    new hasPowers = str_to_num(temp);

    gHasSuperPower[id] = (hasPowers != 0); //(hasPowers != 0) will either return 1 (if it is true that hasPowers != 0), or 0 (if it is false that hasPowers != 0)
}

new g_model; //must be outside plugin_init so it can be global

public plugin_precache() 
{
 
    g_model = precache_model("models/shmod/Super/panico.mdl"); //makes players download the model
}

public panico_init() 
{
    
    if(hasPowers) { //if they have power
          Super_set_model(id) //go to set model funciton
    }
    //...
}
   
public Super_set_model(id) {
    if (!shModActive() || !is_user_alive(id) || !gHasSuperPower[id]) return PLUGIN_CONTINUE; //if shmod if off, or they are dead, or the dont have the power end function

    cs_set_user_model(id, g_model); //set player model

    return PLUGIN_CONTINUE;
}

what is missing?


THANKS

SORRY FOR MY ENGLISH

Last edited by cafetao2; 07-31-2009 at 20:24.
cafetao2 is offline
glorian
BANNED
Join Date: Mar 2009
Location: Surfplace.se
Old 08-07-2009 , 18:50   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #104

This thread will be Sticky i hope!
glorian is offline
Send a message via MSN to glorian
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 01-15-2010 , 11:51   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #105

I have a question. You never describe how to add sounds to weapon heroes. Plz tell me ^^
The Art of War is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 01-15-2010 , 20:27   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #106

You cannot alter the sounds on weapons. They are not run by the server but by the client. The knife you can change sound on, the rest... No.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Jouzaa
Junior Member
Join Date: Dec 2009
Old 03-03-2010 , 12:26   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #107

Hey , I STILL have no idea how to add a player model on a hero.

maybe you should make a tutorial -.-

AIGH, here's the stealth predator .sma file. please, if anybody could help me, Add a player model to this hero. A tutorial would be nice too.

Code:
//Stealth Predator!, Unique Predator that has Invisibility

#include <amxmod>
#include <Vexd_Utilities>
#include <amxmodx> 
#include <fun> 
#include <cstrike>
#include <engine> 
#include <superheromod> 

/*

//Stealth Predator
stealth_level 3
stealth_respawnpct 50            //Percent chance 0-100 of respawning on each death (default=50)
stealth_healpoints 3            //Heal # per second (default=3)
stealth_speed 600            //Running Speed (default=600)

*/

// GLOBAL VARIABLES
new gHeroName[]="Stealth Predator"
new bool:gHasstealthPower[SH_MAXSLOTS+1]
new gUserTeam[SH_MAXSLOTS+1]
new g_powerID[SH_MAXSLOTS+1]
new g_lastWeapon[SH_MAXSLOTS+1]
new bool:g_usingPower[SH_MAXSLOTS+1]
new gPlayerMaxHealth[SH_MAXSLOTS+1]
new bool:g_chargeOver[SH_MAXSLOTS+1]
new bool:gBetweenRounds
new gHealPoints
//-------------------------------------------------------------------------------------------------------
public plugin_init()
{
    // Plugin Info
    register_plugin("SUPERHERO Stealth Predator", "1.15", "Neogaiden(z)/Strife")

    // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    register_cvar("stealth_level", "3")
    register_cvar("stealth_respawnpct", "50")
    register_cvar("stealth_healpoints", "3")
    register_cvar("stealth_speed", "600" )

    // FIRE THE EVENT TO CREATE THIS SUPERHERO!
    shCreateHero(gHeroName, "Speed/Revive/Heal/Invisibility/No Footsteps", "Hold Keydown to go Invisible and No Footsteps ", true, "stealth_level")

    // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    // INIT
    register_srvcmd("stealth_init", "stealth_init")
    shRegHeroInit(gHeroName, "stealth_init")

    // Key Down
    register_srvcmd("stealth_kd", "stealth_kd")
    shRegKeyDown(gHeroName, "stealth_kd")

    // Key Up
    register_srvcmd("stealth_ku", "stealth_ku")
    shRegKeyUp(gHeroName, "stealth_ku")

    // Death
    register_event("DeathMsg", "stealth_death", "a")

    //EVENTS
    register_event("CurWeapon", "curweapon", "be", "1=1")

    register_srvcmd("stealth_maxhealth", "stealth_maxhealth")
    shRegMaxHealth(gHeroName, "stealth_maxhealth" )
    gHealPoints = get_cvar_num("stealth_healpoints")

    //HEAL LOOP
    set_task(1.0, "stealth_loop", 0, "", 0, "b")

}
//----------------------------------------------------------------------------------------------
public stealth_init()
{
    // First Argument is an id
    new temp[6]
    read_argv(1, temp, 5)
    new id = str_to_num(temp)
Jouzaa is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 03-03-2010 , 13:28   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #108

Look at my tutorial.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
brenu
Junior Member
Join Date: Jun 2011
Old 07-21-2011 , 21:27   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #109

Hey guys, please help me!.
Please Please Please!!!.
I need this code...
I made this code and edit some things, but when i go to compiler i see so much errors....
And i'm fix fix and fix many errors.
And now, i have only this errors:

Warning 209: Function Stick_damage should return a value. <108>
Error 035: Argument type mismatch (argument 2) <121>
Warning 225: Unreachable code. <125>
Warning 209: Function Stic_Set_Model should return a value <132>
Warning 204: symbol is assigned value that never used: "g_model" <147>

Please help me!!! D:

Code:
// Stick - Hp, Gravity, Armor, Speed, Gun!

/* CVARS - copy and paste to shconfig.cfg

//Stick

*/

#include <amxmodx>
#include <superheromod>
#include <cstrike>
#include <fakemeta>  

// VARIABLES

new gHeroName[]="Stick"
new g_model
new bool:gHasSuperPower[SH_MAXSLOTS+1]
new g_p_model
new g_v_model
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
    register_plugin("SUPERHERO Stick", "1.0", "[SN]KyLava")
    register_event("CurWeapon", "Stick_weapon","be","1=1")
    register_event("ResetHUD", "Stick_spawn","b")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG   
    register_cvar("Stick_level", "12")
    register_cvar("Stick_health", "750")
    register_cvar("Stick_armor", "100")
    register_cvar("Stick_grav", "0.50")
    register_cvar("Stick_speed", "400")
    register_cvar("Stick_mult", "3.0")


	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    shCreateHero(gHeroName, "Hp, Gravity, Armor, Speed, Gun!", "More Health and Armor, Super Speed and Models", false, "Stick_level")
    //superheromod.inc: 
    //stock  shCreateHero(heroName[], heroPower[], heroHelp[], bool:requiresKeyEvents, heroLevel[])

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    register_srvcmd("Stick_init", "Stick_init")
    shRegHeroInit(gHeroName, "Stick_init")
    register_event("Damage", "Stick_damage","3.0")

	// Let Server know about Sticks Variable
    shSetMaxHealth(gHeroName, "Stick_health")
    shSetMaxArmor(gHeroName, "Stick_armor")
    shSetMinGravity(gHeroName, "Stick_grav")
    shSetMaxSpeed(gHeroName, "Stick_speed", "[0]")


}
//----------------------------------------------------------------------------------------------
public Stick_init()
{
	// First Argument is an id
    new temp[6]
    read_argv(1,temp,5)
    new id = str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has Stick
    read_argv(2,temp,5)
    new hasPowers = str_to_num(temp)
    if(hasPowers) {
          Stick_set_model(id)
}

	// Got to take away powers from a user that dropped Stick

    gHasSuperPower[id] = (hasPowers != 0)
    if (!hasPowers && gHasSuperPower[id] && is_user_alive(id)) {
          shRemHealthPower(id)
          shRemArmorPower(id)
          shRemGravityPower(id)
          shRemSpeedPower(id)


    }
}
//----------------------------------------------------------------------------------------------
public Stick_damage(id)
{
    if (!shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE

    new damage = read_data(2)
    new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
    new headshot = bodypart == 1 ? 1 : 0 //this is just short for:
    /*if (bodypart == 1) {
        headshot = 1
    } else {
        headshot = 0
    }*/

    if(attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE

    if(gHasSuperPower[attacker] && is_user_alive(id)) {
        
     new extraDamage = floatround(damage * get_cvar_float("Stick_mult") - damage)
    
     if (extraDamage > 0)
 {
            shExtraDamage( id, attacker, extraDamage, "Stick damage Mult", headshot ) //superheromod.inc: stock shExtraDamage(id, attacker, damage, weaponDescription[], headshot = 0)
     }
    }
}
//----------------------------------------------------------------------------------------------
public plugin_precache() {
    //Precache Models
   
    g_model = precache_model("models/shmod/Stick/Stick.mdl")
    g_p_model = precache_model("models/shmod/Stick/p_Ak-47_Stick.mdl")
    g_v_model = precache_model("models/shmod/Stick/v_Ak-47_Stick.mdl")
}
//----------------------------------------------------------------------------------------------
public Stick_set_model(id) {
    if (!shModActive() || !is_user_alive(id) || !gHasSuperPower[id]) return PLUGIN_CONTINUE

    cs_set_user_model(id, g_model)

    return PLUGIN_CONTINUE

    new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)

    if(wpnid == CSW_AK47) {
        set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, g_v_model))
        set_pev(id, pev_weaponmodel, engfunc(EngFunc_AllocString, g_p_model))

    }
}
//----------------------------------------------------------------------------------------------
public Stick_weapon(id) {
    new clip = read_data(3)

    if (clip == 0) {
        shReloadAmmo(id)
    }
}
//----------------------------------------------------------------------------------------------
public Stick_spawn(id) {
    if(gHasSuperPower[id] && is_user_alive(id) && shModActive()) {
        shGiveWeapon(id,"weapon_ak47")
    }
}
//----------------------------------------------------------------------------------------------
brenu is offline
Send a message via MSN to brenu
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-22-2011 , 07:25   Re: [Tutorial] Learn to Superhero Script
Reply With Quote #110

http://forums.alliedmods.net/showthread.php?t=120051
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
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 16:50.


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