• Help with file.Write() and a Gamemode
    6 replies, posted
hi i am trying to fix a old gamemode and to get it working i am re-writing the save functions that it had before and upon doing so i ran into a error which makes no sense and shouldnt be happening. When the code: [lua]file.Write("ZombifiedWorld/Players/"..tostring(ply:SteamID())..".txt","\n")[/lua] is used, it says, [lua] [gamemodes\zombifiedworld\gamemode\server\player_profiles.lua:179] Lua file rights error. A script tried to access the file "data\ZombifiedWorld\Players\STEAM_0:0:0.txt". Your current rights only allow access to files in GMod's base folder. [/lua] so i want to know how this is happening and how to fix it, i have tryed to use hIO but the filewrite function seems to be broken.
you can't use : in a filename
[lua]FilePath = "ZombifiedWorld/Players/"..string.gsub(ply:SteamID(), ":", "!")..".txt"[/lua] That's what I'm using in my gamemode, and it works fine.
you need a bool at the end of the function i think due to new update (put true to skip data folder)
[QUOTE=dingusnin;25168931]you need a bool at the end of the function i think due to new update (put true to skip data folder)[/QUOTE] Wrong, again. Ignore dingusnin. file.Write wont write :'s, read PortalGods post for the best soloution
instead of steamid use this [url]http://wiki.garrysmod.com/?title=Player.UniqueID[/url]
Sorry, you need to Log In to post a reply to this thread.