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

float problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 12-06-2010 , 11:28   float problem
Reply With Quote #1

This is a hero I helped exploited a bit with. Somehow I get tag mismatch in line 36. I am always fiddling with this floating stuff. I don't get why you just can't use get_pcvar_float. Anyway, the code:

PHP Code:
//Adrenaline

#include <superheromod>

new gHeroID
new gHeroName[] = "Adrenaline"
new bool:gHasAdren[SH_MAXSLOTS+1]
new 
Float:gMaxSpeed
new Float:pcvarSpeed
//-------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Adrenaline""1.0""Jelle/Exploited")
    
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("adren_level""8")
    
pcvarSpeed Float:register_cvar("adren_speed""2000")
    
    
// FIRE THE EVENT TO CREATE THIS SUEPRHERO
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)
    
sh_set_hero_info(gHeroID"Adrenaline!""Run faster than the eye can see!")
}
//-------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
    if ( 
gHeroID == heroID )
    
gHasAdren[id] = mode true false;     
//-------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID ) return
    
    if ( 
key == SH_KEYDOWN )
    {
        
gMaxSpeed get_user_maxspeed(id)
        
set_user_maxspeed(idget_pcvar_float(pcvarSpeed))
        
set_task(4.0"adrenaline_stop"id)
        
sh_set_rendering(id8880kRenderFxGlowShellkRenderTransAlpha)
    }
}
//-------------------------------------------------------------------
public adrenaline_stop(id)
{
    
set_user_maxspeed(idgMaxSpeed)
    
sh_set_rendering(id)

line 36 is:

set_user_maxspeed(id, get_pcvar_float(pcvarSpeed))

I am curious why this warning comes. How do I go by this?
__________________
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 12-06-2010 , 12:38   Re: float problem
Reply With Quote #2

Code:
//Adrenaline #include <superheromod> new gHeroID new gHeroName[] = "Adrenaline" new bool:gHasAdren[SH_MAXSLOTS+1] new Float:gMaxSpeed new pcvarSpeed //------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("SUPERHERO Adrenaline", "1.0", "Jelle/Exploited")         // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     new pcvarLevel = register_cvar("adren_level", "8")     pcvarSpeed = register_cvar("adren_speed", "2000.0")         // FIRE THE EVENT TO CREATE THIS SUEPRHERO     gHeroID = sh_create_hero(gHeroName, pcvarLevel)     sh_set_hero_info(gHeroID, "Adrenaline!", "Run faster than the eye can see!") } //------------------------------------------------------------------- public sh_hero_init(id, heroID, mode)     if ( gHeroID == heroID )     gHasAdren[id] = mode ? true : false;      //------------------------------------------------------------------- public sh_hero_key(id, heroID, key) {     if ( gHeroID != heroID ) return         if ( key == SH_KEYDOWN )     {         gMaxSpeed = get_user_maxspeed(id)         set_user_maxspeed(id, get_pcvar_float(pcvarSpeed))         set_task(4.0, "adrenaline_stop", id)         sh_set_rendering(id, 8, 8, 8, 0, kRenderFxGlowShell, kRenderTransAlpha)     } } //------------------------------------------------------------------- public adrenaline_stop(id) {     set_user_maxspeed(id, gMaxSpeed)     sh_set_rendering(id) }

I don't know how many bloody times I've helped you out with floats now.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 12-06-2010 , 13:26   Re: float problem
Reply With Quote #3

from superheromod.inc
Code:
/**
 * Reset client's max speed according to heroes they have.
 * Useful incase a temporary value was set.
 *
 * @param id  The index of the client.
 * @noreturn
 */
native sh_reset_max_speed(id);
Fr33m@n is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 12-06-2010 , 14:48   Re: float problem
Reply With Quote #4

@dg
I just have a tendency to not remember it. Now I have something I can look back to. Thanks!

@fr33m@n
Never knew that native. Thanks!
__________________
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 12-06-2010 , 15:45   Re: float problem
Reply With Quote #5

After testing the hero a bit, here are the conclusion I came to: (Also, I added sh_set_hero_bind as Jelle apparently forgot to add that to his original post)

- The invisibility works perfectly and as it should
- The hero does not run at full speed. The server and my client is configured and correctly. It runs faster than usual but it does not run at 2000.
- The cooldown does not work. You can use the hero over and over.
- Sometimes, even if you don't use the hero again, you will keep the speed till you change weapon
- If you change weapon, the speed is lost

Also, how do I use that native Fr33 posted? I'm not very good at learning how to use new natives.. Hell, I'm not good at scripting at all.
__________________
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
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 12-06-2010 , 16:30   Re: float problem
Reply With Quote #6

- Good.
- Dunno why. Need to test it first then
- There is no cooldown in it. You can use it 99 times in 1 second. Maybe add a boolean to hold if the player has used power or not
- Use sh_reset_max_speed()
- That seems a bit odd. Maybe register CurWeapon or that ham item deplay thing and then set the speed each time the weapon is changed.

PHP Code:
public adrenaline_stop(id)
{
    
//set_user_maxspeed(id, gMaxSpeed)
    
sh_reset_max_speed(id)
    
sh_set_rendering(id)

And delete gMaxSpeed.
__________________
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 12-06-2010 , 18:10   Re: float problem
Reply With Quote #7

You have to change cl_ speed values and sv_maxspeed (possibly maxvelocity as well) to be able to run at full speed.
__________________
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 12-06-2010 , 20:50   Re: float problem
Reply With Quote #8

SH changes sv_maxspeed itself. I am guessing he does have cl speeds because he is able to run very fast to begin with, and I do not see any slowhacking in 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 12-07-2010 , 15:09   Re: float problem
Reply With Quote #9

It does not run at full speed, I tried to use it with a hero with speed 1200 at the same time and they seemed to be about equal. Jelle said he thinks it is because of the set_user_maxspeed(id, get_pcvar_float(pcvarSpeed)) andtold me to ask for another way to set speed on here. Any ideas?

Entire code:

PHP Code:
//Dash

#include <superheromod>

new gHeroID
new gHeroName[] = "Dash"
new bool:gHasDash[SH_MAXSLOTS+1]
new 
pcvarSpeed
//-------------------------------------------------------------------
public plugin_init()
{
    
// Plugin info
    
register_plugin("SUPERHERO Dash""1.1""Jelle/Exploited")
    
    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("dash_level""8")
    
pcvarSpeed register_cvar("dash_speed""2000")
    
    
// FIRE THE EVENT TO CREATE THIS SUPERHERO
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)
    
sh_set_hero_info(gHeroID"Dash!""Run faster than the eye can see!")
    
sh_set_hero_bind(gHeroID)
}
//-------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
    if ( 
gHeroID == heroID )
    
gHasDash[id] = mode true false;
//-------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID ) return
    
    if (
key == SH_KEYDOWN )
    {
        
set_user_maxspeed(idget_pcvar_float(pcvarSpeed))
        
set_task(4.0"dash_stop"id)
        
sh_set_rendering(id8880kRenderFxGlowShellkRenderTransAlpha)
         }
}
//-------------------------------------------------------------------
public dash_stop(id)
{
    
sh_reset_max_speed(id)
    
sh_set_rendering(id)

__________________
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
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 12-09-2010 , 21:09   Re: float problem
Reply With Quote #10

Like DarkGod said, check your server's sv_maxspeed setting and make sure it is set high enough to accept the speed you want.

Hint typing the cvar into the server console will return the value it is currently at.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
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 03:23.


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