![]() |
Editing .txt files
How can you edit .txt files online, with multiline edit, and then save it? Like
lets say this is in pwn.txt "HI there". Then, how would you edit pwn.txt from "HI there" to "NOOB" and save it? |
PHP Code:
To get an array of lines from a text file, PHP Code:
|
Quote:
Quote:
|
Also, I have
PHP Code:
|
Quote:
|
Quote:
Quote:
i would also believe that setting the player.chat wouldnt work due the textlimit on 256 chars, so try something like echo or sendrpgmessage instead |
Quote:
The GUI parameter is not required for triggerclient. TServerPlayer.triggerclient(str) vs triggerserver(str, str) Quote:
for some incredibly stupid reason this is not a requirement for loading files, the NPC Server can load any file at any time, only requires write for savelines |
Quote:
|
Just tested this on Unholy Nation, server had no rights to weapons folder.
PHP Code:
GRAWP001,"REALNAME Joltbomb","IMAGE joltbomb.png",SCRIPT,"function onactionserverside() {"," if (params[0] == ""reduce"") {"," player.bombs -= 1;"," }",},//#CLIENTSIDE,"function onweaponfired() {"," if (player.bombs < 1) return(0);"," if (player.level.name == ""unevent_platforms.nw"") {"," player.chat = ""A magical force is blocking you."";"," return(0);"," }"," freezeplayer(0.2);"," setani(""grab"","""");"," triggerserver(""gui"",this.name,""reduce"");"," putbomb(3,player.x%64+vecx(player.dir)*2+0.5,playe r.y%64+vecy(player.dir)*2+0.5);",},SCRIPTEND |
Quote:
I know I've had issues where read rights were required in the past on servers. Also, why are you using 'new TGraalVar'? Quote:
|
just a habit I have from other languages, it seems bizarre to me to just immediately use an object without defining it.
I also don't get any RC error like that. |
Quote:
Arrays aren't objects any more than a normal string or number, defining it like that is just silly, not to mention wrong. Quote:
PHP Code:
|
I guess the thing that seems the most awkward to me about it is both creating and filling the object by a function rather than an equal sign. Something about
temp.f.loadlines("textfile") creating object f and inserting data just seems wrong to me I guess I should probably stop since it can't be created by script, but I'd probably to start commenting every time I use it because I'd wonder where it came from later in the script |
| All times are GMT +2. The time now is 04:04 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.