Leonard.DC Posted November 30, 2013 Share Posted November 30, 2013 Hi, i know this problem is too stupid, but i cant fix it by myself Server Side: function spawnFirst () local mySkins = { 7, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 35, 33, 34, 37, 40, 41, 43, 45, 41, 46, 47, 48, 51, 52, 59, 60, 66, 67, 78, 98, 101, 123, 124, 125, 128,138, 143, 144 } spawnPlayer (source, 1684.73242, -2330.71021, 13.54688, 360, mySkins[math.random(1, #mySkins)], 0, 0, OffDuty) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end function odTeam () OffDuty = createTeam ( "OffDuty", 0, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, odTeam) When the player connect and spawn for the first time to the server, he doesn't move to the OffDuty team, He be in the original place, on the top, Why? What i do wrong, please respond Link to comment
Spliff Posted November 30, 2013 Share Posted November 30, 2013 Add the "Offduty" team above the spawn, is the two codes in the same script? Perhaps try something like this; function spawnFirst () local mySkins = { 7, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 35, 33, 34, 37, 40, 41, 43, 45, 41, 46, 47, 48, 51, 52, 59, 60, 66, 67, 78, 98, 101, 123, 124, 125, 128,138, 143, 144 } local OffDuty = setPlayerTeam ( "OffDuty", 0, 0, 0 ) spawnPlayer (source, 1684.73242, -2330.71021, 13.54688, 360, mySkins[math.random(1, #mySkins)], 0, 0, OffDuty) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end If not, try this; function spawnFirst () local mySkins = { 7, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 35, 33, 34, 37, 40, 41, 43, 45, 41, 46, 47, 48, 51, 52, 59, 60, 66, 67, 78, 98, 101, 123, 124, 125, 128,138, 143, 144 } spawnPlayer (source, 1684.73242, -2330.71021, 13.54688, 360, mySkins[math.random(1, #mySkins)], 0, 0, "OffDuty") setCameraTarget (source, source) fadeCamera(source, true, 2.0) end (Adding "" around OffDuty, as the team is a name) EDIT3: I think the last code should do the job, but I'll leave both here for now Link to comment
Leonard.DC Posted November 30, 2013 Author Share Posted November 30, 2013 Dont work sir, i was tryed this, but it doesn't move me to the team Edit: This is an example from the wiki spawnTeam = createTeam ("Teamname", 255, 0, 0) -- Create team to spawn. function spawnOnLogin (prevA, curA, autoLogin) outputChatBox ("Welcome to ...", source, 255, 0, 0, false) spawnPlayer (source, 0, 0, 5, 0, math.random (0,288), 0, 0, spawnTeam) -- spawns player with random skin fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerLogin", getRootElement(), spawnOnLogin) They say it set the player to the team, but i think something is wrong Link to comment
Spliff Posted November 30, 2013 Share Posted November 30, 2013 What eventHandler are you using on the first code you posted? Try making it client-side, using this eventhandler; onClientPlayerSpawn (https://wiki.multitheftauto.com/wiki/On ... layerSpawn) Link to comment
Leonard.DC Posted November 30, 2013 Author Share Posted November 30, 2013 mmm, im tried onPlayerSpawn, its something like onClientPlayerSpawn Link to comment
Spliff Posted November 30, 2013 Share Posted November 30, 2013 Please post the full code of the first code, include the eventHandler too, and it's onClientPlayerSpawn, did you try to make the script client-sided? Link to comment
Leonard.DC Posted November 30, 2013 Author Share Posted November 30, 2013 I need trigger it? Link to comment
Spliff Posted November 30, 2013 Share Posted November 30, 2013 Added on skype, it'll go alot more smooth there, I'll return with the solution and problem. Link to comment
Spliff Posted November 30, 2013 Share Posted November 30, 2013 Changed the first code to this; function spawnFirst () setPlayerTeam (source, Civil) end addEventHandler("onPlayerSpawn", getRootElement(), spawnFirst ) He never called his function, and when he afterwards did, it interfeered with his spawn system, works now. 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