Timoow13 Posted May 19, 2012 Share Posted May 19, 2012 I know this is normal, but is there a way you can disable this? So when you die, you still have the same skin. Link to comment
abu5lf Posted May 19, 2012 Share Posted May 19, 2012 (edited) setElementModel getElementModel https://wiki.multitheftauto.com/wiki/OnPlayerWasted Edited May 19, 2012 by Guest Link to comment
Wei Posted May 19, 2012 Share Posted May 19, 2012 try that: didn't test it function saveSkin( daPlayer ) setAccountData( getPlayerAccount( daPlayer ), "save-skin", getElementModel( daPlayer ) ) end addEventHandler("onPlayerWasted", getRootElement(), saveSkin ) function setSkin( daPlayer ) setElementModel( daPlayer, getAccountData( getPlayerAccount( daPlayer ) ), "save-skin" ) end addEventHandler("onPlayerSpawn", getRootElement(), setSkin ) Link to comment
Alpha Posted May 19, 2012 Share Posted May 19, 2012 You have an error at line 7, and no need for account data, element data would be better. function saveSkin( player ) setElementData( player , "save-skin", getElementModel(player) ) end addEventHandler("onPlayerWasted", root, saveSkin ) function setSkin( player ) setElementModel( player, getElementData(player, "save-skin") ) end addEventHandler("onPlayerSpawn", root, setSkin ) Link to comment
Kenix Posted May 19, 2012 Share Posted May 19, 2012 (edited) Alpha, blazy both code is wrong. Read wiki better. onPlayerSpawn-> first argument is position axis x ( not element ) onPlayerWasted-> first argument is killer( but we not needed killer. Only wasted player we need ) local function Skin( ) if eventName == 'onPlayerSpawn' then local nData = getElementData( source, 'save-skin' ) if nData then setElementModel( source, nData ) end else setElementData( source, 'save-skin', getElementModel( source ) ) end end addEventHandler( 'onPlayerWasted', root, Skin ) addEventHandler( 'onPlayerSpawn', root, Skin ) Edited May 19, 2012 by Guest Link to comment
Wei Posted May 19, 2012 Share Posted May 19, 2012 Didn't work... Then modify the freeroam/play resource. Link to comment
Guest Guest4401 Posted May 19, 2012 Share Posted May 19, 2012 addEventHandler("onPlayerWasted",root, function() setElementData(source,"save-skin",getElementModel(source)) end ) addEventHandler("onPlayerSpawn",root, function() setTimer(setElementModel, 100, 1, source,(getElementData(source,"save-skin") or 0)) end ) Link to comment
Al3grab Posted May 19, 2012 Share Posted May 19, 2012 addEventHandler("onPlayerDamage",root,function() setElementData(source,"skin",getElementModel(source) or 0 ) end ) addEventHandler("onPlayerWasted",root,function() setElementData(source,"skin",getElementModel(source) or 0 ) end ) addEventHandler("onPlayerSpawn",root,function() setElementModel(source,getElementData(source,"skin") or 0 ) end ) Link to comment
Kenix Posted May 19, 2012 Share Posted May 19, 2012 Didn't work... It should work. I tested it. Working perfectly in play gamemode. Try use timer. Also use /debugscript 3. Link to comment
Scripting Moderators Sarrum Posted May 19, 2012 Scripting Moderators Share Posted May 19, 2012 spawnPlayer, 6 argument = getElementModel Example: addEventHandler ( "onPlayerWasted", root, function ( ) spawnPlayer ( source, 0, 0, 3, 0, getElementModel ( source ) ) end ) Link to comment
CapY Posted May 19, 2012 Share Posted May 19, 2012 I know this is normal, but is there a way you can disable this? So when you die, you still have the same skin. /stop play Link to comment
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