AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Read files not from server dir (https://forums.alliedmods.net/showthread.php?t=113899)

Empowers 12-31-2009 05:51

Read files not from server dir
 
I have my server in "C:\HLserver" dir.

Is it possible to read text from file "C:\lol.txt" ??

Or it's possible only if file is in server dir?

+ karma for answer

wyrda 12-31-2009 06:56

Re: Read files not from server dir
 
Because here http://www.amxmodx.org/doc/index.htm...Fread_file.htm does not specify this matter i think that it is possible.You could try this by writing a little script for test to check if file C:\lol.txt exists.If it exists in this test plugin you could try to read from it and log it(to see it in console).Don't forget to add "debug"(without quotes) in plugins.ini after this test plugin.

I hope you understand my idea.As soon as I can I'll do this test on my own.

Empowers 12-31-2009 07:06

Re: Read files not from server dir
 
file_exists returns 0

wyrda 12-31-2009 12:05

Re: Read files not from server dir
 
I test this and I seem not to work.I also saw that get_datadir return this path addons/amxmodx/data; so folder addons is the lowest folder accessible.

xPaw 12-31-2009 13:02

Re: Read files not from server dir
 
would "../../lol.txt" do the trick ?

wyrda 12-31-2009 19:24

Re: Read files not from server dir
 
Yes.It does the trick xPaw :). The location is actually ../../../lol.txt
1 get out of addons in cstrike
2 get out of cstrike in hlds
3 get out of hlds in partion root(c:\)

Dygear 12-31-2009 19:36

Re: Read files not from server dir
 
Quote:

Originally Posted by wyrda (Post 1038474)
Yes.It does the trick xPaw :). The location is actually ../../../lol.txt
1 get out of addons in cstrike
2 get out of cstrike in hlds
3 get out of hlds in partion root(c:\)

I guess then that all file functions are from the cstrike document root then. I don't see why you can't do a direct method "C:\lol.txt", as all the "../../.." is doing is the same thing.

(I remember seeing this in like Johnny Got His Gun' first post over on the AMX Mod forum like 7 years ago saying he was using "../../../../../../../../../../../../../../../../../../" that to make sure he was going to the drives root. I remember chuckling :) And if I remember correctly, it was because the hl engine does not allow you to read other hard drives, only the drive it is installed on, so you can't use the driver letter syntax.)

fysiks 12-31-2009 19:50

Re: Read files not from server dir
 
There should be no good reason to leave the mod directory.


All times are GMT -4. The time now is 04:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.