Need Explanation
#1

Hello.

So I am still new at scripting and I need an explanation.

For Example:

I have my sex dialog:

PHP Code:
case 0:
                    {
                        new 
INI:File INI_Open(UserPath(playerid));
                        
INI_SetTag(File"data");
                        
INI_WriteInt(File,"Spol",0);
                        
INI_Close(File);
                        
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Odabrali ste spol: muљko");
                    }
                    case 
1:
                    {
                        new 
INI:File INI_Open(UserPath(playerid));
                        
INI_SetTag(File"data");
                        
INI_WriteInt(File,"Spol",1);
                        
INI_Close(File);
                        
SendClientMessage(playerid,-1,"{00C0FF}WG:{FFFFFF} Odabrali ste spol: ћensko");
                    } 
Right here you can see my code.
I want to make instead of this:

PHP Code:
INI_WriteInt(File,"Spol",0); 
To save it something like this:

PHP Code:
INI_WriteInt(File,"Spol",Male); 
And here i need help and explanation how to save it in words instead of numbers. Thanks
Reply
#2

Use INI_WriteString (It saves String) instead of INI_WriteInt (It saves Integer value)
pawn Code:
INI_WriteString(ini, "Spol", "Male");
See https://sampforum.blast.hk/showthread.php?tid=175565 for info about loading a string.
Use strcmp to compare the string with "Male".

EDIT: Load it like:

pawn Code:
new Sex[10];
INI_String("Spol", Sex, sizeof(Sex));
Compare it like:
pawn Code:
if(!strcmp(Sex, "Male", true, 4))
{
    //It is male
}
Reply
#3

Thank you guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)