SA-MP Forums Archive
Getting a certain string in a file - 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: Getting a certain string in a file (/showthread.php?tid=179078)



Getting a certain string in a file - Jochemd - 25.09.2010

Hello,

I want to get a certain string out a file. For example: a Player Name. How do I do this with dini? I tried: dini_Get, dini_Int (and I was ensured it wouldnt work cause it is 'integer'). What do I need to use?

Regards, Jochem


Re: Getting a certain string in a file - DeathOnaStick - 25.09.2010

If it's a .ini-file use dini_Get. If not, store the whole file in a string, and then use strfind to find the value you are looking for. Anyway i think the strfind sollution is no real sollution, if it's a .ini file, really use dini_Get.


Re: Getting a certain string in a file - Jochemd - 25.09.2010

Can you show me how to check for an empty key?


Re: Getting a certain string in a file - bigcomfycouch - 25.09.2010

Use the isnull macro.

pawn Код:
#define isnull(%1)                        (!%1[0] || (%1[0] == '\1' && !%1[1]))



Re: Getting a certain string in a file - Jochemd - 01.10.2010

How to use that?


Re: Getting a certain string in a file - LarzI - 01.10.2010

if(isnull(stringVar))

returns false if the string contains more than \1 and \0 (empty space and null)
returns true if the string is empty (contains only space and/or null)


Re: Getting a certain string in a file - Jochemd - 01.10.2010

pawn Код:
if(isnull(dini_Get("JoAdmin/Configuration/HouseInfo.ini","House1Owner")))
= giving errors...


Re: Getting a certain string in a file - Jochemd - 01.10.2010

Really, what is wrong in that? I also tried it with a variable, giving errors...


Re: Getting a certain string in a file - LarzI - 01.10.2010

What errors?