ViRuZGamiing Posted November 4, 2013 Share Posted November 4, 2013 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
Vision Posted November 4, 2013 Share Posted November 4, 2013 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
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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
pa3ck Posted November 4, 2013 Share Posted November 4, 2013 function money() setPlayerMoney( source, 1000 ) end Link to comment
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 @Castro I still don't spawn. Spawnmanager and My Gamemode are running, Play and freeroam stopped. If I login i don't spawn Link to comment
Price. Posted November 4, 2013 Share Posted November 4, 2013 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
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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
Price. Posted November 4, 2013 Share Posted November 4, 2013 rootElement = getRootElement() function money() outputChatBox(getPlayerName(getElementRoot()).." has logged in!", getElementRoot()) givePlayerMoney( getElementRoot(), 1000 ) end addEventHandler("onPlayerLogin", rootElement, money) Link to comment
pa3ck Posted November 4, 2013 Share Posted November 4, 2013 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
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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. Link to comment
Price. Posted November 4, 2013 Share Posted November 4, 2013 @ 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
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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. Link to comment
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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 Link to comment
pa3ck Posted November 4, 2013 Share Posted November 4, 2013 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
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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 Link to comment
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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
pa3ck Posted November 4, 2013 Share Posted November 4, 2013 (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 November 4, 2013 by Guest Link to comment
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 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) Link to comment
ViRuZGamiing Posted November 4, 2013 Author Share Posted November 4, 2013 No camera problem anymore fixed it! Thanks if I need more help i'll post it Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now