SA-MP Forums Archive
Adding to a variable (DINI) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding to a variable (DINI) (/showthread.php?tid=124340)



Adding to a variable (DINI) - Haegon - 30.01.2010

Okay, here is my problem.

I am using Dini to make a material system. Every time someone picks up the materials, I want it to add a set number (300) to the current total of materials in the player's .ini file, the variable being "Jobs". Here is the code I have:

Код:
format(string, sizeof(string),"/xadmin/Users/%s.ini", udb_encode(PlayerName));
new number = dini_Int(string, "Job");

       if(number == 6)
	   {
	       dini_IntSet(string, "MatA", 300);
		   SendClientMessage(playerid, COLOR_RED,"You've recieved 300 A Materials for your packages!");
	   }
It just sets the value to 300 every time. I want it to add 300 to the total. Any clue as to how?

Thank you ahead of time.


Re: Adding to a variable (DINI) - bogeymanEST - 30.01.2010

Try this.
pawn Код:
dini_IntSet(string, "MatA", dini_Int(string, "MatA")+300);