Jump to content

[HELP]save skin for job


Drackles

Recommended Posts

This varies according to the resource you use. Since you do not show the code, I will explain the logic, but if you have a save system, you may need to write more code than that.

 

you can call the savePlayerDefaultSkin function before the job starts and when the job is finished you can call the loadPlayerDefaultSkin function

local playerDefaultSkin = {} -- define storage for player default skins

function savePlayerDefaultSkin(player)
   playerDefaultSkin[player] = getElementModel(player) --save player model to table
end

function loadPlayerDefaultSkin(player) 
   if(playerDefaultSkin[player]) then
      setElementModel(player, playerDefaultSkin[player]) -- load skin from table
      playerDefaultSkin[player] = nil -- remove from table we don't need anymore
   end
end

addEventHandler("onPlayerQuit", root,
  function()
     playerDefaultSkin[player] = nil --delete player skin from game completely from memory
  end
)

 

Edited by Burak5312
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...