opnaiC Posted July 8, 2016 Posted July 8, 2016 Hello, I making a gang for my server. So I allready made a marker. When the player hits the marker he will get a skin for his rank. Now I want that if the player all ready a gang skin he will get his OLD skin. Here is my code. This is not the hole code only a part of it. I can make the events myself I only need help in saving and setting the OLD skin: gangSkin = { [106]=true, [105]=true, [107]=true, [271]=true, [270]=true } function fbskin(thePlayer) local fac = getElementData(thePlayer,"Faction") local rank = getElementData(thePlayer,"Rank") if (fac == 1) then if (rank == 0) then setElementModel(thePlayer,105) elseif (rank == 1) then setElementModel(thePlayer,105) elseif (rank == 2) then setElementModel(thePlayer,106) elseif (rank == 3) then setElementModel(thePlayer,107) elseif (rank == 4) then setElementModel(thePlayer,271) elseif (rank == 5) then setElementModel(thePlayer,270) end end if getElementModel (thePlayer, gangSkin) then setElementModel (thePlayer, oldSkin) -- how to define oldSkin ??? end end
Captain Cody Posted July 8, 2016 Posted July 8, 2016 setElementData(thePlayer,"Original",getElementModel(thePlayer)) local original = getElementData(thePlayer,"Original")
opnaiC Posted July 9, 2016 Author Posted July 9, 2016 setElementData(thePlayer,"Original",getElementModel(thePlayer))local original = getElementData(thePlayer,"Original") local groveSkin = { [106]=true, [105]=true, [107]=true, [271]=true, [270]=true } function skin(thePlayer) local original = getElementData(thePlayer,"Original") local fac = getElementData(thePlayer,"Faction") local rank = getElementData(thePlayer,"Rank") if (fac == 1) then if (rank == 0) then setElementModel(thePlayer,105) elseif (rank == 1) then setElementModel(thePlayer,105) elseif (rank == 2) then setElementModel(thePlayer,106) elseif (rank == 3) then setElementModel(thePlayer,107) elseif (rank == 4) then setElementModel(thePlayer,271) elseif (rank == 5) then setElementModel(thePlayer,270) end if getElementModel (thePlayer, groveSkin) then setElementData(thePlayer,"Original",getElementModel(thePlayer)) end end end addEvent ("skin", true) addEventHandler ("skin", root, skin) function onDisconnect (thePlayer) local original = getElementData(thePlayer,"Original") local fac = getElementData(thePlayer,"Faction") if (fac == 1) then if getElementModel (thePlayer, groveSkin) then setElementData(thePlayer,"Original",getElementModel(thePlayer)) end end end addEventHandler ("onPlayerQuit", root, onDisconnect) So this would work, right ? Also I am using onClientMarkerHit on the Client script to get this function working.
Walid Posted July 9, 2016 Posted July 9, 2016 function onDisconnect () local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local fac = getElementData(source,"Faction") or 0 if (tonumber(fac) == 1) then local skin = getElementModel(source) if groveSkin[skin] then setAccountData(account,"Original",skin) end end end end addEventHandler ("onPlayerQuit", root, onDisconnect) on player login use > getAccountData() then > setElementData(). Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now