SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 30/12/2008, 06:47 PM   #1
boylett
Huge Clucker
 
Join Date: Jul 2006
Posts: 441
Reputation: 0
Default [INC] Xini v2 - Edit INI files

Xini v2
Allows you to edit INI files in the following format:
Code:
[header]
key=value
key2=value
[header2]
key=value
key2=value
I'm not sure what happened to the old topic.. I searched on "xini" but nothing came up, so here's a new topic :P


Quote:
Xini version 2
Created by Boylett
Copyright (c) Boylett.com


All included files are in there alotted folders.
Quote:
LICENSE

You may edit and release modified versions of the script, so long as credit is given to the original author, Boylett.
You must have written permission from Boylett, on Boylett.com, before you release a modified version.

Failure to abide by this license means you may not use this include.
boylett is offline   Reply With Quote
Old 30/12/2008, 08:32 PM   #2
Kowalski
Big Clucker
 
Join Date: Mar 2007
Posts: 68
Reputation: 1
Default Re: [INC] Xini v2 - Edit INI files

I cannot test it at the moment, but I've downloaded it. I know you're a good and helpful scripter, thank you for this work!

Ковалски
Kowalski is offline   Reply With Quote
Old 30/12/2008, 08:38 PM   #3
Serbish
Gangsta
 
Join Date: Apr 2008
Posts: 606
Reputation: 31
Default Re: [INC] Xini v2 - Edit INI files

What should this be?
Serbish is offline   Reply With Quote
Old 30/12/2008, 09:41 PM   #4
Donuts
Huge Clucker
 
Donuts's Avatar
 
Join Date: Jun 2008
Posts: 225
Reputation: 4
Default Re: [INC] Xini v2 - Edit INI files

I know what is this for but could you post an example plox? (:
this looks interesting.
__________________
Need help with something? Email me donuts@ng-gaming.net

Daniel Varela
Scripter
Next Generation Gaming LLC

More than Next Generation Roleplay, many more games, it's a great community, try it now.
Visit us at http://www.ng-gaming.net/
Donuts is offline   Reply With Quote
Old 30/12/2008, 10:15 PM   #5
Magor
Little Clucker
 
Join Date: Jan 2008
Posts: 24
Reputation: 2
Default Re: [INC] Xini v2 - Edit INI files

[red]Useless[/red]
pawn Code:
xini_remove(filename[])
{
  if(!fexist(filename)) return false;
  fremove(filename);
  return true;
}
[blue]native bool:fremove(const name[]);[/blue] fails if the file doesn't exist.
Basically this does exactly the same as fremove (not thinking about uselessly called fexist...).

[red]Uneffective, bad managed code[/red]
pawn Code:
new File:file, File:file2, line[MAX_STRING], key2[MAX_STRING], header2[MAX_STRING], filename2[MAX_STRING], tmp[MAX_STRING];
  format(filename2,MAX_STRING,"%s.xini",filename);
  if((file = fopen(filename,io_read)) && (file2 = fopen(filename2,io_write)))
[blue]MAX_STRING = 255[/blue] => you allocate 1275 bytes of memory (what is really a lot for a such simple function) even before checking if the file exists...
Seriously, first learn how to write effective code and JUST then release something.

[red]Doesn't allow you to choose file name[/red]
pawn Code:
format(filename2,MAX_STRING,"%s.xini",filename);
Because it always appends .xini to end of the file name.

[red]Bad written include[/red]
pawn Code:
native xini_get(filename[],header[],key[],bool:ignorecase=true);
native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);
native xini_iskeyset(filename[],header[],key[],bool:ignorecase=true);
native xini_isheaderset(filename[],header[],bool:ignorecase=true);
native xini_setint(filename[],header[],key[],value,bool:ignorecase=true);
native xini_int(filename[],header[],key[],bool:ignorecase=true);
native xini_setfloat(filename[],header[],key[],Float:value,bool:ignorecase=true);
native Float:xini_float(filename[],header[],key[],bool:ignorecase=true);
native xini_create(filename[]);
native xini_remove(filename[]);
native xini_truncreate(filename[]);
native xini_getstore(filename[],value[],refheader[],refkey[],offset=0,bool:ignorecase=true);
xini_set is [blue]bool[/blue], but native is withoud [blue]"bool"[/blue] -> [green]native xini_set(filename[],header[],key[],value[],bool:ignorecase=true);[/green] <- (the same problem with xini_iskeyset, xini_isheaderset, xini_setint, xini_setfloat, xini_getstore, xini_unsetheader)

These functions aren't [blue]stock[/blue]-ed, so compiler compiles entire include even if you don't use any of xini functions.

And also there is [red]"unnatived"[/red] function... so if you don't read entire include (because it is the last function in the include), you won't probably know about xini_unsetheader...

EDIT: Windows already contains similar functions: [green]GetPrivateProfileString WritePrivateProfileString[/green] -> perfect idea for a plugin.
Magor is offline   Reply With Quote
Old 30/12/2008, 10:22 PM   #6
Magor
Little Clucker
 
Join Date: Jan 2008
Posts: 24
Reputation: 2
Default Re: [INC] Xini v2 - Edit INI files

Quote:
[red]I believe this isn't his latest script[/red] and mistakes happen.
[green]Look when was this topic created[/green]
[INC] Xini v2 - Edit INI files
on: Today at 11:47:45 am
Magor is offline   Reply With Quote
Old 30/12/2008, 10:36 PM   #7
boylett
Huge Clucker
 
Join Date: Jul 2006
Posts: 441
Reputation: 0
Default Re: [INC] Xini v2 - Edit INI files

Magor: everything you said is true, but the way you said just makes me think of you as someone who decides to go through the internet pissing people off and trying to look smart. For that reason, I don't think I'll bother with any of your "suggestions" until I get round to it myself. wanker

And at the time of creation, fremove crashed if used on a file which didn't exist.

BTW, I think you mean effecient. The code is effective at what it does.

Quote:
Originally Posted by Magor
Quote:
[red]I believe this isn't his latest script[/red] and mistakes happen.
[green]Look when was this topic created[/green]
[INC] Xini v2 - Edit INI files
on: Today at 11:47:45 am
This script was created months ago, I'm just reposting it.
boylett is offline   Reply With Quote
Old 30/12/2008, 10:37 PM   #8
Serbish
Gangsta
 
Join Date: Apr 2008
Posts: 606
Reputation: 31
Default Re: [INC] Xini v2 - Edit INI files

Quote:
Originally Posted by Boylett
wanker
Lol'ed at this.
Serbish is offline   Reply With Quote
Old 30/12/2008, 10:40 PM   #9
boylett
Huge Clucker
 
Join Date: Jul 2006
Posts: 441
Reputation: 0
Default Re: [INC] Xini v2 - Edit INI files

Quote:
Originally Posted by -=[Serbish
=- ]
Quote:
Originally Posted by Boylett
wanker
Lol'ed at this.
You're not supposed to quote out my [size] tags
boylett is offline   Reply With Quote
Old 30/12/2008, 10:48 PM   #10
Magor
Little Clucker
 
Join Date: Jan 2008
Posts: 24
Reputation: 2
Default Re: [INC] Xini v2 - Edit INI files

Quote:
Magor: everything you said is true, but the way you said just makes me think of you as someone who decides to go through the internet pissing people off and trying to look smart. For that reason, I don't think I'll bother with any of your "suggestions" until I get round to it myself. [red]wanker[/red]
Code:
<span style="font-size: 3pt; line-height: 1.3em;">wanker</span>
HAHA, nice way how to show what are you thinking about
Magor 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 30/07/2012 11:26 PM
files, fuck files! but need them though. legodude Help Archive 3 11/04/2010 01:47 PM
How to edit sampdb files xomka Help Archive 2 24/10/2009 01:25 PM


All times are GMT. The time now is 02:35 PM.


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