sckatchof Posted December 20, 2011 Posted December 20, 2011 when i dead my skin changer to CJ skin and when i destroy the car remain in place do not disappear ! why ?
JR10 Posted December 20, 2011 Posted December 20, 2011 And you need to make a car respawner script. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
sckatchof Posted December 21, 2011 Author Posted December 21, 2011 You need to save the skin on death I dont know the functions because im new in scripting
Xeno Posted December 21, 2011 Posted December 21, 2011 Try this: function onPlayerDeath( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerskin = getAccountData ( playeraccount, "skin" ) if ( playerskin ) then setPedSkin ( source, playerskin ) end end end addEventHandler ( "onPlayerWasted", getRootElement ( ), onPlayerDeath )
sckatchof Posted December 21, 2011 Author Posted December 21, 2011 Try this: function onPlayerDeath( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playerskin = getAccountData ( playeraccount, "skin" ) if ( playerskin ) then setPedSkin ( source, playerskin ) end end end addEventHandler ( "onPlayerWasted", getRootElement ( ), onPlayerDeath ) i try but doesn't work when i die my skin changer to cj skin
Xeno Posted December 21, 2011 Posted December 21, 2011 Make sure you logged in when you do it. And if that doesnt work, put your save skin script.
JR10 Posted December 21, 2011 Posted December 21, 2011 Just use the skin argument in spawnPlayer. Like onPlayerWasted set a timer to spawn the player, and specify the skin argument with getElementModel. Ex: addEventHandler ( "onPlayerWasted" , root , function ( ) fadeCamera ( source , false , 3 ) setTimer ( function () spawnPlayer ( source , 1178.9 , -1323.7143554688 , 15 , 270 , getElementModel ( source ) , 0 , 0 ) fadeCamera ( source , true , 2 ) end , 5000 , 1) end ) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Castillo Posted December 21, 2011 Posted December 21, 2011 Post your script where you respawn the player. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
sckatchof Posted December 21, 2011 Author Posted December 21, 2011 Post your script where you respawn the player. this is my script spawnsHospitals = {{X,Y,Z,RZ}} spawnsHospitals[1] = {X=1177.4658203125,Y=-1323.8505859375,Z=14.072093963623,RZ=272.34698486328} spawnsHospitals[2] = {X=2033.337890625,Y=-1415.2353515625,Z=16.9921875,RZ=136.29571533203} spawnsHospitals[3] = {X=-2660.431640625,Y=633.8486328125,Z=14.453125,RZ=181.82925415039} spawnsHospitals[4] = {X=1578.947265625,Y=1768.3779296875,Z=10.8203125,RZ=93.712066650391} spawnsHospitals[5] = {X=1876.330078125,Y=2237.36328125,Z=11.125,RZ=5.7651672363281} spawnsHospitals[6] = {X=1244.9228515625,Y=332.85546875,Z=19.5546875,RZ=339.0514831543} spawnsHospitals[7] = {X=-321.7744140625,Y=1057.1728515625,Z=19.7421875,RZ=310.25588989258} spawnsHospitals[8] = {X=-1514.6015625,Y=2525.173828125,Z=55.780910491943,RZ=4.556640625} function playerKilled( ) setTimer( respawnToNearestHospital, 5000, 1, source ) end addEventHandler("onPlayerWasted", getRootElement(), playerKilled ) function respawnToNearestHospital( thePlayer ) local x, y, z = getElementPosition( thePlayer ) tableDist = {{index,dist}} for k,i in ipairs ( spawnsHospitals ) do local x2 = spawnsHospitals[k]["X"] local y2 = spawnsHospitals[k]["Y"] local dis = getDistanceBetweenPoints2D( x, y, x2, y2 ) tableDist[k] = {index=k,dist=dis} end local goodK = -1 for l,j in ipairs( tableDist ) do if ( l == 1 ) then goodK = 1 else local DIST1 = tableDist[goodK]["dist"] local DIST2 = tableDist[l]["dist"] if ( DIST2 < DIST1 ) then goodK = l end end end if ( goodK == -1 ) then return end spawnPlayer( thePlayer, spawnsHospitals[goodK]["X"], spawnsHospitals[goodK]["Y"], spawnsHospitals[goodK]["Z"], math.random (0,288), 0, 0, spawnTeam) setPedRotation( thePlayer, spawnsHospitals[goodK]["RZ"] ) if(tonumber(skin) == 199) then skin = math.random(0,200) end end
Castillo Posted December 21, 2011 Posted December 21, 2011 spawnsHospitals = {} spawnsHospitals[1] = {X=1177.4658203125,Y=-1323.8505859375,Z=14.072093963623,RZ=272.34698486328} spawnsHospitals[2] = {X=2033.337890625,Y=-1415.2353515625,Z=16.9921875,RZ=136.29571533203} spawnsHospitals[3] = {X=-2660.431640625,Y=633.8486328125,Z=14.453125,RZ=181.82925415039} spawnsHospitals[4] = {X=1578.947265625,Y=1768.3779296875,Z=10.8203125,RZ=93.712066650391} spawnsHospitals[5] = {X=1876.330078125,Y=2237.36328125,Z=11.125,RZ=5.7651672363281} spawnsHospitals[6] = {X=1244.9228515625,Y=332.85546875,Z=19.5546875,RZ=339.0514831543} spawnsHospitals[7] = {X=-321.7744140625,Y=1057.1728515625,Z=19.7421875,RZ=310.25588989258} spawnsHospitals[8] = {X=-1514.6015625,Y=2525.173828125,Z=55.780910491943,RZ=4.556640625} function playerKilled( ) setTimer( respawnToNearestHospital, 5000, 1, source ) end addEventHandler("onPlayerWasted", getRootElement(), playerKilled ) function respawnToNearestHospital( thePlayer ) local x, y, z = getElementPosition( thePlayer ) tableDist = {{index,dist}} for k,i in ipairs ( spawnsHospitals ) do local x2 = spawnsHospitals[k]["X"] local y2 = spawnsHospitals[k]["Y"] local dis = getDistanceBetweenPoints2D( x, y, x2, y2 ) tableDist[k] = {index=k,dist=dis} end local goodK = -1 for l,j in ipairs( tableDist ) do if ( l == 1 ) then goodK = 1 else local DIST1 = tableDist[goodK]["dist"] local DIST2 = tableDist[l]["dist"] if ( DIST2 < DIST1 ) then goodK = l end end end if ( goodK == -1 ) then return end spawnPlayer( thePlayer, spawnsHospitals[goodK]["X"], spawnsHospitals[goodK]["Y"], spawnsHospitals[goodK]["Z"], math.random (0,288), getElementModel(thePlayer), 0, 0, spawnTeam) setPedRotation( thePlayer, spawnsHospitals[goodK]["RZ"] ) if(tonumber(skin) == 199) then skin = math.random(0,200) end end You should check the function arguments . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
sckatchof Posted December 21, 2011 Author Posted December 21, 2011 spawnsHospitals = {} spawnsHospitals[1] = {X=1177.4658203125,Y=-1323.8505859375,Z=14.072093963623,RZ=272.34698486328} spawnsHospitals[2] = {X=2033.337890625,Y=-1415.2353515625,Z=16.9921875,RZ=136.29571533203} spawnsHospitals[3] = {X=-2660.431640625,Y=633.8486328125,Z=14.453125,RZ=181.82925415039} spawnsHospitals[4] = {X=1578.947265625,Y=1768.3779296875,Z=10.8203125,RZ=93.712066650391} spawnsHospitals[5] = {X=1876.330078125,Y=2237.36328125,Z=11.125,RZ=5.7651672363281} spawnsHospitals[6] = {X=1244.9228515625,Y=332.85546875,Z=19.5546875,RZ=339.0514831543} spawnsHospitals[7] = {X=-321.7744140625,Y=1057.1728515625,Z=19.7421875,RZ=310.25588989258} spawnsHospitals[8] = {X=-1514.6015625,Y=2525.173828125,Z=55.780910491943,RZ=4.556640625} function playerKilled( ) setTimer( respawnToNearestHospital, 5000, 1, source ) end addEventHandler("onPlayerWasted", getRootElement(), playerKilled ) function respawnToNearestHospital( thePlayer ) local x, y, z = getElementPosition( thePlayer ) tableDist = {{index,dist}} for k,i in ipairs ( spawnsHospitals ) do local x2 = spawnsHospitals[k]["X"] local y2 = spawnsHospitals[k]["Y"] local dis = getDistanceBetweenPoints2D( x, y, x2, y2 ) tableDist[k] = {index=k,dist=dis} end local goodK = -1 for l,j in ipairs( tableDist ) do if ( l == 1 ) then goodK = 1 else local DIST1 = tableDist[goodK]["dist"] local DIST2 = tableDist[l]["dist"] if ( DIST2 < DIST1 ) then goodK = l end end end if ( goodK == -1 ) then return end spawnPlayer( thePlayer, spawnsHospitals[goodK]["X"], spawnsHospitals[goodK]["Y"], spawnsHospitals[goodK]["Z"], math.random (0,288), getElementModel(thePlayer), 0, 0, spawnTeam) setPedRotation( thePlayer, spawnsHospitals[goodK]["RZ"] ) if(tonumber(skin) == 199) then skin = math.random(0,200) end end You should check the function arguments . thanks snake its work
Castillo Posted December 21, 2011 Posted December 21, 2011 You're welcome San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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