y-ini help
#1

Can someone help me with this code:
Код:
new donate;
	 	new file = ini_openFile("donate.ini");
		if(ini_getInteger(file, inputtext) == 0)
		{
			if(donate == 1)
			{
	  			SendClientMessage(playerid,-1,"VIP Account activated");
	  			
				return 1;
			}
			if(donate == 2)
			{
	  			SendClientMessage(playerid,-1,"Level UP to 1 point");
	  			
				return 1;
			}
			if(donate == 3)
			{
	  			SendClientMessage(playerid,-1,"Phone Number changed for 4 symbols");
				return 1;
			}
			ini_removeKey(file,inputtext);
			SendClientMessage(playerid,-1,"Thank's for donate");
		}
		else
		{
			SendClientMessage(playerid,-1,"Wrong Code");
		}
		iniClose(file);
I can't make it with y-ini. : (
Reply
#2

Explain more
what is your problem and what do you want to do with this system ?
Reply
#3

It doesn't want to read from the file. It's maked with mxINI system. I want to make it with Y\INI.
Reply
#4

For create new ini file with Y_INI use "INI_Open".
and for load them make a function and use "INI_ParseFile".
Read ****** Tutorial about Y_INI: https://sampforum.blast.hk/showthread.php?tid=175565
Reply
#5

I don't know how to do the things with the INI_ParseFile
Reply
#6

you have to define new variables and load ini data into it.
for example i have a player ini file and i want to load player money to "PlayerMoney[playerid]" Variable.
"INI_ParseFile" need call a function. so we will make it

my.ini file content:
[data]
Money = 2000

pawn Код:
new PlayerMoney[MAX_PLAYERS]; //>defining the variable

//>creating function
forward MyFunction_data(playerid,name[],value[]);
public MyFunction_data(playerid,name[],value[])
{
 INI_Int("Money",PlayerMoney[playerid]); //> Loading an integer (player money amount) from "Money" Value to PlayerMoney[playerid] variable
 return 1;
}

INI_ParseFile("my.ini", "MyFunction_%s", .bExtra = true, .extra = playerid);
Reply
#7

hm... This is not the purpose of the system.

When u type /donate will show u a dialog. In this dialog u will type a code. If the code is right will give you a cash for example. If u try to enter the same code again should say the code is wrong. And i want make this system with 100-200 codes in file, but i don't know how to read the codes from the file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)