Jump to content

Ajuda na gamemode [play]


Leinad Raiz

Recommended Posts

Alguem pode me ajudar eu tenho uma gamemode play configurada para o roleplay, Ate ai tudo bem so que o problema e que quando morre o personagem ele volta a skin original do (CJ) Isso fica meio complicado porque elas paga para ter a skin dai quando morrer perde-la seria injusto. Se alguem poder me ajudar estou a quase 4 dias perguntando no forum ninguem me responde!

 

[CLIENT]

 

local spawnpoint

addEventHandler("onResourceStart", resourceRoot,
	function()
		spawnpoint = getRandomSpawnPoint()
		resetMapInfo()
		for i,player in ipairs(getElementsByType("player")) do
			spawn(player)
		end
	end
)

function spawn(player)
	if not isElement(player) then return end
	if get("spawnreset") == "onSpawn" then
		spawnpoint = getRandomSpawnPoint()
	end
	exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false)
	repeat until setElementModel(player,math.random(312))
	fadeCamera(player, true)
	setCameraTarget(player, player)
	showChat(player, true)
end

function getRandomSpawnPoint ()
	local spawnpoints = getElementsByType("spawnpoint")
	return spawnpoints[math.random(1,#spawnpoints)]
end

addEventHandler("onPlayerJoin", root,
	function()
		spawn(source)
	end
)

addEventHandler("onPlayerQuit",root,
	function ()
		if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then
			spawnpoint = getRandomSpawnPoint()
		end
	end
)

addEventHandler("onPlayerWasted", root,
	function()
		setTimer(spawn, 1800, 1, source)
	end
)

 

 

[SERVER]

 

 

	local joinX = 1481.2946777344
	local joinY = -1766.1395263672
	local joinZ = 18.795755386353
	local joinSkin = 0 -- skin ao entrar no servidor
	local spawnSkin = 0 -- Skin ao morrer
	local joinMoney = 3000 -- Dinheiro ao entrar no servidor
	
	local spawnX = 2032.3931884766
	local spawnY = -1416.2508544922
	local spawnZ = 16.9921875

-- Function
-- This function spawns players when they join
function spawnOnJoin()
    spawnPlayer(source, joinX, joinY, joinZ, joinSkin) 
	fadeCamera(source, true)
	setCameraTarget(source, source)
	givePlayerMoney(source, joinMoney)
end

function spawnOnDead(killer, bodypart)
	setTimer(spawnPlayer, 3000, 1, source, spawnX, spawnY, spawnZ, spawnSkin)
	setCameraTarget(source, source)
end



-- Event handlers
addEventHandler("onPlayerJoin", getRootElement(), spawnOnJoin)
addEventHandler("onPlayerWasted", getRootElement(), spawnOnDead)

 

Link to comment
  • Tut locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...