Jump to content

[HELP] Gamemode


ViRuZGamiing

Recommended Posts

Hello Community,

When I start my Gamemode I don't spawn:

meta.xml

    "Viruz" description="My first gamemode named Celine" version="1" type="gamemode" /> 
    resource="freeroam" /> 
    resource="spawnmanager" /> 
  
    "celine.map" /> 
    

celine.map

"deathmatch" version="1.0" time="13:00" weather="0"> 
  
    
        Viruz
        1.0
     
  
    createObject model="510" posX="-1989" posY="877" posZ="46" rotX="0" rotY="0" rotZ="0" /> 
    createObject model="510" posX="-1989" posY="873" posZ="46" rotX="0" rotY="0" rotZ="0" /> 
    createObject model="510" posX="-1989" posY="869" posZ="46" rotX="0" rotY="0" rotZ="0" /> 
    "noobspawn" posX="-1975" posY="885" posZ="46" rotX="128">

celine.lua

function spawn (player) 
    spawnPlayer(player, -1975, 885, 46, 0, 0) 
end 
  
addEventHandler("onPlayerLogin", root, spawn) 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        spawn(source) 
    end 
) 

Thanks for helping already!

Greetz Viruz

Link to comment
function spawn ( ) 
    spawnPlayer ( source, -1975, 885, 46, 0, 0 ) 
end 
  
addEventHandler("onPlayerLogin", root, spawn) 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        spawn(source) 
    end 
) 

Link to comment

My testing it now but i guess it will work...

Another thing this doesn't work.

-- root = getElementRoot() 
addEventHandler("onPlayerLogin", root, 
  function() 
    outputChatBox(getPlayerName(source).." has logged in!", root) 
  end 
) 
  
function money() 
    setPlayerMoney( root(), 1000 ) 
end 
addEventHandler("onPlayerLogin", root, money) 

Link to comment

well here is a little script i made to spawn because i removed play gamemode so this will make u spawn in a specific place ofc you can edit the coordinates you need.

  
local spawnX, spawnY, spawnZ = 1942.16150, -1703.89636, 13.38281 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Welcome Message", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 

Link to comment
function money() 
    outputChatBox(getPlayerName(getElementRoot()).." has logged in!", getElementRoot()) 
    givePlayerMoney( getElementRoot(), 1000 ) 
end 
addEventHandler("onPlayerLogin", thePlayer, money) 

Error:

[18:04:52] WARNING: test\server.lua:5: Bad argument @ 'addEventHandler' [Expecte 
d element at argument 2, got nil] 

Link to comment
 rootElement = getRootElement() 
function money() 
    outputChatBox(getPlayerName(getElementRoot()).." has logged in!", getElementRoot()) 
    givePlayerMoney( getElementRoot(), 1000 ) 
end 
addEventHandler("onPlayerLogin", rootElement, money) 

getElementRoot? Its getRootElement... And you defined getRootElement() for rootElement, why dont you use it?

Link to comment

@ pa3ck sorry i just modified what biilly wanted, and i noticed that after i posted it -_-

@ biily idk if i there is a way to make it 270 degrees turned, about money try this

rootElement = getRootElement() 
function money(source) 
    outputChatBox(getPlayerName(source).." has logged in!", 5, 255, 0, 0, font) 
    givePlayerMoney( source, 1000 ) 
end 
addEventHandler("onPlayerLogin", rootElement, money) 

Link to comment

Try this:

rootElement = getRootElement() 
function money() 
    outputChatBox(getPlayerName(source).." has logged in!", 5, 255, 0, 0, font) 
    setElementRotation(source, 0, 0, 270) 
    givePlayerMoney( source, 1000 ) 
end 
addEventHandler("onPlayerLogin", rootElement, money) 

'onPlayerLogin' returns source as the connected player, dont need to define it.

Link to comment

Maybe this;

local spawnX, spawnY, spawnZ =  -1976.7485351563, 883.75982666016, 45.203125 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    setElementRotation(source, 0, 0, 270) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox(getPlayerName(source).." has logged in!", 5, 255, 0, 0, font) 
    givePlayerMoney( source, 1000 ) 
end 
addEventHandler("onPlayerLogin", getRootElement(), joinHandler) 

Link to comment
Why did u add setElementRotation to the Money script? I don't know if u understand that u can't rotate money.

The rotation is ment for the spawn script

Oh yea, sorry, put the "setElementRotation" line to the other function. It works fine, but it rotates the player when he logs in... BTW I did not rotate the money lolol. I rotated the source, the player.

Maybe this;
local spawnX, spawnY, spawnZ =  -1976.7485351563, 883.75982666016, 45.203125 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    setElementRotation(source, 0, 0, 270) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox(getPlayerName(source).." has logged in!", 5, 255, 0, 0, font) 
    givePlayerMoney( source, 1000 ) 
end 
addEventHandler("onPlayerLogin", getRootElement(), joinHandler) 

Player will only spawn when he logs in, IDK if you want that.

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