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

CVARS probs..


Post New Thread Reply   
 
Thread Tools Display Modes
Lyserinc
Member
Join Date: Aug 2009
Old 09-05-2009 , 16:02   Re: CVARS probs..
Reply With Quote #21

DAMN ): Then.. i think i dont wanna do the hero done ): :'(
Lyserinc is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-05-2009 , 16:05   Re: CVARS probs..
Reply With Quote #22

You just need to take one step at a time, then it is easily done. You just made too many mistakes in your code, so you need just as much time on it, as you will on a new and fresh code.
If you are in need of the hero on your server, I gladly make it from scratch for you. It wont take me such a long time...

Anyway, take a look at see how I did your code easier to read:
PHP Code:
// Heavy 

/* CVARS - copy and paste to shconfig.cfg

//Heavy
heavy_level 25            //The level of the hero Default: 25 
heavy_healpoints 20            // the #of HP healed per second
YodaMan_knifespeed 670        // speed of Darth Maul in knife mode
YodaMan_knifemult 2.70        // multiplier for knife damage...

*/

/*
*
*
*   Heavy with a minigun from TF2
*/

#include <amxmodx> 
#include <superheromod>
#include <fakemeta> //for model setting

new g_p_model//must be outside plugin_init so it can be global
new g_v_model
new 
gHeroName[]="Heavy" //creates a string varr to hold your hearo's name
new bool:gHasHeavy[SH_MAXSLOTS+1//creates a varr with an aray, with 1 slot per player


public plugin_init() {
    
register_plugin("SUPERHERO Heavy""0.1""Lyserinc"); //register plugin (you should know what this is)
    
    //cvars
    
register_cvar("heavy_level""25"); //level required to select hero
    
register_cvar("heavy_health""500"); //cvar for health
    
register_cvar("heavy_armor""1000"); //cvar for armor
    
register_cvar("heavy_mult""4.0"); //cvar for damage

    
shCreateHero(gHeroName"Heavier than most people""More HP/AP and a nice para"false"Heavy_level"); 
    
    
//register init with server
    
register_srvcmd("heavy_init""heavy_init");
    
    
//register init with sh mod
    
shRegHeroInit(gHeroName"heavy_init");
    
    
//set functions
    
shSetMaxHealth(gHeroName"heavy_health"); //set health
    
shSetMaxArmor(gHeroName"heavy_armor"); //set armor
   
    //see helpful links for event info
    
register_event("Damage""Event_damage","b");

}

public 
Heavy_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);

    
gHasHeavy[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)

    
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //check if they had power but dont know and are alive
    
{
           
shRemHealthPower(id); //remove health power if this is the case
      
shRemArmorPower(id); //remove armor power if this is the case
    
}
          
    if (!
shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;

    new 
damage read_data(2);
    new 
weaponbodypartattacker get_user_attacker(idweaponbodypart//store what weapon used, bodypart hit, and attacker
    
new headshot bodypart == 

    
if(attacker <= || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE//checks ifs it was world that did the damage, and if so just end function.

    
if(gHasHeavy[attacker] && is_user_alive(id)) { //if alive and have power
        
     
new extraDamage floatround(damage get_cvar_float("Super_mult") - damage); //calculate extra damage ([damage done x multiplier] - damage done = extra damage)
    
        
if (extraDamage 0
    {
            
shExtraDamageidattackerextraDamage"Super damage Mult"headshot ); //superheromod.inc: stock shExtraDamage(id, attacker, damage, weaponDescription[], headshot = 0);
         
}

    if(
hasPowers//if they have power
    
{
          
heavy_set_model(id//go to set model funciton
    
}
}



public 
plugin_precache()
{
   
    
g_p_model precache_model("models/shmod/heavy/p_m249.mdl"); //makes players download the model
    
g_v_model precache_model("models/shmod/heavy/v_m249.mdl");
}

public 
heavy_set_model(id
{
    if (!
shModActive() || !is_user_alive(id) || !HasHeavy[id])  return;

    new 
clipammowpnid get_user_weapon(id,clip,ammo);

    if(
wpnid == CSW_M249)
    {
        
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringg_v_model));//view model
        
set_pev(idpev_weaponmodelengfunc(EngFunc_AllocStringg_p_model));//player model
    
}

Much easier, right?

Last edited by Jelle; 09-05-2009 at 16:08.
Jelle is offline
Send a message via MSN to Jelle
Xel0z
Senior Member
Join Date: Apr 2006
Location: Netherlands
Old 09-05-2009 , 16:28   Re: CVARS probs..
Reply With Quote #23

Jelle, I would really like to help him instead of generating the code for him. But you saw that code he wrote and the way he acts. That code was just one big mess, he didnt know what he was doing. He wants to have it done quickly. I'd like to give him tutorials and such, but I feel like he doesnt want to spend hours of reading those tutorials.

I might make my own tutorial one of these days as a lot of people seem like they dont want to spend time reading tutorials of 20 pages.
__________________
Heroes: TESS-One Working on: Grit (Fixing bugs)
Xel0z is offline
Send a message via MSN to Xel0z
Lyserinc
Member
Join Date: Aug 2009
Old 09-05-2009 , 16:32   Re: CVARS probs..
Reply With Quote #24

Well, i wanna lern and i want the code x] So cant someone gimmie the code, and then i can see what i made wrong and everything DDD x]
Lyserinc is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-05-2009 , 16:41   Re: CVARS probs..
Reply With Quote #25

Quote:
Originally Posted by Xel0z View Post
Jelle, I would really like to help him instead of generating the code for him. But you saw that code he wrote and the way he acts. That code was just one big mess, he didnt know what he was doing. He wants to have it done quickly. I'd like to give him tutorials and such, but I feel like he doesnt want to spend hours of reading those tutorials.

I might make my own tutorial one of these days as a lot of people seem like they dont want to spend time reading tutorials of 20 pages.
Yeah your right on that point. Sometimes you just have to tease someone like him to find it out himself, witch I was trying to do, however, I did not succeed.
It just seemed like he made this hero ONLY to learn how to script, and not for a server he has.

Would be nice with a tutorial on how to do it the new way. I have not found that out yet...

Quote:
Originally Posted by Lyserinc
Well, i wanna lern and i want the code x] So cant someone gimmie the code, and then i can see what i made wrong and everything DDD x]
I am right now making the last thing for the multiplier for the weapon on your hero, when I am done (soon hopefully), you will get the code and then you can see how I think it should be done. Also see how easy the code is to read and such. I will write the code here when I have done damage multiplier, then I add weapon model after...
Jelle is offline
Send a message via MSN to Jelle
Lyserinc
Member
Join Date: Aug 2009
Old 09-05-2009 , 16:43   Re: CVARS probs..
Reply With Quote #26

Thankyou, and i wanna thank everyone D
Lyserinc is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-05-2009 , 16:53   Re: CVARS probs..
Reply With Quote #27

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <superheromod>

new gHeroName[]="Heavy" //hero name
new bool:gHasHeavy[SH_MAXSLOTS+1//one slot per player

public plugin_init()
{
    
register_plugin("SUPERHERO Heavy""0.1""Jelle")
    
    
//cvars
    
register_cvar("heavy_level""10");
    
register_cvar("heavy_health""500");
    
register_cvar("heavy_armor""1000");
    
register_cvar("heavy_mult""4");
    
    
//create hero!
    
shCreateHero(gHeroName"Heavier than most people""More HP/AP and a nice para"false"heavy_level");
    
    
//register init with server
    
register_srvcmd("heavy_init""heavy_init");
    
    
//register init with sh mod
    
shRegHeroInit(gHeroName"heavy_init");
    
    
//set hero functions
    
shSetMaxHealth(gHeroName"heavy_health");
    
shSetMaxArmor(gHeroName"heavy_armor");
    
    
//events
    
register_event("Damage""heavy_damage""b");
}

public 
heavy_init()
{
    new 
temp[6]; //tempoary variable
    
read_argv(1,temp,5); //ID of person who picks the hero
    
new id str_to_num(temp); //makes string to a number then number to ID
    
    
read_argv(2,temp,5); //do they have the power?
    
    
new hasPowers str_to_num(temp);
    
    
gHasHeavy[id] = (hasPowers !=0); //returns true or false
    
    
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //Check if they have power if not remove power
    
{
        
shRemHealthPower(id); //removes health
        
shRemArmorPower(id); //removes armor
    
}
}

public 
heavy_damage(id)
{
    if (!
shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
    
    new 
damage read_data(2);
    new 
weaponbodypartattacker get_user_attacker(idweaponbodypart); //witch user, witch weapon, and where has victim been hit
    
new headshot bodypart == 0
    
    
if(attacker <= || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE//end function if world did the damage
    
    
if(gHasHeavy[attacker] && weapon == CSW_M249 && is_user_alive (id)) //if they are alive and have power
    
{
        new 
extraDamage floatround(damage get_cvar_float("heavy_mult") - damage); //calculates extra damage done
        
        
if (extraDamage 0)
        {
            
shExtraDamage(idattackerextraDamage"M249"headshot);
        }
    }

There you go. However, there is no models yet on it. I will add that now.

And if you are looking, Xel0z...
I am not sure if I did the damage thing right.
As it is in the event now, the para is the weapon witch gives you extra damage, right? If not, how do I set it to be the para?

EDIT:
Now I added the weapon models to it:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <superheromod>
#include <fakemeta> //needed for weapon models

new gHeroName[]="Heavy" //hero name
new bool:gHasHeavy[SH_MAXSLOTS+1//one slot per player
new g_p_model;
new 
g_v_model;

public 
plugin_init()
{
    
register_plugin("SUPERHERO Heavy""0.1""Jelle")
    
    
//cvars
    
register_cvar("heavy_level""10");
    
register_cvar("heavy_health""500");
    
register_cvar("heavy_armor""1000");
    
register_cvar("heavy_mult""4");
    
    
//create hero!
    
shCreateHero(gHeroName"Heavier than most people""More HP/AP and a nice para"false"heavy_level");
    
    
//register init with server
    
register_srvcmd("heavy_init""heavy_init");
    
    
//register init with sh mod
    
shRegHeroInit(gHeroName"heavy_init");
    
    
//set hero functions
    
shSetMaxHealth(gHeroName"heavy_health");
    
shSetMaxArmor(gHeroName"heavy_armor");
    
    
//events
    
register_event("Damage""heavy_damage""b");
}

//make people download models!
public plugin_precache()
{
    
g_p_model precache_model("models/shmod/heavy/p_gun.mdl");
    
g_v_model precache_model("models/shmod/heavy/v_gun.mdl");
}

public 
heavy_init()
{
    new 
temp[6]; //tempoary variable
    
read_argv(1,temp,5); //ID of person who picks the hero
    
new id str_to_num(temp); //makes string to a number then number to ID
    
    
read_argv(2,temp,5); //do they have the power?
    
    
new hasPowers str_to_num(temp);
    
    
gHasHeavy[id] = (hasPowers !=0); //returns true or false
    
    
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //Check if they have power if not remove power
    
{
        
shRemHealthPower(id); //removes health
        
shRemArmorPower(id); //removes armor
    
}
    
    if (
hasPowers//do they have power?
    
{
        
heavy_set_model(id//if so go set model
    
}
}

public 
heavy_set_model(id)
{
    if (!
shModActive() || !is_user_alive(id) || !gHasHeavy[id])  return;
    
    new 
clipammowpnid get_user_weapon(idclipammo);
    
    if (
wpnid  == CSW_M249)
    {
        
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringg_v_model)); //view model
        
set_pev(idpev_weaponmodelengfunc(EngFunc_AllocStringg_p_model)); //player model
    
}
}

public 
heavy_damage(id)
{
    if (!
shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
    
    new 
damage read_data(2);
    new 
weaponbodypartattacker get_user_attacker(idweaponbodypart); //witch user, witch weapon, and where has victim been hit
    
new headshot bodypart == 0
    
    
if(attacker <= || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE//end function if world did the damage
    
    
if(gHasHeavy[attacker] && weapon == CSW_M249 && is_user_alive (id)) //if they are alive and have power
    
{
        new 
extraDamage floatround(damage get_cvar_float("heavy_mult") - damage); //calculates extra damage done
        
        
if (extraDamage 0)
        {
            
shExtraDamage(idattackerextraDamage"M249"headshot);
        }
    }

You surely want unlimited ammo with the hero right?

Last edited by Jelle; 09-05-2009 at 17:08.
Jelle is offline
Send a message via MSN to Jelle
Lyserinc
Member
Join Date: Aug 2009
Old 09-05-2009 , 17:10   Re: CVARS probs..
Reply With Quote #28

YEs i do DD Well thank you so much

omg u still wont spawn with the weapon!! :OO


EDIT: And nope, model wont work either, BUT SHIT IN THIS HERO CLOSE THIS THEARD Everything just got fucked up!!! But i lernd alot (:

Last edited by Lyserinc; 09-05-2009 at 17:14.
Lyserinc is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 09-06-2009 , 07:27   Re: CVARS probs..
Reply With Quote #29

Where did you put the .mdl file for the hero?
And what are the file names for the models?

If you see this:
PHP Code:
public plugin_precache()
{
    
g_p_model precache_model("models/shmod/heavy/p_gun.mdl");
    
g_v_model precache_model("models/shmod/heavy/v_gun.mdl");

Then you see where the models have to go, and what name the files must have for it to work. I can make so you spawn with the weapon, I just forgot that...

EDIT:
Now I made unlimited ammo and spawn with the weapon:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <superheromod>
#include <fakemeta> //needed for weapon models

new gHeroName[]="Heavy" //hero name
new bool:gHasHeavy[SH_MAXSLOTS+1//one slot per player
new g_p_model;
new 
g_v_model;

public 
plugin_init()
{
    
register_plugin("SUPERHERO Heavy""0.1""Jelle")
    
    
//cvars
    
register_cvar("heavy_level""10");
    
register_cvar("heavy_health""500");
    
register_cvar("heavy_armor""1000");
    
register_cvar("heavy_mult""4");
    
    
//create hero!
    
shCreateHero(gHeroName"Heavier than most people""More HP/AP and a nice para"false"heavy_level");
    
    
//register init with server
    
register_srvcmd("heavy_init""heavy_init");
    
    
//register init with sh mod
    
shRegHeroInit(gHeroName"heavy_init");
    
    
//set hero functions
    
shSetMaxHealth(gHeroName"heavy_health");
    
shSetMaxArmor(gHeroName"heavy_armor");
    
    
//events
    
register_event("Damage""heavy_damage""b");
    
register_event("CurWeapon""Event_weapon""be""1=1");
    
register_event("ResetHud""Event_spawn""b");
}

//make people download models!
public plugin_precache()
{
    
g_p_model precache_model("models/shmod/heavy/p_gun.mdl");
    
g_v_model precache_model("models/shmod/heavy/v_gun.mdl");
}

public 
heavy_init()
{
    new 
temp[6]; //tempoary variable
    
read_argv(1,temp,5); //ID of person who picks the hero
    
new id str_to_num(temp); //makes string to a number then number to ID
    
    
read_argv(2,temp,5); //do they have the power?
    
    
new hasPowers str_to_num(temp);
    
    
gHasHeavy[id] = (hasPowers !=0); //returns true or false
    
    
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //Check if they have power if not remove power
    
{
        
shRemHealthPower(id); //removes health
        
shRemArmorPower(id); //removes armor
    
}
    
    if (
hasPowers//do they have power?
    
{
        
heavy_set_model(id//if so go set model
    
}
}

public 
heavy_set_model(id)
{
    if (!
shModActive() || !is_user_alive(id) || !gHasHeavy[id])  return;
    
    new 
clipammowpnid get_user_weapon(idclipammo);
    
    if (
wpnid  == CSW_M249)
    {
        
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringg_v_model)); //view model
        
set_pev(idpev_weaponmodelengfunc(EngFunc_AllocStringg_p_model)); //player model
    
}
}

//never ending ammo!
public Event_damage(id)
{
    new 
clip read_data(3); //how much ammo left?
    
    
if (clip == 0//if ammo is empty
    
{
        
shReloadAmmo(id); //reload ammo
    
}
}

public 
Event_spawn(id)
{
    if (
gHasHeavy[id] && is_user_alive(id) && shModActive()) //alive? Mod on?
    
{
        
shGiveWeapon(id"CSW_M249"); //give the weapon
    
}
}

public 
heavy_damage(id)
{
    if (!
shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
    
    new 
damage read_data(2);
    new 
weaponbodypartattacker get_user_attacker(idweaponbodypart); //witch user, witch weapon, and where has victim been hit
    
new headshot bodypart == 0
    
    
if(attacker <= || attacker SH_MAXSLOTS ) return PLUGIN_CONTINUE//end function if world did the damage
    
    
if(gHasHeavy[attacker] && weapon == CSW_M249 && is_user_alive (id)) //if they are alive and have power
    
{
        new 
extraDamage floatround(damage get_cvar_float("heavy_mult") - damage); //calculates extra damage done
        
        
if (extraDamage 0)
        {
            
shExtraDamage(idattackerextraDamage"M249"headshot);
        }
    }


Last edited by Jelle; 09-06-2009 at 07:38.
Jelle is offline
Send a message via MSN to Jelle
Lyserinc
Member
Join Date: Aug 2009
Old 09-06-2009 , 14:22   Re: CVARS probs..
Reply With Quote #30

Omfg.. the ONLY thing that works is that it gives health and AP NOTHING else, like you dont spawn, model wont work.. omg.
Lyserinc 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 12:04.


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