AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   load from file and make every line into a parameter or like that[fixed] (https://forums.alliedmods.net/showthread.php?t=89769)

Owyn 04-10-2009 09:33

load from file and make every line into a parameter or like that[fixed]
 
hi, i want to make each case be not "text" but param with text which is loaded from a line of file, so 1st param will be 1st line, 2nd = 2nd etc
for this code (i want to try if this gonna help me make plugin work with UTF-8 characters cuz compiler won't let me compile anything with UTF-8 non-english characters so i wan't to try put em outside the plugin

PHP Code:

    switch (said[i])
    {
        case 
'z'1
        
case 'x'2
        
case 'c'3
        
case 'v'4
        
case 'b'5
        
case 'n'6
        
case 'm'7


here is how it should load a file i think but i need to make it into lines and 7 params

PHP Code:

      addfilename"/lol.ini" );
}

public Function()
{
      if( 
file_exists(filename) )
      {
            new 
dataread[250];
            new 
fs fopenfilename );
            while( !
feof(fs) ) // Keep looping untill the end of the file.
            
{
                  
fgetsfsdatareadsizeof dataread );
                  
// Now dataread contains what's in the lol.ini 
                  
(untill next line).
                  
client_print0print_chat"Test: %s"dataread );
                  
// Shows the info we got from the file to all players.
            
}

            
fclosefs ); // We must close the file after we opened it.
      


}

so lol.ini will be
PHP Code:

z
x
c
v
b
n



fysiks 04-10-2009 10:05

Re: load from file and make every line into a parameter or like that
 
Maybe if you encode your sma as Unicode without BOM. I don't know how Unicode works with pawn or HL.

Owyn 04-10-2009 10:07

Re: load from file and make every line into a parameter or like that
 
lang files works fine if i set them to unicode, only problem is compiler won't let me compile anything with unicode


All times are GMT -4. The time now is 02:14.

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