Spoiler addhook("say","WhenSay") -- This Sets It So When You Call Function WhenSay You're Really Calling Function say. This MUST Be Done.
function WhenSay(id,txt) -- This Is The Function say With The Parameters Of id ( player id ) and txt ( message player typed )
if (txt == "!save") then -- Checks If You Say !save
io.output(io.open("sys/lua/SimpleSave.txt","w+")) -- Opens The File You're Writing Data To
io.write(player(id,"health")) -- Writes The Data To The File Named SimpleSave.txt Located In The Lua Folder.
io.close() -- Closes The File. Without This, It Will Not Reload.
msg2(id,"Saved Your Hp To SimpleSave.txt") -- Shows The Player That Said !save A Approvement Message
else -- Else If You Say !load
if (txt == "!load") then -- Checking If You Say !load
for line in io.lines("sys/lua/SimpleSave.txt") do -- This Is Setting Line To The VERY FIRST Line In The Text. Remember That For Loading More Than 1 On A Text File.
msg2(id,"This Is What Your Hp Was Saved As: "..line..".") -- Shows The Player The Hp That Was Loaded.
end -- Ends The For Line In....
end -- Ends The if (txt == "!load").....
end -- Ends The If !Save
end -- Closes The Function Out