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

warning 217: loose indentation


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-17-2014 , 19:16   Re: warning 217: loose indentation
Reply With Quote #11

Quote:
Originally Posted by .Dare Devil. View Post
Why does everything always have to end?
Why won't somethings last forever?
You said you were done coding now please go away.
__________________
fysiks is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-17-2014 , 21:44   Re: warning 217: loose indentation
Reply With Quote #12

Fixed version:
Code:
#include <amxmodx>
#include <fun>

#define ADMIN_FLAG ADMIN_KICK

new g_iHP, g_iAHP, g_iFrag
new g_msgSayText

public plugin_init() 
{
    register_plugin("", "1.0", "")
    
    register_event("DeathMsg", "Event_deathMsg", "a")
    
    g_iHP = register_cvar("cs_health_bonus", "25")
    g_iAHP = register_cvar("cs_admin_health_bonus", "100")
    g_iFrag = register_cvar("cs_frag_bonus", "5")
    
    g_msgSayText = get_user_msgid("SayText")
}

new CustomSound[][] =  
{
    "misc/knife1.wav",
    "misc/knife2.wav",
    "misc/knife3.wav",
    "misc/knife4.wav",
    "misc/knife5.wav"
}

public plugin_precache() 
{ 
    for ( new i; i < sizeof CustomSound; i++ ) 
    { 
        precache_sound( CustomSound[ i ]); 
    } 
}  

public Event_deathMsg()
{
    new Killer = read_data(1)
    new Victim = read_data(2)

    if (!is_user_alive(Killer) || Victim == Killer )
        return PLUGIN_HANDLED;
    
    new CheckWeapon[6]
    read_data(4, CheckWeapon, charsmax(CheckWeapon))
    
    if (equali(CheckWeapon, "knife"))
    {
        new szName[32], szName2[32]
        get_user_name(Killer, szName, charsmax(szName))
        get_user_name(Victim, szName2, charsmax(szName2))
        
        if(get_user_flags(Victim) & ADMIN_FLAG)
        {
            print_colored(0, "!g%s got %d frags !tand %d HP for slashing !yADMIN %s", szName, get_pcvar_num(g_iFrag),  get_pcvar_num(g_iAHP), szName2);
            
            emit_sound(0, CHAN_VOICE, CustomSound[ random_num( 0, charsmax(  CustomSound ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            
            set_user_health(Killer, get_user_health(Killer) + get_pcvar_num(g_iAHP))
            set_user_frags(Killer, get_user_frags(Killer) + get_pcvar_num(g_iFrag))
        }
        else
        {
            print_colored(0, "!g%s got %d frags !tand %d HP for slashing !y%s", szName, get_pcvar_num(g_iFrag),  get_pcvar_num(g_iHP), szName2);
            
            emit_sound(0, CHAN_VOICE, CustomSound[ random_num( 0, charsmax(  CustomSound ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
            
            set_user_health(Killer, get_user_health(Killer) + get_pcvar_num(g_iHP))
            set_user_frags(Killer, get_user_frags(Killer) + get_pcvar_num(g_iFrag))
        }
    }
    
    return PLUGIN_CONTINUE;
}

stock print_colored(const index, const input [ ], const any:...)
{ 
    new message[191]
    vformat(message, 190, input, 3)
    replace_all(message, 190, "!y", "^1")
    replace_all(message, 190, "!t", "^3")
    replace_all(message, 190, "!g", "^4")

    if(index)
    {
        //print to single person
        message_begin(MSG_ONE, g_msgSayText, _, index)
        write_byte(index)
        write_string(message)
        message_end()
    }
    else
    {
        //print to all players
        new players[32], count, i, id
        get_players(players, count, "ch")
        for( i = 0; i < count; i ++ )
        {
            id = players[i]
            if(!is_user_connected(id)) continue;

            message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, id)
            write_byte(id)
            write_string(message)
            message_end()
        }
    }
}

Last edited by zmd94; 12-19-2014 at 03:20.
zmd94 is offline
tousif
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 12-18-2014 , 04:40   Re: warning 217: loose indentation
Reply With Quote #13

Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team
knifeitup.sma(4) : error 031: unknown directive
knifeitup.sma(53) : error 017: undefined symbol "ADMIN_FLAG"
knifeitup.sma(57) : error 017: undefined symbol "id"
knifeitup.sma(57) : warning 215: expression has no effect
knifeitup.sma(57) : warning 215: expression has no effect
knifeitup.sma(57) : warning 215: expression has no effect
knifeitup.sma(57) : warning 215: expression has no effect
knifeitup.sma(57) : warning 215: expression has no effect
knifeitup.sma(57) : error 001: expected token: ";", but found ")"
knifeitup.sma(57) : error 029: invalid expression, assumed zero
knifeitup.sma(57) : fatal error 107: too many error messages on one line Compilation aborted. 6 Errors. Could not locate output file
knifeitup.amx (compile failed).

THis errors

Last edited by tousif; 12-18-2014 at 04:53.
tousif is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 05:03   Re: warning 217: loose indentation
Reply With Quote #14

I have updated the code. Please compare from the previous code and learn from it.

Last edited by zmd94; 12-18-2014 at 05:04.
zmd94 is offline
tousif
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 12-18-2014 , 06:06   Re: warning 217: loose indentation
Reply With Quote #15

ok TY
tousif is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-18-2014 , 06:35   Re: warning 217: loose indentation
Reply With Quote #16

Quote:
Originally Posted by fysiks View Post
You said you were done coding now please go away.
So? no im not going anywhere...
.Dare Devil. is offline
tousif
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 12-18-2014 , 07:26   Re: warning 217: loose indentation
Reply With Quote #17

Chat error and sound not playing after 4th knife and again starting at 8 knife i havent set cvars default are used still this

tousif is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2014 , 07:59   Re: warning 217: loose indentation
Reply With Quote #18

Do you get any errors? By the way, what do you mean by chat error?

Screenshot?
zmd94 is offline
tousif
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 12-19-2014 , 03:12   Re: warning 217: loose indentation
Reply With Quote #19

yes see the Screenshot
tousif is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-19-2014 , 03:21   Re: warning 217: loose indentation
Reply With Quote #20

I have updated the code.
zmd94 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 10:52.


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