Jump to content

[HELP]Spawnpoint Edit


Recommended Posts

Hi Community,

Here's my script:

-- Settings for when a player joins 
    -- XYZ coördinates 
    local joinX = -2462.3999023438 
    local joinY = 132.69999694824 
    local joinZ = 35.200000762939 
    -- Weapon and ammo 
    local joinWeapon = 0 
    local joinAmmo = 0 
    -- Message when player joins 
    local joinMessage = "Welcome to Belgium-Reallife." 
    -- Skin that player gets 
    local joinSkin = 0 
  
-- Settings for when a player dies 
    -- XYZ coördinates 
    local spawnX = -2462.3999023438 
    local spawnY = 132.69999694824 
    local spawnZ = 35.200000762939 
    -- Weapon and ammo 
    local spawnWeapon = 0 
    local spawnAmmo = 0 
    -- Skin that player gets 
    local spawnSkin = 0 
  
-- Settings for the amounts of money 
    -- Money the killer gets 
    local killerMoney = 0 
    -- Money removed from player when they die 
    local deadPlayerMoney = 0 
    -- Money you get when you join 
    local joinMoney = 0 
  
-- 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(getPlayerName(source).." died.") 
    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) 

What I want

I want to add a

If getPlayerteam == "Yakuza" 
then spawnX, spawnY, spawnZ 

In this the spawnX, spawnY and spawnZ are different then the Civilian's the Gang members need spawn in Base.

Thanks for Helping

Link to comment

Try this:

-- Settings for when a player joins 
    -- XYZ coördinates 
    local joinX = -2462.3999023438 
    local joinY = 132.69999694824 
    local joinZ = 35.200000762939 
    -- Weapon and ammo 
    local joinWeapon = 0 
    local joinAmmo = 0 
    -- Message when player joins 
    local joinMessage = "Welcome to Belgium-Reallife." 
    -- Skin that player gets 
    local joinSkin = 0 
  
-- Settings for when a player dies 
    -- XYZ coördinates 
    local spawnX = -2462.3999023438 
    local spawnY = 132.69999694824 
    local spawnZ = 35.200000762939 
    -- Weapon and ammo 
    local spawnWeapon = 0 
    local spawnAmmo = 0 
    -- Skin that player gets 
    local spawnSkin = 0 
  
-- Settings for the amounts of money 
    -- Money the killer gets 
    local killerMoney = 0 
    -- Money removed from player when they die 
    local deadPlayerMoney = 0 
    -- Money you get when you join 
    local joinMoney = 0 
  
-- Functions 
-- This function spawns players when they join 
function spawnOnJoin() 
    local x, y, z = joinX, joinY, joinZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = spawnX, spawnY, spawnZ 
    end 
    spawnPlayer(source, x, y, z, 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(getPlayerName(source).." died.") 
    takePlayerMoney(source, deadPlayerMoney) 
    if (killer) and (killer ~= source) then 
        givePlayerMoney(killer, killerMoney) 
    end 
    local x, y, z = joinX, joinY, joinZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = spawnX, spawnY, spawnZ 
    end 
    setTimer(spawnPlayer, 3000, 1, source, x, y, z, 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
do I need to edit the "spawnX" or the "x"

Only these what you need to edit

You already have them commented. :mrgreen:

-- Settings for when a player joins 
    -- XYZ coördinates 
    local joinX = -2462.3999023438 
    local joinY = 132.69999694824 
    local joinZ = 35.200000762939 
    -- Weapon and ammo 
    local joinWeapon = 0 
    local joinAmmo = 0 
    -- Message when player joins 
    local joinMessage = "Welcome to Belgium-Reallife." 
    -- Skin that player gets 
    local joinSkin = 0 
  
-- Settings for when a player dies 
    -- XYZ coördinates 
    local spawnX = -2462.3999023438 
    local spawnY = 132.69999694824 
    local spawnZ = 35.200000762939 
    -- Weapon and ammo 
    local spawnWeapon = 0 
    local spawnAmmo = 0 
    -- Skin that player gets 
    local spawnSkin = 0 
  
-- Settings for the amounts of money 
    -- Money the killer gets 
    local killerMoney = 0 
    -- Money removed from player when they die 
    local deadPlayerMoney = 0 
    -- Money you get when you join 
    local joinMoney = 0 

Link to comment

So, joinX, joinY, joinZ should be for "Yakuz" and spawnX, spawnY, spawnZ for normal players?

-- Settings for when a player joins 
    -- XYZ coördinates 
    local joinX = -2462.3999023438 
    local joinY = 132.69999694824 
    local joinZ = 35.200000762939 
    -- Weapon and ammo 
    local joinWeapon = 0 
    local joinAmmo = 0 
    -- Message when player joins 
    local joinMessage = "Welcome to Belgium-Reallife." 
    -- Skin that player gets 
    local joinSkin = 0 
  
-- Settings for when a player dies 
    -- XYZ coördinates 
    local spawnX = -2462.3999023438 
    local spawnY = 132.69999694824 
    local spawnZ = 35.200000762939 
    -- Weapon and ammo 
    local spawnWeapon = 0 
    local spawnAmmo = 0 
    -- Skin that player gets 
    local spawnSkin = 0 
  
-- Settings for the amounts of money 
    -- Money the killer gets 
    local killerMoney = 0 
    -- Money removed from player when they die 
    local deadPlayerMoney = 0 
    -- Money you get when you join 
    local joinMoney = 0 
  
-- Functions 
-- This function spawns players when they join 
function spawnOnJoin() 
    local x, y, z = spawnX, spawnY, spawnZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = joinX, joinY, joinZ 
    end 
    spawnPlayer(source, x, y, z, 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(getPlayerName(source).." died.") 
    takePlayerMoney(source, deadPlayerMoney) 
    if (killer) and (killer ~= source) then 
        givePlayerMoney(killer, killerMoney) 
    end 
    local x, y, z = spawnX, spawnY, spawnZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = joinX, joinY, joinZ 
    end 
    setTimer(spawnPlayer, 3000, 1, source, x, y, z, 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

The coördinates are same

local joinX = -2462.3999023438 
local joinY = 132.69999694824 
local joinZ = 35.200000762939 

local spawnX = -2462.3999023438 
local spawnY = 132.69999694824 
local spawnZ = 35.200000762939 

You should change them.

Link to comment
-- Settings for when a player joins 
-- XYZ coördinates 
local joinX = -2462.3999023438 
local joinY = 132.69999694824 
local joinZ = 35.200000762939 
-- Weapon and ammo 
local joinWeapon = 0 
local joinAmmo = 0 
-- Message when player joins 
local joinMessage = "Welcome to Belgium-Reallife." 
-- Skin that player gets 
local joinSkin = 0 
  
-- Settings for when a player dies 
-- XYZ coördinates 
local spawnX = -2462.3999023438 
local spawnY = 132.69999694824 
local spawnZ = 35.200000762939 
-- Weapon and ammo 
local spawnWeapon = 0 
local spawnAmmo = 0 
-- Skin that player gets 
local spawnSkin = 0 
  
-- Settings for the amounts of money 
-- Money the killer gets 
local killerMoney = 0 
-- Money removed from player when they die 
local deadPlayerMoney = 0 
-- Money you get when you join 
local joinMoney = 0 
  
local yakuzaPosition = { 0, 0, 5 } 
  
-- Functions 
-- This function spawns players when they join 
function spawnOnJoin() 
    local x, y, z = joinX, joinY, joinZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = unpack ( yakuzaPosition ) 
    end 
    spawnPlayer(source, x, y, z, 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(getPlayerName(source).." died.") 
    takePlayerMoney(source, deadPlayerMoney) 
    if (killer) and (killer ~= source) then 
        givePlayerMoney(killer, killerMoney) 
    end 
    local x, y, z = spawnX, spawnY, spawnZ 
    if ( getPlayerTeam ( source ) == getTeamFromName ( "Yakuza" ) ) then 
        x, y, z = unpack ( yakuzaPosition ) 
    end 
    setTimer(spawnPlayer, 3000, 1, source, x, y, z, 0, spawnSkin) 
    setCameraTarget(source, source) 
    setTimer(giveWeapon, 3000, 1, source, spawnWeapon, spawnAmmo) 
end 
  
-- Event handlers 
addEventHandler("onPlayerJoin", getRootElement(), spawnOnJoin) 
addEventHandler("onPlayerWasted", getRootElement(), spawnOnDead) 

Change this line:

local yakuzaPosition = { 0, 0, 5 } 

0, 0, 5 = coordinates.

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