Regarding fseek() - 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: Regarding fseek() (
/showthread.php?tid=180190)
Regarding fseek() -
xxxDunecatxxx - 30.09.2010
Hey guys, I was curious about pawn's fseek function so I thought I'd ask here.
Is it possible to make a command that searches through all ini files until it finds a certain value?
Let's say I want to make a /listallcops command for admins, it would list every single cop regardless if they're offline. I've been trying to make this for a while now but I didn't get any luck.
Basically I want it to go through every single ini file until it finds the value that I want, and I want it to do this without completely crashing the server lol.
Help would be appreciated.
Re: Regarding fseek() -
xxxDunecatxxx - 30.09.2010
Oh also I have one more question regarding files. I'm not going to make a new thread for it so I'll just post here.
I just made a new system that detects how long a player has been offline, it uses gettime() on disconnect and stores it as "DiscTime" in their ini file, and I made a command that does gettime() - <playerfilegettime> and it returns how many seconds they've been offline.
One problem though, I used this command on a player that doesn't have "DiscTime" created in their ini file, and it crashed my server. I use dini to get values and it works perfectly.
What would I need to use to see if they have "DiscTime" created in their ini file? fseek? fread?
Re: Regarding fseek() -
wups - 30.09.2010
I'm afraid that is not possible, only in SQL.

I recommand you changing to it.
If you still wan't to stay with file function do this:
create a file, where all cops will be listed.
When a cop starts working insert his name in to the file.
When he stops working - remove his name.
And i think you can make the check yourself.
Quote:
Originally Posted by xxxDunecatxxx
Oh also I have one more question regarding files. I'm not going to make a new thread for it so I'll just post here.
I just made a new system that detects how long a player has been offline, it uses gettime() on disconnect and stores it as "DiscTime" in their ini file, and I made a command that does gettime() - <playerfilegettime> and it returns how many seconds they've been offline.
One problem though, I used this command on a player that doesn't have "DiscTime" created in their ini file, and it crashed my server. I use dini to get values and it works perfectly.
What would I need to use to see if they have "DiscTime" created in their ini file? fseek? fread?
|
I use dini for that.
pawn Код:
new disctime = dini_Int(file,"DiscTime");
if(!disctime) return 0;
Re: Regarding fseek() -
xxxDunecatxxx - 30.09.2010
Alright, thanks for the help.
What do you guys think of me storing their FactionMember value in some database using HTTP? Even though its stored in ini, I thought about storing it in HTTP as well just so I could grab a list of everyone who's a cop.
Re: Regarding fseek() -
wups - 30.09.2010
why not in MySQL?
Re: Regarding fseek() -
xxxDunecatxxx - 30.09.2010
HTTP is the same thing as MySQL except its made by SAMP themselves
Re: Regarding fseek() -
Sergei - 30.09.2010
Quote:
Originally Posted by xxxDunecatxxx
HTTP is the same thing as MySQL except its made by SAMP themselves
|
Good one haha.
Re: Regarding fseek() -
xxxDunecatxxx - 30.09.2010
If you think about it, it really is. I use HTTP to store things into a ****** appengine database like player IP addresses and usernames just to expirement with them and they work similar to MySQL since you can use GQL to submit queries