- Joined
- Aug 16, 2018
- Messages
- 11
So I have a save code that writes save codes to a text file with preload functions, but the file writes to all players. How can I write it to only the player that typed -save?
if GetLocalPlayer() == writer then
...
endif
Use a Local Player clause. E.g.
JASS:if GetLocalPlayer() == writer then ... endif
function createTextFile takes player PL returns nothing
local string FolderName = "Site"
local string FileName = "Sample"
local string FileType = ".txt"
if GetLocalPlayer() == PL then
// Initialize Preload Functions
call PreloadGenClear()
call PreloadGenStart()
// Write
call Preload( "\n\nwww.hiveworkshop.com\n\n" )
// Close It
call PreloadGenEnd( FolderName + "\\" + FileName + "\\" + FileType )
endif
endfunction
it works thanks +repYeah, you can't locally DO something without a desync. That changes the game state for some players. What you CAN do is locally change the text of the save file for some players.
- If - All Conditions...
- GetLocalPlayer equal to (Triggering Playrr)
- Then - Actions
- Set filestring = "your long thing inside the WriteFile"
- Else - Actions
- Set filestring = "" //an empty string so writefile does nothing
- Custom script call WriteFile(udg_filestring) //write it outside the localplayer if block so no desync