Jump to content

Preciso de ajuda em um script de hospital!


Recommended Posts

Quando um player morre sempre ele fica com a skin do cj eu queria que alguem me ajuda a sempre que morrer salvar a skin anterior e não perdela:

 

    local joinX = 1309.7807617188
    local joinY = -1370.9881591797
    local joinZ = 13.582221984863
    
    
    local joinSkin = 0


    local spawnX = 1176.4912109375
    local spawnY = -1323.841796875
    local spawnZ = 14.023947715759
    
    local spawnSkin = 0


    local deadPlayerMoney = 0
    local joinMoney = 1500

-- Functions
-- This function spawns players when they join
function spawnOnJoin()
    spawnPlayer(source, joinX, joinY, joinZ, 0 , joinSkin)
    fadeCamera(source, true)
    setCameraTarget(source, source)
    outputChatBox(joinMessage, source)
    giveWeapon(source, joinWeapon, joinAmmo)
    givePlayerMoney(source, joinMoney)
end

-- This function spawns players after they died
function spawnOnDead(ammo, killer, weapon, bodypart)
    outputChatBox()
    takePlayerMoney(source, deadPlayerMoney)
    if (killer) and (killer ~= source) then
        givePlayerMoney(killer, killerMoney)
    end
    setTimer(spawnPlayer, 3000, 1, source, spawnX, spawnY, spawnZ, 0, spawnSkin)
    setCameraTarget(source, source)
    setTimer(giveWeapon, 3000, 1, source, spawnWeapon, spawnAmmo)
end

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

Link to comment
Quote

When a player dies always he gets the skin of cj I wanted someone to help me whenever i die save the previous skin and do not lose:

Você pode usar a função getElementModel para recuperar a pele atual de um jogador, também chamada de id modelo. Então você pode fazer...

Spoiler

You can use the getElementModel function to retrieve the current skin of a player, otherwise called the model id. Then you can do...

...
    end
    local model = getElementModel(source)
    setTimer(spawnPlayer, 3000, 1, source, spawnX, spawnY, spawnZ, 0, model)
...

Isso vai gerar o jogador com o mesmo modelo que ele tinha no momento da morte.

Spoiler

This will spawn the player with the same model as he had at the point of dying.

Edited by The_GTA
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...