AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help. Part of a code to another (https://forums.alliedmods.net/showthread.php?t=183328)

jg_20 04-20-2012 16:33

help. Part of a code to another
 
2 Attachment(s)
Hello

I could help put the code of another?

This code

PHP Code:


LoadMapFile
( const szFile[] )
{
    new 
szText256 ] , iFile;
    
    
iFile fopenszFile "rt" );
    
    while( ( 
g_iVoteMapCount < ( g_iVoteMaps get_pcvar_numg_pVoteMaps ) ) ) && !feofiFile ) && fgetsiFile szText charsmaxszText ) ) )
    {
        
trimszText );
        
        if( ( ( 
szText] == '^0' ) || ( szText] == '/' ) || ( szText] == ';' ) ) || !is_map_validszText ) ) 
            continue;

        
copyg_szVoteMapsg_iVoteMapCount ] , charsmaxg_szVoteMaps[] ) , szText );

        
g_iMapVotesg_iVoteMapCount ][ MapIndex ] = g_iVoteMapCount++;

        
menu_additemg_iVoteMenu szText )
    }
    
    
fcloseiFile );


Oh this code

PHP Code:



public load_votemap_menu(filename[])
{
    new 
szText[20][ 256 ] , iFile;
   
    
iFile fopenfilename "rt" );
   
    
pug_votemap_count 0;
   
    while( ( 
pug_votemap_count VoteMaps ) && !feofiFile ) && fgetsiFile szText[pug_votemap_count] , 255 ) )
    {
        
trimszText[pug_votemap_count] );

 
        
pug_votemap_count++
    }
    
pug_votemap_menu menu_create("Vote Map:","votemap_handle");
    new 
i,o,bool:active[20]
    do
    {
        
o=random_num(0,pug_votemap_count-1)
        if(!
active[o] && random_num(0,2)==1)
        {
                
copypug_votemap_name] , charsmaxpug_votemap_name[] ) , szText[o] );
                
menu_additempug_votemap_menu szText[o] )
                
active[o] = true;
                
g_iMapVotes][ MapIndex ] = i++;
        }
    }
    while(
i<pug_votemap_count)
    
menu_setprop(pug_votemap_menu,MPROP_EXIT,MEXIT_NEVER)
    
menu_setprop(pug_votemap_menu,MPROP_NUMBER_COLOR "\w" ); 
 
    
fcloseiFile );


And this is what I and miss but I get bad

PHP Code:


public load_votemap_menu(filename[])
{
    new 
szText[20][ 256 ] , iFile;
   
    
iFile fopenfilename "rt" );
   
    while( ( 
pug_votemap_count VoteMaps ) && !feofiFile ) && fgetsiFile szText[pug_votemap_count] , 255 ) ) 
    {
        
trimszText[pug_votemap_count] );
       
        if( ( ( 
szText[pug_votemap_count][ ] == '^0' ) || ( szText[pug_votemap_count][ ] == '/' ) || ( szText[pug_votemap_count][ ] == ';' ) ) || !is_map_validszText[pug_votemap_count] ) )
            continue;
 
        
pug_votemap_count++
    }
    
pug_votemap_menu menu_create("Vote Map:","votemap_handle");
    new 
i,o,bool:active[20]
    do
        {
                
copypug_votemap_name] , charsmaxpug_votemap_name[] ) , szText[o] ); 
                
menu_additempug_votemap_menu szText[o] )
                
active[o] = true;
                
g_iMapVotes][ MapIndex ] = i++;
        }
    }
    while(
i<pug_votemap_count)
    
menu_setprop(pug_votemap_menu,MPROP_EXIT,MEXIT_NEVER)

 
    
fcloseiFile );


In Figure 1 is how it should display.

And in Figure 2 is how I get to my place trying. : S


All times are GMT -4. The time now is 07:45.

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