Jump to content

[HelP] Save Skin After Deatch to Respawn


TDK

Recommended Posts

Hi all, i have a simple question: how to:save skin after death and give it to player after respawn? my code don't work, and sorry, but i delete code....(((

it's my sketch:

skin = getPlayerSkin(source)
 
function spawnOnFinish (prevA, curA, autoLogin)
outputChatBox ("You are spawned ...", source, 38,120,50, false)
spawnPlayer (source, 0, 0, 5, 0, skin, 0, 0, Gamers)
else
spawnPlayer (source, 0, 0, 5, 0, math.random(50,60), 0, 0, Players)
fadeCamera (source, true)
setCameraTarget (source, source)
end
addEventHandler("onClientDownloadFinished", getRootElement(), spawnOnFinish)

----\

It's from wiki, but i try to spawn player after all Downloadings Finished, and save skin after death... anybody have any ideas?

----/

Link to comment

you are mixing server-side (spawnPlayer) with client-side (onClientDownloadFinished).

my modified play resource:

function spawn(player)
if getElementType(player)=="player" then
local desiredSkin = getElementData(player, "skinID")
if desiredSkin then
		skinID=desiredSkin
else
		skinID= math.random(9,288)
end
	spawnX = math.random(-691, -671)
	spawnY = math.random(962, 971)
	spawnZ = 20
repeat
until
spawnPlayer ( player, spawnX, spawnY, spawnZ, 180, skinID )
 
fadeCamera(player, true)
setCameraTarget(player, player)
end
end
 
addEventHandler("onPlayerJoin", root,
function()
setTimer(function(src)
		spawn(src)
end, 5000, 1, source)
end
)
 
addEventHandler("onPlayerWasted", root,
function()
if getElementType(source)=="player" then
local tmpID = getPedSkin(source)
--outputChatBox(tmpID.."f")
setElementData(source,"skinID",tmpID)
setTimer(spawn, 5000, 1, source)
end
end
)

Link to comment

Thank you varez, god of mta scripting=D i'm stupid, serverside and clientside))))) im' lol) thanks)

----------/

And My Second Stupid Question: dxDrawImage and hide player nick if it's an admin

----------\

Sketch:

function CheckACLgroup ()
if aclgroup = admin then
dxDrawImage(х,у,3,admin.png)
ShowPlayerNick = false

Link to comment
you are mixing server-side (spawnPlayer) with client-side (onClientDownloadFinished).

my modified play resource:

function spawn(player)
if getElementType(player)=="player" then
local desiredSkin = getElementData(player, "skinID")
if desiredSkin then
		skinID=desiredSkin
else
		skinID= math.random(9,288)
end
	spawnX = math.random(-691, -671)
	spawnY = math.random(962, 971)
	spawnZ = 20
repeat
until
spawnPlayer ( player, spawnX, spawnY, spawnZ, 180, skinID )
 
fadeCamera(player, true)
setCameraTarget(player, player)
end
end
 
addEventHandler("onPlayerJoin", root,
function()
setTimer(function(src)
		spawn(src)
end, 5000, 1, source)
end
)
 
addEventHandler("onPlayerWasted", root,
function()
if getElementType(source)=="player" then
local tmpID = getPedSkin(source)
--outputChatBox(tmpID.."f")
setElementData(source,"skinID",tmpID)
setTimer(spawn, 5000, 1, source)
end
end
)

F*ck! Don't work! black screen only! help plz!

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