SA-MP Forums Archive
[Dini] INI-files easy! (1.6, 16th Sep 2008) - 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: [Dini] INI-files easy! (1.6, 16th Sep 2008) (/showthread.php?tid=50)

Pages: 1 2


[Dini] INI-files easy! (1.6, 16th Sep 2008) - DracoBlue - 14.05.2006

Lots of guys can't use file write/read-functions, so I give you a ini-file-engine, which just works!

DINI 1.6:
o Download (25000++ Downloads - thanks!)
o HowTo (New HowTo) Dini Login/Register-System
o Blogpost
Hope it will be useful.

Regards,
Jan (DracoBlue)

( Download for previous Version: 1.5.1 )


Re: [Dini] INI-files easy! - caytchen - 14.05.2006

Workaholic?


Re: [Dini] INI-files easy! - DracoBlue - 14.05.2006

Quote:
Originally Posted by caytchen
Workaholic?
No, just insane .


Re: [Dini] INI-files easy! - Slick - 15.05.2006

thanks


Re: [Dini] INI-files easy! - Masta - 29.05.2006

where can i find a list of functions and their usage?
And the dini.dtest script only does the does the first test (Create & Exists) then the server crashes am i doing something wrong?


Re: [Dini] INI-files easy! - DON_FAF - 29.05.2006

Thx jan


Re: [Dini] INI-files easy! - Masta - 29.05.2006

Quote:
Originally Posted by ******
The functions are in the .inc and their use can be derived from looking at the code. Do you have DUtils?
Yes i have DUtils and the Dtest thing for that works alright


Re: [Dini] INI-files easy! - DracoBlue - 29.05.2006

Do you have a folder called scriptfiles ?


Re: [Dini] INI-files easy! - Masta - 01.06.2006

Quote:
Originally Posted by DracoBlue
Do you have a folder called scriptfiles ?
No i didn't, thanks that fixed it


Re: [Dini] INI-files easy! - ProRaiL - 15.07.2006

i found some scary shit here, dini_Set wasn't writing numbers in "value", so i replaced:
Code:
   strcat(tmpres,key);
   strcat(tmpres,"=");
   strcat(tmpres,value);
with:
Code:
format(tmpres, 256, "%s=%d", key, value);
now it works well


Re: [Dini] INI-files easy! - ProRaiL - 15.07.2006

damn, now it isn't writing letters (
i guess i needed to use hash uh?

at least you can make alternative function for numbers only
like dini_Set2


Re: [Dini] INI-files easy! - ProRaiL - 16.07.2006

now i done it completely! it's 100% works!

at the top of "dini_Set"

Code:
new sep[256];
format(sep,sizeof(sep),"=");
and replacing

Code:
strcat(tmpres,"=");
with

Code:
strcat(tmpres,sep);
i see strcat don't like any strings without variable

2DracoBlue if I'm right, you should make a new version with this fix


Re: [Dini] INI-files easy! - [BDC]Scarface - 16.07.2006

Awesome work yet again Draco!!! Sometimes you do freak me out though :P

Regards,
Scarface


Re: [Dini] INI-files easy! - DracoBlue - 16.07.2006

Updated to 1.2.

Speed improvements, and new commands, like dini_Bool, dini_Int and dini_IntSet - read and write integer and boolean values!

Thanks to everyone who uses this!

Regards,
Jan (DracoBlue)


Re: [Dini] INI-files easy! - tosscops - 17.07.2006

No, Thanks to YOU!

What a really useful program!!!!!!!!!

You really do amaze me Draco

tosscops


Re: [Dini] INI-files easy! - {XN}BigPaddy - 16.08.2006

ok what i want to happen is when a player types /buy. it checks for the propertys name and if it exists it finds the owners name (inside the folder) and prints "This Property is owned buy %s". is this posible??, thanx

Code:
C:\DOCUME~1\Patrick\Desktop\Server\GAMEMO~1\src\RPG.pwn(664) : warning 202: number of arguments does not match definition
Pawn compiler 3.0.3367			Copyright © 1997-2005, ITB CompuPhase


1 Warning.
i know that i havent matched the definistion but it was one of my attemts
Code:
	if(strcmp(cmd, "/buy", true) == 0) {
		new property=999;
    GetPlayerName(playerid, pname, sizeof(pname));
		if(IsPlayerInCheckpoint(playerid)) {
			switch (playerCheckpoint[playerid]) {
				case CP_XENDOT:{
				  property = P_XENDOT;
				}
			}

			if(property==999) {
				SendClientMessage(playerid, COLOR_YELLOW, "You need to be in a property checkpoint to /buy it.");
				return 1;
			}

//			property--;

			if(GetPlayerMoney(playerid) < propertyValues[property]) {
				SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this property.");
				return 1;
			}

			if(propertyOwner[property]==playerid) {
				SendClientMessage(playerid, COLOR_RED, "You already own this property.");
				return 1;
			}

			if(dini_Exists(udb_encode(propertyNames[property]))) {
			tmp = dini_Get(propertyNames[property]);
			format(string, sizeof(string), "This Property belongs to %s", tmp);
			SendClientMessage(playerid, COLOR_RED, string);
			return 1;
			}

			GivePlayerMoney(playerid, 0-propertyValues[property]);

			propertyOwner[property]=playerid;
			
			format(string, sizeof(string), "You have purchased the %s!", propertyNames[property]);
			SendClientMessage(playerid, COLOR_GREEN, string);
			dini_Create(udb_encode(propertyNames[property]));
      dini_IntSet(udb_encode(propertyNames[property]), pname, 1);

			}
  		return 1;
	}



Re: [Dini] INI-files easy! - DracoBlue - 17.08.2006

dini_Get(propertyNames[property]);

does NOT work.

You need to specify the filename, too.

dini_Get("properties.ini",propertyNames[property]);


Re: [Dini] INI-files easy! - {XN}BigPaddy - 17.08.2006

Thanx, but how is it how is save the players name after the property because every time i try i get the tag mismatch symbol

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256];
	new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new pname[256];
	new cmd[256];
	new giveplayerid, moneys, idx;
	new tmp[256], tmp2[256];
	new playername[MAX_PLAYER_NAME];

	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/buy", true) == 0) {
		new property=999;
    GetPlayerName(playerid, pname, sizeof(pname));
		if(IsPlayerInCheckpoint(playerid)) {
			switch (playerCheckpoint[playerid]) {
				case CP_AMMU:{
				  property = P_AMMU;
				}

			}

			if(property==999) {
				SendClientMessage(playerid, COLOR_YELLOW, "You need to be in a property checkpoint to /buy it.");
				return 1;
			}

//			property--;

			if(dini_Exists(udb_encode("Propertys.ini"))) {
			tmp = dini_Get("Propertys.ini", propertyNames[property]);
			format(string, sizeof(string), "This Property belongs to %s", tmp);
			SendClientMessage(playerid, COLOR_RED, string);
			return 1;
			}


			if(GetPlayerMoney(playerid) < propertyValues[property]) {
				SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this property.");
				return 1;
			}

			if(propertyOwner[property]==playerid) {
				SendClientMessage(playerid, COLOR_RED, "You already own this property.");
				return 1;
			}

			GivePlayerMoney(playerid, 0-propertyValues[property]);

			propertyOwner[property]=playerid;
			
			format(string, sizeof(string), "You have purchased the %s!", propertyNames[property]);
			SendClientMessage(playerid, COLOR_GREEN, string);
                    dini_IntSet("Propertys.ini", propertyNames[property], pname);
			}
  		return 1;
	}



Re: [Dini] INI-files easy! - DracoBlue - 17.08.2006

dini_IntSet("Propertys.ini", propertyNames[property], pname);

DOES NOT work. Because pname is no INT.

dini_Set("Propertys.ini", propertyNames[property], pname);


Re: [Dini] INI-files easy! - metalpenguin - 17.08.2006

good work draco i like it
I can see this being used alot