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

how to rearrange lines of .sma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
arvEL.
Senior Member
Join Date: Dec 2014
Location: Iraq
Old 02-17-2018 , 03:26   how to rearrange lines of .sma
Reply With Quote #1

hi guys..
i have plugin for example:

PHP Code:

#include <amxmisc>
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Addon: Extended Give Ammo 2.0"
#define VERSION "2.0"
#define AUTHOR "[ru]In1ernal Error"

new g_msgSayTextcur_add_amount 10;

public 
plugin_init() {

    
register_cvar("zp_ammo_ex"VERSIONFCVAR_SERVER|FCVAR_SPONLY);

    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_concmd("zp_ammo_e""menu_init",ADMIN_LEVEL_A"");
    
    
register_concmd("zp_ammo_e_self""give_ammo_e_self",ADMIN_LEVEL_A" - zp_ammo_e_self <amount>");
    
    
register_dictionary("zp_ammo_ex.txt");
    
    
g_msgSayText get_user_msgid("SayText");
}

public 
give_ammo_e (idammo){
    
    new 
user_ammo zp_get_user_ammo_packs(id) + ammo;
    
    
zp_set_user_ammo_packs idmax 1user_ammo) );
    
    return 
PLUGIN_HANDLED;
}

public 
give_ammo_e_self(idlevelcid){
if ( !
cmd_access idlevelcid) )
    {
        return 
PLUGIN_HANDLED;
    }

new 
amount[5];

read_argv 1amountcharsmax(amount));

give_ammo_eidstr_to_num(amount));

return 
PLUGIN_HANDLED;
}

public 
menu_init(id){
    new 
MenuName[64]
    
format(MenuName63"\r%L"id"AM")
    
    new 
menu menu_create(MenuName"menu_handler");
    
    new 
players[32], inumtempid;

    
get_players(playersinum);

    new 
nomer[10], name[32];
 
    switch(
cur_add_amount){
    
        case 
10:
        {
            
menu_additem(menu"\w10 ammo""33"0);
        }

        case 
100:
        {
            
menu_additem(menu"\w100 ammo""34"0);
        }

        case 
1000:
        {
            
menu_additem(menu"\w1000 ammo""35"0);
        }
    
    }

    
menu_additem(menu"""36"0);
    
    for ( new 
ii<inumi++)
    {        
        
tempid players[i];
        
get_user_name(tempidname31);
        
num_to_str(tempidnomer9);
        
menu_additem(menunamenomerADMIN_LEVEL_A);
    }

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem){
if ( 
item == MENU_EXIT )
{
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}
    
new 
data[6], iName[64];
new 
accesscallback;

menu_item_getinfo(menuitemaccessdata5iName63callback);

new 
tempid str_to_num(data);

switch(
tempid){
    case 
33:
        {
            
cur_add_amount 100;
            
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
            
menu_destroy(menu);
            
menu_init(id);

        }
    case 
34:
        {
            
cur_add_amount 1000;
            
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
            
menu_destroy(menu);
            
menu_init(id);

        }
    case 
35:
        {
            
cur_add_amount 10;
            
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
            
menu_destroy(menu);
            
menu_init(id);
        }
    case 
36:
        {
            
menu_destroy(menu);
            
menu_init(id);

        }
    default:
        {
            if(
is_user_connected(tempid)){
            
give_ammo_e(tempidcur_add_amount);
            
            new 
Nick[32];
            
get_user_name(tempidNick31);
            
            
client_printcolor(id"/g[AP] /t%s /y%L /t%i /t%L!"Nickid"WAS_G"cur_add_amountid"AMMO")
            } else {
            
menu_destroy(menu);
            
menu_init(id);
            }
        }
}


return 
PLUGIN_HANDLED;
}

stock client_printcolor(id, const input[], any:...)
{
    static 
iPlayersNum[32], iCountiCount 1
    
static szMsg[191]
    
    
vformat(szMsgcharsmax(szMsg), input3)
    
    
replace_all(szMsg190"/g""^4"// green txt
    
replace_all(szMsg190"/y""^1"// orange txt
    
replace_all(szMsg190"/t""^3"// team txt
    
    
if(idiPlayersNum[0] = id
    
else get_players(iPlayersNumiCount"ch")
        
    for (new 
0iCounti++)
    {
        if (
is_user_connected(iPlayersNum[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_iPlayersNum[i])
            
write_byte(iPlayersNum[i])
            
write_string(szMsg)
            
message_end()
        }
    }

see the lines!! are neat and easy to read




PHP Code:

#include <amxmisc>
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Addon: Extended Give Ammo 2.0"
#define VERSION "2.0"
#define AUTHOR "[ru]In1ernal Error"

new g_msgSayTextcur_add_amount 10;

public 
plugin_init()
{

register_cvar("zp_ammo_ex"VERSIONFCVAR_SERVER|FCVAR_SPONLY);

register_plugin(PLUGINVERSIONAUTHOR);
    
register_concmd("zp_ammo_e""menu_init",ADMIN_LEVEL_A"");
    
register_concmd("zp_ammo_e_self""give_ammo_e_self",ADMIN_LEVEL_A" - zp_ammo_e_self <amount>");
    
register_dictionary("zp_ammo_ex.txt");
    
g_msgSayText get_user_msgid("SayText");
}

public 
give_ammo_e (idammo)
{
    
new 
user_ammo zp_get_user_ammo_packs(id) + ammo;
    
zp_set_user_ammo_packs idmax 1user_ammo) );
    
return 
PLUGIN_HANDLED;
}

public 
give_ammo_e_self(idlevelcid){
if ( !
cmd_access idlevelcid) )
{
return 
PLUGIN_HANDLED;
}

new 
amount[5];

read_argv 1amountcharsmax(amount));

give_ammo_eidstr_to_num(amount));

return 
PLUGIN_HANDLED;
}

public 
menu_init(id){
new 
MenuName[64]
format(MenuName63"\r%L"id"AM")
    
new 
menu menu_create(MenuName"menu_handler");
    
new 
players[32], inumtempid;

get_players(playersinum);

new 
nomer[10], name[32];
 
switch(
cur_add_amount){
    
case 
10:
{
menu_additem(menu"\w10 ammo""33"0);
}

case 
100:
{
menu_additem(menu"\w100 ammo""34"0);
}

case 
1000:
{
menu_additem(menu"\w1000 ammo""35"0);
}
    
}

menu_additem(menu"""36"0);
    
for ( new 
ii<inumi++)
{        
tempid players[i];
get_user_name(tempidname31);
num_to_str(tempidnomer9);
menu_additem(menunamenomerADMIN_LEVEL_A);
}

menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem){
if ( 
item == MENU_EXIT )
{
menu_destroy(menu);
return 
PLUGIN_HANDLED;
}
    
new 
data[6], iName[64];
new 
accesscallback;

menu_item_getinfo(menuitemaccessdata5iName63callback);

new 
tempid str_to_num(data);

switch(
tempid){
case 
33:
{
cur_add_amount 100;
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
menu_destroy(menu);
menu_init(id);

}
case 
34:
{
cur_add_amount 1000;
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
menu_destroy(menu);
menu_init(id);

}
case 
35:
{
cur_add_amount 10;
client_printcolor(id"/g[AP] /y%L /t%i /y%L"id"CHANGED"cur_add_amountid"AMMO");
menu_destroy(menu);
menu_init(id);
}
case 
36:
{
menu_destroy(menu);
menu_init(id);

}
default:
{
if(
is_user_connected(tempid)){
give_ammo_e(tempidcur_add_amount);
            
new 
Nick[32];
get_user_name(tempidNick31);

client_printcolor(id"/g[AP] /t%s /y%L /t%i /t%L!"Nickid"WAS_G"cur_add_amountid"AMMO")
} else {
menu_destroy(menu);
menu_init(id);
}
}
}


return 
PLUGIN_HANDLED;
}

stock client_printcolor(id, const input[], any:...)
{
static 
iPlayersNum[32], iCountiCount 1
static szMsg[191]
    
vformat(szMsgcharsmax(szMsg), input3)
    
replace_all(szMsg190"/g""^4"// green txt
replace_all(szMsg190"/y""^1"// orange txt
replace_all(szMsg190"/t""^3"// team txt
    
if(idiPlayersNum[0] = id
else get_players(iPlayersNumiCount"ch")
        
for (new 
0iCounti++)
{
if (
is_user_connected(iPlayersNum[i]))
{
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_iPlayersNum[i])
write_byte(iPlayersNum[i])
write_string(szMsg)
message_end()
}
}

Be here to the lines untidy !! I want to reorder them as before
__________________

Last edited by arvEL.; 02-17-2018 at 03:26.
arvEL. is offline
Send a message via Skype™ to arvEL.
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 02-17-2018 , 04:22   Re: how to rearrange lines of .sma
Reply With Quote #2

Go to AMX STUDIO Link : Download

Paste your Code in a New Plugin ( The one which is UNTIDY as per you )

Now PRESS Ctrl + I to Identate the Code
Wait for 1-2 Seconds and ;
You will get a Awesome ( TIDY ) Code
instinctpt1 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-17-2018 , 05:21   Re: how to rearrange lines of .sma
Reply With Quote #3

Or learn how to indent the code manuly, it's not hard.
__________________
HamletEagle 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 05:12.


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