AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP with some codes. (https://forums.alliedmods.net/showthread.php?t=93420)

lolzin123 05-28-2009 15:11

HELP with some codes.
 
GodMode:

PHP Code:

case 6// GodMode
        
if( get_user_flags(plr0)&ADMIN_KICK )
        {
            if (!
get_user_godmode(plr))     
            {
                
set_user_godmode(plr,1);
                
                new 
szName[32];
                
get_user_name(plrszName32);
    
                
fnGreenChat(0"[BCM] %s ligou o GodMode."szName);
            }
        }
        else 
        {
            
set_user_godmode(plr,0);
            
            new 
szName[32];
            
get_user_name(plrszName32);
    
            
fnGreenChat(0"[BCM] %s desligou o GodMode."szName);
        }
    } 

I want every time you press the button, turn on or off.

AND SAVE/LOAD:
PHP Code:

case 5// Save/Load
        
{
            new 
szTitle[49];
            
format(szTitle48"Load Menu - Current: %s"gCurConfig);
            
            new 
menu menu_create(szTitle"mnuLoad"0);
            
            new 
szAccessFlag[2];
            
get_pcvar_string(gCvarAccessLoadszAccessFlag1);
            new 
accessLoad read_flags(szAccessFlag);
            
            new 
dir open_dir(gDir""0);
            
            new 
szFileName[65];
            while( 
next_file(dirszFileName64) )
            {
                if( 
szFileName[0] == '.' )
                {
                    continue;
                }
                
                
replace(szFileName64".txt""");
                
menu_additem(menuszFileName""accessLoad, -1);
            }
            
close_dir(dir);
            
            
menu_additem(menu"New Config""1"0, -1);
            
            
menu_additem(menu"Save""2"0, -1);
            {
            new 
szName[32];
            
get_user_name(plrszName31);
            
            
fnGreenChat(0"[BCM] %s saved config ^"%s^", %i objects."szName,
                
gCurConfigfnSave());
            }
            
            
menu_setprop(menuMPROP_EXITNAME"Main Menu");
            
            
menu_display(plrmenu0);
            
            return 
PLUGIN_CONTINUE;
            
            
/*new ent = fnGetAimEnt(plr);
            
            new type = fnGetObjectType(ent);
            if( type && type != 99 )
            {
                new szName[32];
                pev(ent, pev_targetname, szName, 31);
                
                if( szName[0] == '^0' )
                {
                    copy(szName, 31, "Unknown");
                }
                
                fnGreenChat(plr, "[KzM] Creator: %s", szName);
            }
            else
            {
                fnGreenChat(plr, "[KzM] Aim at an object first.");
            }*/
        


I want to save, create cfg's, and load.Because saving has a bug.

Any help will be very grateful. :)

zacky 05-28-2009 15:26

Re: HELP with some codes.
 
PHP Code:

case 6// GodMode 
        
if( get_user_flags(plr0)& ADMIN_KICK 
        { 
            if (!
get_user_godmode(plr))      
            { 
                
set_user_godmode(plr,1); 
                 
                new 
szName[32]; 
                
get_user_name(plrszName32); 
     
                
fnGreenChat(0"[BCM] %s ligou o GodMode."szName); 
            }
            else  
            { 
                
set_user_godmode(plr,0); 
             
                new 
szName[32]; 
                
get_user_name(plrszName32); 
     
                
fnGreenChat(0"[BCM] %s desligou o GodMode."szName); 
            } 
        } 
    } 

This is only godmode

lolzin123 05-29-2009 16:39

Re: HELP with some codes.
 
But I want to add it to a menu, which can connect and disconnect the godmode.Any idea?

zacky 05-29-2009 17:23

Re: HELP with some codes.
 
Show me hold code then


All times are GMT -4. The time now is 13:47.

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