Jump to content

Save Skin When death


ZeyadGTX

Recommended Posts

I have this resource i want when i get killed by Cj skin i spawn in random place with CJ skin not with Random skins

Or i kileld with Skin 15 i spawn with skin 15 Not random i use this

This script :

<--Made By Kevin11-->

function onPlayerQuit ( )

local playeraccount = getPlayerAccount ( source )

if ( playeraccount ) then

local playerskin = getPedSkin ( source )

setAccountData ( playeraccount, "skin", playerskin )

end

end

function onPlayerJoin ( )

local playeraccount = getPlayerAccount ( source )

if ( playeraccount ) then

local playerskin = getAccountData ( playeraccount, "skin" )

if ( playerskin ) then

setPedSkin ( source, playerskin )

end

end

end

function onPlayerSpawn ( )

local playeraccount = getPlayerAccount ( source )

if ( playeraccount ) then

local playerskin = getAccountData ( playeraccount, "skin" )

if ( playerskin ) then

setPedSkin ( source, playerskin )

end

end

end

function onPlayerWasted ( )

local playeraccount = getPlayerAccount ( source )

if ( playeraccount ) then

local playerskin = getPedSkin ( source )

setAccountData ( playeraccount, "skin", playerskin )

end

end

addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit )

addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin )

addEventHandler ( "onPlayerSpawn", getRootElement ( ), onPlayerSpawn )

addEventHandler ( "onPlayerWasted", getRootElement ( ), onPlayerWasted )

Link to comment

No but some one told me that i must add XYZ here

addEventHandler ("onPlayerLogin",root,

function()

loadPedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerQuit",root,

function()

savePedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerLogout",root,

function(thePreviousAccount)

savePedStats( thePreviousAccount )

end

)

function savePedStats( Acc)

local pedposx,pedposy,pedposz = getElementPosition( source )

local pedrotx,pedroty,pedrotz = getElementRotation( source )

setAccountData(Acc, "pos.x", pedposx)

setAccountData(Acc, "pos.y", pedposy)

setAccountData(Acc, "pos.z", pedposz)

setAccountData(Acc, "rot.x", pedrotx)

setAccountData(Acc, "rot.y", pedroty)

setAccountData(Acc, "rot.z", pedrotz)

setAccountData(Acc, "skin", getPedSkin( source ))

setAccountData(Acc, "armor", getPedArmor( source ))

setAccountData(Acc, "health", getElementHealth( source ))

setAccountData(Acc, "money",getPlayerMoney( source ))

for i = 21 , 25 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

for i = 69 , 79 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

end

function loadPedStats(Acc )

setPedSkin(source,getAccountData(Acc, "skin"))

setPedArmor(source,getAccountData(Acc, "armor"))

setElementHealth(source,getAccountData(Acc, "health"))

setPlayerMoney(source,getAccountData(Acc, "money"))

for i = 21 , 25 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

for i = 69 , 79 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

end

Link to comment

i have this

addEventHandler ("onPlayerLogin",root,

function()

loadPedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerQuit",root,

function()

savePedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerLogout",root,

function(thePreviousAccount)

savePedStats( thePreviousAccount )

end

)

function savePedStats( Acc)

local pedposx,pedposy,pedposz = getElementPosition( source )

local pedrotx,pedroty,pedrotz = getElementRotation( source )

setAccountData(Acc, "pos.-711", pedpos-711)

setAccountData(Acc, "pos.957", pedpos957)

setAccountData(Acc, "pos.12.382266998291", pedpos12.382266998291)

setAccountData(Acc, "rot.x", pedrotx)

setAccountData(Acc, "rot.y", pedroty)

setAccountData(Acc, "rot.z", pedrotz)

setAccountData(Acc, "skin", getPedSkin( source ))

setAccountData(Acc, "armor", getPedArmor( source ))

setAccountData(Acc, "health", getElementHealth( source ))

setAccountData(Acc, "money",getPlayerMoney( source ))

for i = 21 , 25 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

for i = 69 , 79 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

end

function loadPedStats(Acc )

setPedSkin(source,getAccountData(Acc, "skin"))

setPedArmor(source,getAccountData(Acc, "armor"))

setElementHealth(source,getAccountData(Acc, "health"))

setPlayerMoney(source,getAccountData(Acc, "money"))

for i = 21 , 25 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

for i = 69 , 79 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

end

Link to comment

The default

addEventHandler ("onPlayerLogin",root,

function()

loadPedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerQuit",root,

function()

savePedStats( getPlayerAccount(source))

end

)

addEventHandler ("onPlayerLogout",root,

function(thePreviousAccount)

savePedStats( thePreviousAccount )

end

)

function savePedStats( Acc)

local pedposx,pedposy,pedposz = getElementPosition( source )

local pedrotx,pedroty,pedrotz = getElementRotation( source )

setAccountData(Acc, "pos.x", pedposx)

setAccountData(Acc, "pos.y", pedposy)

setAccountData(Acc, "pos.z", pedposz)

setAccountData(Acc, "rot.x", pedrotx)

setAccountData(Acc, "rot.y", pedroty)

setAccountData(Acc, "rot.z", pedrotz)

setAccountData(Acc, "skin", getPedSkin( source ))

setAccountData(Acc, "armor", getPedArmor( source ))

setAccountData(Acc, "health", getElementHealth( source ))

setAccountData(Acc, "money",getPlayerMoney( source ))

for i = 21 , 25 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

for i = 69 , 79 do

setAccountData(Acc, "stat."..i , getPedStat(source,i))

end

end

function loadPedStats(Acc )

setPedSkin(source,getAccountData(Acc, "skin"))

setPedArmor(source,getAccountData(Acc, "armor"))

setElementHealth(source,getAccountData(Acc, "health"))

setPlayerMoney(source,getAccountData(Acc, "money"))

for i = 21 , 25 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

for i = 69 , 79 do

setPedStat(source,i,getAccountData(Acc, "stat."..i))

end

end

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...