Jump to content

[ HELP ] Spawn


Dinossauro

Recommended Posts

Hello friends,

On my server whenever someone died, was born with a different skin, so I put a resource to be born only by the skin of the CJ.

Code:

function player_Spawn() 
-- The source of this event is the player that just spawned. 
setElementModel(source,0) -- set spawned player skin to 0 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 
  
function player_Wasted ( ammo, attacker, weapon, bodypart ) 
-- The source of this event is the player that died or got killed. 
local x,y,z = 0,0,0 -- your coords 
spawnPlayer(source,x,y,z) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted ) 
  
function spawnonjoin ( ) 
-- The source of this event is the player who joined. 
local x,y,z = 0,0,0 -- your coords 
spawnPlayer(source,x,y,z) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), spawnonjoin ) 
  

I put it on the server, and now whenever someone dies is born with the skin on the CJ site, but one second then goes to another location.

I took the lease spawn you had before and now he is not born anywhere, it is bug.

Help me ! :cry:

Link to comment

try this:

function player_Spawn() 
    -- The source of this event is the player that just spawned. 
    if getElementModel(source)~= 0 then --Check if their skin is 0 
        setElementModel(source,0) -- set spawned player skin to 0 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 
  
function spawn ( ) 
    -- The source of this event is the player who joined. 
    spawnPlayer(source,0,0,0) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), spawn ) 
addEventHandler ( "onPlayerWasted", getRootElement(), spawn ) 

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