SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/07/2006, 03:38 PM   #11
ProRaiL
Big Clucker
 
Join Date: Jul 2006
Posts: 63
Reputation: 0
Default Re: [Dini] INI-files easy!

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
ProRaiL is offline   Reply With Quote
Old 16/07/2006, 06:34 AM   #12
ProRaiL
Big Clucker
 
Join Date: Jul 2006
Posts: 63
Reputation: 0
Default Re: [Dini] INI-files easy!

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
ProRaiL is offline   Reply With Quote
Old 16/07/2006, 02:58 PM   #13
[BDC]Scarface
Big Clucker
 
Join Date: Jun 2006
Posts: 62
Reputation: 0
Default Re: [Dini] INI-files easy!

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

Regards,
Scarface
__________________
known as [DRuG]Scarface
[BDC]Scarface is offline   Reply With Quote
Old 16/07/2006, 06:52 PM   #14
DracoBlue
Gangsta
 
Join Date: Apr 2006
Posts: 680
Reputation: 74
Default Re: [Dini] INI-files easy!

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)
__________________

dcmd 1.0 | dini 1.6 | djson 1.6.2 (The offic. Dini²) | DMap 0.4 | DModule 0.13 (Dynamic GM/FS) | DUDB 2.4 | DTest 1.2 | Dutils 1.10

[dracoblue's dev-diary][php + javascript developer]

DracoBlue is offline   Reply With Quote
Old 17/07/2006, 02:55 PM   #15
tosscops
Little Clucker
 
Join Date: Jul 2006
Posts: 15
Reputation: 0
Default Re: [Dini] INI-files easy!

No, Thanks to YOU!

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

You really do amaze me Draco

tosscops
tosscops is offline   Reply With Quote
Old 16/08/2006, 11:27 PM   #16
{XN}BigPaddy
Little Clucker
 
Join Date: Jul 2006
Posts: 4
Reputation: 0
Default Re: [Dini] INI-files easy!

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 (c) 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;
	}
{XN}BigPaddy is offline   Reply With Quote
Old 17/08/2006, 09:32 AM   #17
DracoBlue
Gangsta
 
Join Date: Apr 2006
Posts: 680
Reputation: 74
Default Re: [Dini] INI-files easy!

dini_Get(propertyNames[property]);

does NOT work.

You need to specify the filename, too.

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

dcmd 1.0 | dini 1.6 | djson 1.6.2 (The offic. Dini²) | DMap 0.4 | DModule 0.13 (Dynamic GM/FS) | DUDB 2.4 | DTest 1.2 | Dutils 1.10

[dracoblue's dev-diary][php + javascript developer]

DracoBlue is offline   Reply With Quote
Old 17/08/2006, 10:22 AM   #18
{XN}BigPaddy
Little Clucker
 
Join Date: Jul 2006
Posts: 4
Reputation: 0
Default Re: [Dini] INI-files easy!

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;
	}
{XN}BigPaddy is offline   Reply With Quote
Old 17/08/2006, 10:43 AM   #19
DracoBlue
Gangsta
 
Join Date: Apr 2006
Posts: 680
Reputation: 74
Default Re: [Dini] INI-files easy!

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

DOES NOT work. Because pname is no INT.

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

dcmd 1.0 | dini 1.6 | djson 1.6.2 (The offic. Dini²) | DMap 0.4 | DModule 0.13 (Dynamic GM/FS) | DUDB 2.4 | DTest 1.2 | Dutils 1.10

[dracoblue's dev-diary][php + javascript developer]

DracoBlue is offline   Reply With Quote
Old 17/08/2006, 12:16 PM   #20
metalpenguin
Little Clucker
 
Join Date: Jul 2006
Posts: 5
Reputation: 0
Default Re: [Dini] INI-files easy!

good work draco i like it
I can see this being used alot
metalpenguin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Way to change .map (MTA Map) files to .pawn (SAMP Files)- luey41 Scripting Help 6 31/07/2012 12:26 AM
[Help] Maybe a easy question for dini users Niixie Help Archive 2 21/01/2010 07:04 PM
Need help with loading multiple info from files [dini] KuHS Help Archive 2 28/10/2009 07:33 PM


All times are GMT. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.