ZeyadGTX Posted March 29, 2014 Share Posted March 29, 2014 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
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 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
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 and i donot know the Spawn XYZ and i dont know how to put it Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 iwant just spawn with the same skin Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 I killed with CJ iwant to spawn with CJ Link to comment
justn Posted March 29, 2014 Share Posted March 29, 2014 For the onPlayerWasted function, you must use spawnPlayer like this spawnPlayer(x,y,z,rotation,playerskin) -- leave playerskin as it is Link to comment
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 So use your first code, you don't have to add anything. Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 Random respawn but with saved skin Link to comment
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 So make table with coordinates and then in event onPlayerWasted random table and get coordinates. Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 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
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 where do i add Coordinates Link to comment
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 So? That's not random spawn. Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 i must add Coordinates in ? can you add any XYZ just for test Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 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
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 Man! You don't have to spam your code. This code is to save things when player leaves or logouts. Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 Lol. iwant to respawn with the death skin Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 i did but not working i spawn with random skin :'''( Link to comment
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 You have to be logged in all the time in server. Link to comment
ZeyadGTX Posted March 29, 2014 Author Share Posted March 29, 2014 i did and i use kill Link to comment
WhoAmI Posted March 29, 2014 Share Posted March 29, 2014 And the resource has to be started, and it's server side, check meta. 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