Jump to content

[HELP] Gamemode


ViRuZGamiing

Recommended Posts

Posted

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

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
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 
) 

Posted

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) 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

@Castro I still don't spawn.

Spawnmanager and My Gamemode are running, Play and freeroam stopped.

If I login i don't spawn

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

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) 

YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID

Posted
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] 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

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

YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID

Posted
 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?

Posted

The spawn works but I want it 270°turned, if possible.

The money script don't gives errors anymore but doesn't work.

No 1000$ given and no Message.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

@ 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) 

YOU HAVE TO TRUST SOMEONE TO BE BETRAYED.I NEVER DID

Posted

Normally you can set Rotation also at spawnPlayer

+ Still no money at login.

My purpose is when a player joins the first time he gets 1000$ but not on reconnect only once.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

Now I got an Error at Money script;

[18:28:20] WARNING: test\server.lua:4: Bad argument @ 'getPlayerName' [Expected 
element at argument 1] 
[18:28:20] ERROR: test\server.lua:4: attempt to concatenate a boolean value 

No Debugscript errors

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

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.

Posted

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

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

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) 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted (edited)
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
Posted

I just noticed that i'm gonna add onPlayerWasted, next problem...

My camera isn't in the right position when spawning (not a huge problem)

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

No camera problem anymore fixed it!

Thanks if I need more help i'll post it

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

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