AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   warning 217: loose indentation (https://forums.alliedmods.net/showthread.php?t=253173)

tousif 12-17-2014 02:27

warning 217: loose indentation
 
Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team 
knifeitup.sma(63) : warning 217: loose indentation
knifeitup.sma(64) : warning 217: loose indentation
knifeitup.sma(67) : warning 217: loose indentation
knifeitup.sma(70) : warning 217: loose indentation
knifeitup.sma(71) : warning 217: loose indentation
Header size:736 bytes
Code size:3616 bytes
Data size: 1504 bytes
Stack/heap size: 16384 bytes;
estimated max. usage=778 cells (3112 bytes)
Total requirements:  22240 bytes 
5 Warnings.
Done.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "knifeitup"
#define VERSION "3.0"
#define AUTHOR "Gullu Bhai"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("knifeitup_hp""25")
    
register_cvar("knifeitup_adminhp""100")
    
register_cvar("knifeitup_frags""5")
    
register_event("DeathMsg""Event_DeathMsg_knife""a")
}

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

public 
plugin_precache()
{
    for ( new 
isizeof CustomSoundi++ )
        {
            
precache_soundCustomSound]);
        }
}   


public 
Event_DeathMsg_knife()
{
    new 
Killer read_data(1)
    new 
Victim read_data(2)
    
    if (!
is_user_alive(Killer) || (Killer == Victim))
        return;
    
    new 
szName[32], szName2[32]
    
get_user_name(KillerszNamecharsmax(szName)) 
    
get_user_name(VictimszName2charsmax(szName2)) 
    
    new 
CheckWeapon[6];
    
read_data(4CheckWeapon5);
    
    if (
equal(CheckWeapon"knife"))
    {
        new 
php get_cvar_num("knifeitup_hp")
        new 
ahp get_cvar_num("knifeitup_adminhp")
        new 
frags get_cvar_num("knifeitup_frags")
        
        
        if(
get_user_flags(Killer) & ADMIN_KICK
        {
            
client_print_color(0print_chat"%s Got %d Frags %d hp For Knifing Admin %s"szNamefragsahpszName2)
             
client_cmd0"spk %s"CustomSoundrandom_num0sizeof CustomSound ) ] ); //by Arkshine
            
set_user_health(Killerget_user_health(Killer) + ahp)
            
set_user_frags(Killerget_user_frags(Killer) + frags)
        }
       else
        {
        
client_print_color(0print_chat"%s Got %d Frags %d hp For Knifing %s"szNamefragsphpszName2)
         
client_cmd0"spk %s"CustomSoundrandom_num0sizeof CustomSound ) ] );  //by Arkshine
        
set_user_health(Killerget_user_health(Killer) + php)
        
set_user_frags(Killerget_user_frags(Killer) + frags)
       }
    } 
}  

stock client_print_color(idtype, const text[], any:...)
{
 if(
type == print_chat)
 {
  new 
g_iMsgidSayText;
  
g_iMsgidSayText get_user_msgid("SayText");

  new 
szMsg[191], iPlayers[32], iCount 1;
  
vformat(szMsgcharsmax(szMsg), text3);

  
replace_all(szMsgcharsmax(szMsg), "!g","^x04");
  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");
  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(
id)
   
iPlayers[0] = id;
  else
   
get_players(iPlayersiCount"ch");

  for(new 
iCount i++)
  {
   if(!
is_user_connected(iPlayers[i]))
    continue;
   
   
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
   
write_byte(iPlayers[i]);
   
write_string(szMsg);
   
message_end();
  }
 }



zmd94 12-17-2014 02:49

Re: warning 217: loose indentation
 
It will not effect your gameplay. The warning is indicate that your code is not being arranged properly.

tousif 12-17-2014 02:56

Re: warning 217: loose indentation
 
ok

popeye10 12-17-2014 03:25

Re: warning 217: loose indentation
 
Try this :)
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "knifeitup"
#define VERSION "3.0"
#define AUTHOR "Gullu Bhai"

new php ,ahpfrags

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("knifeitup_hp""25")
    
register_cvar("knifeitup_adminhp""100")
    
register_cvar("knifeitup_frags""5")
    
register_event("DeathMsg""Event_DeathMsg_knife""a")
}

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

public 
plugin_precache() 

    for ( new 
isizeof CustomSoundi++ ) 
        { 
            
precache_soundCustomSound]); 
        } 
}  


public 
Event_DeathMsg_knife()
{
    new 
Killer read_data(1)
    new 
Victim read_data(2)
    
    if (!
is_user_alive(Killer) || (Killer == Victim))
    return 
PLUGIN_HANDLED;
        
    new 
CheckWeapon[6]
    
read_data(4CheckWeaponcharsmax(CheckWeapon))
    
    if (
equal(CheckWeapon"knife"))
    {
        new 
szName[32], szName2[32]
        
get_user_name(KillerszNamecharsmax(szName))
        
get_user_name(VictimszName2charsmax(szName2))
        
        if(
get_user_flags(Killer) & ADMIN_KICK)
        {
            
client_print_color(0print_chat"!g%s !tGot !g%d !tFrags !g%d !thp For Knifing Admin !g%s"szNamefragsahpszName2);
            
client_cmd0"spk %s",CustomSoundrandom_num0sizeof CustomSound ) ] );//by Arkshine 
            
set_user_health(Killerget_user_health(Killer) + get_pcvar_num(ahp))
            
set_user_frags(Killerget_user_frags(Killer) + get_pcvar_num(frags))
        }
        else
        {
            
client_print_color(0print_chat"!g%s !tGot !g%d !tFrags !g%d !thp For Knifing !g%s"szNamefragsphpszName2);
            
client_cmd0"spk %s",CustomSoundrandom_num0sizeof CustomSound ) ] );//by Arkshine 
            
set_user_health(Killerget_user_health(Killer) + get_pcvar_num(php))
            
set_user_frags(Killerget_user_frags(Killer) + get_pcvar_num(frags))
        }
    }
    return 
PLUGIN_CONTINUE;
}

stock client_print_color(idtype, const text[], any:...)
{
 if(
type == print_chat)
 {
  new 
g_iMsgidSayText;
  
g_iMsgidSayText get_user_msgid("SayText");

  new 
szMsg[191], iPlayers[32], iCount 1;
  
vformat(szMsgcharsmax(szMsg), text3);

  
replace_all(szMsgcharsmax(szMsg), "!g","^x04");
  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");
  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(
id)
   
iPlayers[0] = id;
  else
   
get_players(iPlayersiCount"ch");

  for(new 
iCount i++)
  {
   if(!
is_user_connected(iPlayers[i]))
    continue;
   
   
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
   
write_byte(iPlayers[i]);
   
write_string(szMsg);
   
message_end();
  }
 }



tousif 12-17-2014 03:27

Re: warning 217: loose indentation
 
ty

GX_JazZ 12-17-2014 10:29

Re: warning 217: loose indentation
 
Try this :
Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "knifeitup"
#define VERSION "3.0"
#define AUTHOR "Gullu Bhai"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("knifeitup_hp", "25")
register_cvar("knifeitup_adminhp", "100")
register_cvar("knifeitup_frags", "5")
register_event("DeathMsg", "Event_DeathMsg_knife", "a")
}

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_knife()
{
new Killer = read_data(1)
new Victim = read_data(2)

if (!is_user_alive(Killer) || (Killer == Victim))
return;

new szName[32], szName2[32]
get_user_name(Killer, szName, charsmax(szName))
get_user_name(Victim, szName2, charsmax(szName2))

new CheckWeapon[6];
read_data(4, CheckWeapon, 5);

if (equal(CheckWeapon, "knife"))
{
new php = get_cvar_num("knifeitup_hp")
new ahp = get_cvar_num("knifeitup_adminhp")
new frags = get_cvar_num("knifeitup_frags")


if(get_user_flags(Killer) & ADMIN_KICK)
{
client_print_color(0, print_chat, "%s Got %d Frags %d hp For Knifing Admin %s", szName, frags, ahp, szName2)
client_cmd( 0, "spk %s", CustomSound[ random_num( 0, sizeof CustomSound - 1 ) ] ); //by Arkshine
set_user_health(Killer, get_user_health(Killer) + ahp)
set_user_frags(Killer, get_user_frags(Killer) + frags)
}
else
{
client_print_color(0, print_chat, "%s Got %d Frags %d hp For Knifing %s", szName, frags, php, szName2)
client_cmd( 0, "spk %s", CustomSound[ random_num( 0, sizeof CustomSound - 1 ) ] );  //by Arkshine
set_user_health(Killer, get_user_health(Killer) + php)
set_user_frags(Killer, get_user_frags(Killer) + frags)
}
}


stock client_print_color(id, type, const text[], any:...)
{
if(type == print_chat)
{
new g_iMsgidSayText;
g_iMsgidSayText = get_user_msgid("SayText");

new szMsg[191], iPlayers[32], iCount = 1;
vformat(szMsg, charsmax(szMsg), text, 3);

replace_all(szMsg, charsmax(szMsg), "!g","^x04");
replace_all(szMsg, charsmax(szMsg), "!n","^x01");
replace_all(szMsg, charsmax(szMsg), "!t","^x03");

if(id)
iPlayers[0] = id;
else
get_players(iPlayers, iCount, "ch");

for(new i = 0 ; i < iCount ; i++)
{
if(!is_user_connected(iPlayers[i]))
continue;

message_begin(MSG_ONE_UNRELIABLE, g_iMsgidSayText, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}
}


tousif 12-17-2014 10:46

Re: warning 217: loose indentation
 
Plugin is not working the name of killer is comming but not victim and not giving the frags and hp and are also not according to cvars
Sounds not playing if plugin at 1st round only

Plzz help in fixing this ^^

YamiKaitou 12-17-2014 12:06

Re: warning 217: loose indentation
 
Quote:

Originally Posted by GX_JazZ (Post 2236427)
Try this :

That code looks like crap. Where is the indentation? How can you see which scope ends where?

.Dare Devil. 12-17-2014 14:12

Re: warning 217: loose indentation
 
Quote:

Originally Posted by YamiKaitou (Post 2236477)
That code looks like crap. Where is the indentation? How can you see which scope ends where?

Why does everything always have to end?
Why won't somethings last forever?

Eagle07 12-17-2014 16:16

Re: warning 217: loose indentation
 
you can fix loose indentation just with ctrl + i (if you use AMXX_STUDIO )


All times are GMT -4. The time now is 15:17.

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