SA-MP Forums Archive
[Help] Y_INI + Y_INLINE problem at loading single string. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Y_INI + Y_INLINE problem at loading single string. (/showthread.php?tid=569438)



[Help] Y_INI + Y_INLINE problem at loading single string. - Equality - 30.03.2015

hey, why it aint work?
http://pastebin.com/M29v6GV6


Re: [Help] Y_INI + Y_INLINE problem at loading single string. - NoDi522 - 30.03.2015

{
new str[126],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name)); // I changed this with ( ) . I dont know if that is mistake but you miss it.
inline SingleString(string:name[], string:value[])
{
INI_String("pName",str,126);
}
INI_ParseFile(name,using inline "SingleString");
printf(str);
return 1;
}


Re: [Help] Y_INI + Y_INLINE problem at loading single string. - Equality - 30.03.2015

Quote:
Originally Posted by NoDi522
Посмотреть сообщение
{
new str[126],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name)); // I changed this with ( ) . I dont know if that is mistake but you miss it.
inline SingleString(string:name[], string:value[])
{
INI_String("pName",str,126);
}
INI_ParseFile(name,using inline "SingleString");
printf(str);
return 1;
}
no changes.


Respuesta: [Help] Y_INI + Y_INLINE problem at loading single string. - JuanStone - 31.03.2015

You should first make sure you know what you want to upload, the code that you left off is good, the only error is what said Y_lees.

PHP код:
public OnPlayerConnect(playerid)
{
    new 
name[MAX_PLAYER_NAME+1], str[126];
    
GetPlayerName(playeridnamesizeof(name));
    
    
inline SingleString(string:name[], string:value[])
    {
        
INI_String("pName"str126);
    }
    
INI_ParseFile(name"SingleString");
    return 
true;

That would be the correct code but you should bear in mind that you are loading the value of "pname" in a local string, to return to use it would have to reload it, apart from the file should be as follows: "server/scriptfiles/%s.ini"

I don't know what makes your code in reality, I believe that loads the name for the route and reload in a variable.

This would be a code more comfortable.

PHP код:
public OnPlayerConnect(playerid)
{
    
inline loaddatauser(string:name[], string:value[])
    {
        
INI_String("", var, size);
        
// more data players..
    
}
    
INI_ParseFile(FolderRuta(playerid), "loaddatauser");
    return 
true;
}
FolderRuta(playerid)
{
    new 
string[39], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "/Folder/%s.ini"name);
    return 
string;




Re: Respuesta: [Help] Y_INI + Y_INLINE problem at loading single string. - Equality - 31.03.2015

Quote:
Originally Posted by ******
Посмотреть сообщение
INI_ParseFile takes a string format, not a function directly, so you don't need the "using inline" part in this case. Also, currently your code entirely ignores tags, so they will ALL be loaded by that one function.
I didnt actually get what you tryed to say in here.
Why my code ignoring tags?
Quote:
Originally Posted by JuanStone
Посмотреть сообщение
You should first make sure you know what you want to upload, the code that you left off is good, the only error is what said Y_lees.

PHP код:
public OnPlayerConnect(playerid)
{
    new 
name[MAX_PLAYER_NAME+1], str[126];
    
GetPlayerName(playeridnamesizeof(name));
    
    
inline SingleString(string:name[], string:value[])
    {
        
INI_String("pName"str126);
    }
    
INI_ParseFile(name"SingleString");
    return 
true;

That would be the correct code but you should bear in mind that you are loading the value of "pname" in a local string, to return to use it would have to reload it, apart from the file should be as follows: "server/scriptfiles/%s.ini"

I don't know what makes your code in reality, I believe that loads the name for the route and reload in a variable.

This would be a code more comfortable.

PHP код:
public OnPlayerConnect(playerid)
{
    
inline loaddatauser(string:name[], string:value[])
    {
        
INI_String("", var, size);
        
// more data players..
    
}
    
INI_ParseFile(FolderRuta(playerid), "loaddatauser");
    return 
true;
}
FolderRuta(playerid)
{
    new 
string[39], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "/Folder/%s.ini"name);
    return 
string;

ive tryed that, the verb still not getting formated by the file.



Re: Respuesta: [Help] Y_INI + Y_INLINE problem at loading single string. - Equality - 02.04.2015

Quote:
Originally Posted by Equality
Посмотреть сообщение
I didnt actually get what you tryed to say in here.
Why my code ignoring tags?

ive tryed that, the verb still not getting formated by the file.
bump


Respuesta: [Help] Y_INI + Y_INLINE problem at loading single string. - JuanStone - 02.04.2015

I believe it would be better if explain more what you are trying to make, this is quite easy to make but you do not understand much or i understand what you are trying to make you, there a explanation with another code.



PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <YSI\y_inline>

public OnPlayerConnect(playerid)
{
    new 
string[126], Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));

    if(
fexist(Name)) // if exist file with your name in script files load {""}
    
{
        
inline LoadString(string:name[], string:value[]) // load ini
        
{
            
INI_String("pName"string126); // load text from line name "pname" in string name "string".
        
}
        
INI_ParseFile(Name"LoadString"); // take effect the above with this,
        
printf("String loaded: %s"string); // prinf with text loaded
    
}
    else if(!
fexist(Name)) // if not exist file in scriptfiles
    
{
        new 
INI:File INI_Open(Name); // new ini file with name(Name)
        
INI_SetTag(File"Example"); // tag for load ini affter
        
INI_WriteString(File"pName""Hello this is INI"); // write line pname whith text hello this..
        
INI_Close(File); // ini close file.
    
}
    return 
true;