new ooc[2];
ooc = ?????; // <----- The value of "ooc" in "scriptfiles/settings.ini"
if(ooc == 1){
//continue with sending message
} else {
SendClientMessage(playerid, COLOR_LIGHTBLUE, "/OOC chat has been disabled by admins.");
}
Why would yuo want to use it as a string? Either read and store as integer or bool.
|
But what if one of the lines in the INI file is something like...
Faction = LSPD or does everything have to be integers? like.. Faction_ID = 3 Or what is bool? |
INI_ParseFile( "settings.ini", "LoadSettings_%s" );
// "settings.ini" is our file, and "LoadSettings" is our callback.
public LoadSettings_info ( name[], value[] )
{
// Every time you write information to the settings file, you have to use INI_SetTag( fileVariable, "info" );
INI_Int( "OOC", ooc );
// This loads the integer "OOC" into the variable "ooc"
INI_String( "FACTION_0", FactionNames [ 0 ], 64 );
// This loads the string "Faction" into the variable "FactionNames [ 0 ]" with a length of 64 cells.
}
new
INI: mySettingFile = INI_Open( "settings.ini" );
INI_SetTag( mySettingFile, "info" );
INI_WriteInt( mySettingFile, "OOC", 1 );
INI_WriteString( mySettingFile, "FACTION_0", "LSPD" );
INI_Close( mySettingFile );
// Don't forget to close the file after you're done working with it!
//load config file
INI_ParseFile( "settings.ini", "LoadSettings_%s" );
public LoadSettings_info ( name[], value[] )
{
// Every time you write information to the settings file, you have to use INI_SetTag( fileVariable, "info" );
INI_Int("OOC", ooc);
return 1;
}
F:\SAMP\gamemodes\naterp.pwn(198) : error 025: function heading differs from prototype
F:\SAMP\gamemodes\naterp.pwn(198) : error 021: symbol already defined: "INI_ParseFile"
F:\SAMP\gamemodes\naterp.pwn(200) : warning 235: public function lacks forward declaration (symbol "LoadSettings_info")
F:\SAMP\gamemodes\naterp.pwn(204) : error 033: array must be indexed (variable "ooc")
F:\SAMP\gamemodes\naterp.pwn(206) : warning 217: loose indentation
F:\SAMP\gamemodes\naterp.pwn(206) : error 079: inconsistent return types (array & non-array)
forward LoadSettings_info ( name[], value[] );
//load config file
forward LoadSettings_info ( name[], value[] );
INI_ParseFile( "settings.ini", "LoadSettings_%s" );
public LoadSettings_info ( name[], value[] )
{
// Every time you write information to the settings file, you have to use INI_SetTag( fileVariable, "info" );
INI_Int("OOC", ooc);
return 1;
}
F:\SAMP\gamemodes\naterp.pwn(198) : error 025: function heading differs from prototype
F:\SAMP\gamemodes\naterp.pwn(198) : error 021: symbol already defined: "INI_ParseFile"
F:\SAMP\gamemodes\naterp.pwn(204) : error 033: array must be indexed (variable "ooc")
F:\SAMP\gamemodes\naterp.pwn(206) : warning 217: loose indentation
F:\SAMP\gamemodes\naterp.pwn(206) : error 079: inconsistent return types (array & non-array)
That one compiles just fine. this is my full file
http://pastebin.com/DVL6pi7C Maybe you can DL it and try it on your end? |