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

A few warnings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 02-18-2011 , 13:12   A few warnings
Reply With Quote #1

Hello,

Well, I have started doing a bit of coding again and I tried to create a hero, which compiles, but I get a few warnings doing it.

So I have a few questions, both about getting rid of the warnings and what the warnings mean.

Here are the warnings:

Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// sh_enchanter.sma
// F:\Misc\scripting\sh_enchanter.sma(29) : warning 211: possibly unintended ass
ignment
// F:\Misc\scripting\sh_enchanter.sma(38) : warning 213: tag mismatch
// Header size:            928 bytes
// Code size:             2276 bytes
// Data size:             1328 bytes
// Stack/heap size:      16384 bytes; estimated max. usage=53 cells (212 bytes)
// Total requirements:   20916 bytes
//
// 2 Warnings.
// Done.
//
// Compilation Time: 0,39 sec
// ----------------------------------------

Press enter to exit ...
Firstly, what does tag mismatch mean? I've gotten it a few times but I never figured out what it actually mean.

Also, what does it mean with Possibly unintended assignment? How does it know what assignments I intended for it to do?

And here is the code..

PHP Code:
// Enchanter

#include <superheromod>

new gHeroID
new bool:gHasEnchanter[SH_MAXSLOTS+1]
new 
gPcvarStunspeedgPcvarStuntimegPcvarSlapstrengthgPcvarChance
//-----------------------------------------------------------------
public plugin_init()
{
    
register_plugin("SUPERHERO Enchanter""1.0""Exploited")
    
    new 
pcvarLevel register_cvar("enchanter_level""6")
    
gPcvarStunspeed register_cvar("enchanter_stunspeed""200")
    
gPcvarStuntime register_cvar("enchanter_stuntime""1")
    
gPcvarSlapstrength register_cvar("enchanter_slapstrength""1")
    
gPcvarChance register_cvar("enchanter_chance""3")
    
    
gHeroID sh_create_hero("Enchanter"pcvarLevel)
    
sh_set_hero_info(gHeroID"Magical powers""Enchant your M4A1 to make it stronger in combat!")
}
//-----------------------------------------------------------------
public sh_hero_init(idheroIDmode)
    if ( 
gHeroID == heroID )
        
gHasEnchanter[id] = mode true false 
    
//-----------------------------------------------------------------
public client_damage(attackervictim
{
    if ( 
gHasEnchanter[attacker] && sh_is_active() && get_user_weapon(attacker CSW_M4A1) )
    {
        if ( 
random_float(0.011.00) <= get_pcvar_float(gPcvarChance) )
        {
            
sh_set_stun(victimget_pcvar_float(gPcvarStuntime), get_pcvar_float(gPcvarStunspeed))
        }
        
        if ( 
random_float(0.011.00) < 0.03 0.06 )
        {
            
user_slap(victimget_pcvar_float(gPcvarSlapstrength) )
        }
    }

Thanks,
Exploited
__________________
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
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 02-18-2011 , 16:07   Re: A few warnings
Reply With Quote #2

get_user_weapon(attacker = CSW_M4A1)

lol

if ( random_float(0.01, 1.00) < 0.03 < 0.06 )

makes no sense

user_slap(victim, get_pcvar_float(gPcvarSlapstrength) )

integer value
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 02-18-2011 , 16:26   Re: A few warnings
Reply With Quote #3

Gah, I keep forgetting to use == instead of =.

As for the random float thing, how would you suggest doing it instead? I want it to do so if the randnum is 0.0-0.03 it will do stun, and if it is 0.03-0.06 it will do the slap.

What do you mean with the last thing?
__________________
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
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 02-18-2011 , 16:56   Re: A few warnings
Reply With Quote #4

Last thing is you use a float value where it wants an integer, causing a tag mismatch.

if ( random_float(0.01, 1.00) < 0.03 < 0.06 )



Code:
new Float:number = random_float(0.01, 1.00)     if(number <= 0.03) {     //stun }     else if(0.03 < number <= 0.06) {     //slap  }

Something like that?
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 02-26-2011 , 18:13   Re: A few warnings
Reply With Quote #5

Well I got to compile but it doesn't work ingame. Can someone please help me find what is wrong?

PHP Code:
// Enchanter

#include <superheromod>

new gHeroID
new bool:gHasEnchanter[SH_MAXSLOTS+1]
new 
gPcvarStunspeedgPcvarStuntimegPcvarSlapstrength
//-----------------------------------------------------------------
public plugin_init()
{
    
register_plugin("SUPERHERO Enchanter""1.0""Exploited")
    
    new 
pcvarLevel register_cvar("enchanter_level""6")
    
gPcvarStunspeed register_cvar("enchanter_stunspeed""200")
    
gPcvarStuntime register_cvar("enchanter_stuntime""1")
    
gPcvarSlapstrength register_cvar("enchanter_slapstrength""1")
    
    
gHeroID sh_create_hero("Enchanter"pcvarLevel)
    
sh_set_hero_info(gHeroID"Magical powers""Enchant your weapons to make them stronger in combat!")
}
//-----------------------------------------------------------------
public sh_hero_init(idheroIDmode)
    if ( 
gHeroID == heroID )
        
gHasEnchanter[id] = mode true false 
    
//-----------------------------------------------------------------
public client_damage(attackervictim
{
    if ( 
gHasEnchanter[attacker] && sh_is_active() && get_user_weapon(attacker == CSW_M4A1) )
    {
        new 
Float:number random_float(0.011.00)
        if ( 
number <= 0.03 
        {
            
sh_set_stun(victimget_pcvar_float(gPcvarStuntime), get_pcvar_float(gPcvarStunspeed)) 
        } else if (
0.03 number <= 0.06) { 
                
user_slap(victimget_pcvar_num(gPcvarSlapstrength) )
        }
    }

Thanks,
Exploited
__________________
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 02-26-2011 , 21:17   Re: A few warnings
Reply With Quote #6

if ( gHasEnchanter[attacker] && sh_is_active() && get_user_weapon(attacker == CSW_M4A1) )

You might want to check that line once more.
__________________
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 02-27-2011 , 05:41   Re: A few warnings
Reply With Quote #7

I can't find anything wrong with it. I am very well aware of the fact that I have to use M4A1 for it to work.
__________________
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 02-27-2011 , 08:31   Re: A few warnings
Reply With Quote #8

Take a look at this:

get_user_weapon(attacker == CSW_M4A1)

Does that seem right?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 02-27-2011 , 08:49   Re: A few warnings
Reply With Quote #9

Attacker cannot be CSW_M4A1.......

This is more like it....


PHP Code:
get_user_weapon(id) == CSW_M4A1
__________________

Last edited by The Art of War; 02-27-2011 at 08:51.
The Art of War is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 02-27-2011 , 09:05   Re: A few warnings
Reply With Quote #10

Don't give him the answer dude.
__________________
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 12:51.


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