[Help] Y_INI + Y_INLINE problem at loading single string.
#1

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

{
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;
}
Reply
#3

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.
Reply
#4

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;

Reply
#5

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.
Reply
#6

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
Reply
#7

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)