SoMoRay Posted March 8, 2013 Share Posted March 8, 2013 hi guys I do spawn but there proplem see the picture I can't change team with I click in arrow right and arrow left this is Client GUIEditor = { button = {}, } spawn = guiCreateButton(583, 690, 191, 58, "Spawn", false) guiSetFont(GUIEditor.button[1], "clear-normal") addEventHandler("onClientGUIClick",spawn, function () triggerServerEvent("setTeam",localPlayer) end) addEventHandler("onClientGUIClick",spawn, function () triggerServerEvent("setTeam2",localPlayer) end) Server Team = createTeam ("Rebel",255,0,0) addEvent("setTeam",true) addEventHandler("setTeam",root, function (theplayer1) bindKey("arrow_r", "down",theplayer1) setCameraMatrix( theplayer, 1568.5963134766, -1691.4530029297, 5.890625) setPlayerTeam(source,Team) spawnPlayer (source, 1568.5963134766, -1691.4530029297, 5.890625,0,1,0,1,Team) Anims = {"dnce_M_b","DAN_Left_A","DAN_Down_A","DAN_Loop_A"} setPedAnimation( ped, "DANCING", Anims[math.random(1,4)]) ped = createPed (1,1568.5963134766,-1691.4530029297,5.890625) pedSkin = getElementModel(ped) setElementModel(ped,id) giveWeapon ( source, 30, 9999,true ) giveWeapon ( source, 31, 9999,true ) setTeamFriendlyFire ( getTeamFromName("Rebel"),false) outputChatBox ( "#FF0000 You Take Rebel Team !", 255, 255, 255, true ) end ) Team2 = createTeam ("Police",255,0,0) addEvent("setTeam2",true) addEventHandler("setTeam2",root, function (theplayer2) bindKey("arrow_l", "down",theplayer2) setCameraMatrix( theplayer, 1485.0311279297, -2234.9086914063, 13.546875) Anims = {"dnce_M_b","DAN_Left_A","DAN_Down_A","DAN_Loop_A"} setPedAnimation( ped, "DANCING", Anims[math.random(1,4)]) ped = createPed (280, 1485.0311279297, -2234.9086914063, 13.546875) pedSkin = getElementModel(ped) setElementModel(ped,id) spawnPlayer (source, 1485.0311279297, -2234.9086914063, 13.546875,0,280,0,0,Team2) giveWeapon ( source, 30, 9999,true ) giveWeapon ( source, 31, 9999,true ) setTeamFriendlyFire ( getTeamFromName("Police"),false) outputChatBox ( "#FF0000 You Take Police Team !", 255, 255, 255, true ) end ) Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 This script make no sense at all . Link to comment
===|OSAMA|=== Posted March 8, 2013 Share Posted March 8, 2013 https://forum.multitheftauto.com/viewtopic.php?f=160&t=55416&start=30#p535590 Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 https://forum.multitheftauto.com/viewtopic.php?f=160&t=55416&start=30#p535590 thanx ! how to make him take from map the team in the map and spawn with the map x, y , z Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 how I make playSound when resource start + when they click Spawn the sound stop Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 playSound "onClientResourceStart" stopSound "onClientGUIClick" For Example : addEventHandler("onClientResourceStart",resourceRoot, function () sound = playSound("File.mp3",true) end) addEventHandler("onClientGUIClick",button, function () stopSound(sound) sound = nil end) Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 playSound "onClientResourceStart" stopSound "onClientGUIClick" For Example : addEventHandler("onClientResourceStart",resourceRoot, function () sound = playSound("File.mp3",true) end) addEventHandler("onClientGUIClick",button, function () stopSound(sound) sound = nil end) what proplem I put ur code for play sound he kick me from server and said wrong code Download error: Error downloading requested files. HTTP response code said error. [The requested URL returned error: 404] [spawn@00/Client.lua] Client Side ! x, y = guiGetScreenSize ( ) function centerWindow ( center_window, k, v ) local screenW, screenH = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( screenW - windowW ) / v, ( screenH - windowH )/k guiSetPosition ( center_window, x, y, false ) end addEventHandler("onClientResourceStart",resourceRoot, function () sound = playSound("Alhajarii.mp3",true) end) thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) function Right ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 280 ) then setElementModel ( thePed, 280 ) else setElementModel ( thePed, 1 ) end end end function Left ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 1 ) then setElementModel ( thePed, 1 ) else setElementModel ( thePed, 280 ) end end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == SpawnBtn ) then triggerServerEvent ( "spawnPed", localPlayer, getElementModel ( thePed ) ) if isElement ( thePed ) then destroyElement ( thePed ) end if isElement ( theObject ) then destroyElement ( theObject ) end destroyElement ( SpawnBtn ) destroyElement ( RightBtn ) destroyElement ( LeftBtn ) showCursor ( false ) elseif ( source == RightBtn ) then Right ( ) elseif ( source == LeftBtn ) then Left ( ) end end Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 Try this : x, y = guiGetScreenSize ( ) function centerWindow ( center_window, k, v ) local screenW, screenH = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( screenW - windowW ) / v, ( screenH - windowH )/k guiSetPosition ( center_window, x, y, false ) end addEventHandler("onClientResourceStart",resourceRoot, function () sound = playSound("Alhajarii.mp3") end) thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) function Right ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 280 ) then setElementModel ( thePed, 280 ) else setElementModel ( thePed, 1 ) end end end function Left ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 1 ) then setElementModel ( thePed, 1 ) else setElementModel ( thePed, 280 ) end end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == SpawnBtn ) then triggerServerEvent ( "spawnPed", localPlayer, getElementModel ( thePed ) ) if isElement ( thePed ) then destroyElement ( thePed ) end if isElement ( theObject ) then destroyElement ( theObject ) end destroyElement ( SpawnBtn ) destroyElement ( RightBtn ) destroyElement ( LeftBtn ) stopSound(sound) sound = nil showCursor ( false ) elseif ( source == RightBtn ) then Right ( ) elseif ( source == LeftBtn ) then Left ( ) end end ) Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 Try this : x, y = guiGetScreenSize ( ) function centerWindow ( center_window, k, v ) local screenW, screenH = guiGetScreenSize ( ) local windowW, windowH = guiGetSize ( center_window, false ) local x, y = ( screenW - windowW ) / v, ( screenH - windowH )/k guiSetPosition ( center_window, x, y, false ) end addEventHandler("onClientResourceStart",resourceRoot, function () sound = playSound("AlooyFTW.mp3") end) thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) function Right ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 280 ) then setElementModel ( thePed, 280 ) else setElementModel ( thePed, 1 ) end end end function Left ( ) if ( isElement ( thePed ) ) then if ( getElementModel ( thePed ) ~= 1 ) then setElementModel ( thePed, 1 ) else setElementModel ( thePed, 280 ) end end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == SpawnBtn ) then triggerServerEvent ( "spawnPed", localPlayer, getElementModel ( thePed ) ) if isElement ( thePed ) then destroyElement ( thePed ) end if isElement ( theObject ) then destroyElement ( theObject ) end destroyElement ( SpawnBtn ) destroyElement ( RightBtn ) destroyElement ( LeftBtn ) stopSound(sound) sound = nil showCursor ( false ) elseif ( source == RightBtn ) then Right ( ) elseif ( source == LeftBtn ) then Left ( ) end end ) still same proplem did't fixed this is the meta Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 sound = playSound("AlooyFTW.mp3") ?? Copy My Code Again! Make Sure Next Time ? Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 (edited) sound = playSound("AlooyFTW.mp3") ?? Copy My Code Again! Make Sure Next Time ? thanx Edited March 8, 2013 by Guest Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 (edited) It Works? . Edited March 8, 2013 by Guest Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 You're Welcome . still the proplem Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 Do You Get Any Error? It's Work With Me! Link to comment
Castillo Posted March 8, 2013 Share Posted March 8, 2013 That meta is wrong, you put "Client", not "client". Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 That meta is wrong, you put "Client", not "client". I'm sorry I did not watch out for meta lol. Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 That meta is wrong, you put "Client", not "client". also still he tell me like the picture in up Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 The problem is from you're server host works good with me. Link to comment
SoMoRay Posted March 8, 2013 Author Share Posted March 8, 2013 The problem is from you're server host works good with me. ok all think now fixed but the spawn mode he is did't work cameraMatrix when player join server did't take the ped fly + the sound did't play and I want when player wasted the spawn mode open for him to take team Link to comment
iPrestege Posted March 9, 2013 Share Posted March 9, 2013 The sound work's with me but i don't know what's the fuc k problem with you? and try to make it you're self the other what you ask me to do it. Link to comment
SoMoRay Posted March 9, 2013 Author Share Posted March 9, 2013 The sound work's with me but i don't know what's the fuc k problem with you? and try to make it you're self the other what you ask me to do it. how I do it ? event "onPlayerWasted" triggerClientEvent -------------------------- event "onPlayerJoin" triggerClientEvent Link to comment
Sasu Posted March 9, 2013 Share Posted March 9, 2013 You didnt create a function with this thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) This should be: function joinPlayer() thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) end addEventHandler("onClientPlayerJoin", getRootElement(), joinPlayer) Link to comment
iPrestege Posted March 9, 2013 Share Posted March 9, 2013 You didnt create a function with this thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) This should be: function joinPlayer() thePed = createPed ( 1, 0, 0, 500, 90 ) setElementFrozen ( thePed, true ) setCameraMatrix ( -3.6658203125, 0, 500.48254455566, 2906.9938964844, 0, 201.84664916992 ) Animations = { "dnce_M_b"} setPedAnimation( thePed, "DANCING", Animations [ math.random ( #Animations ) ] ) theObject = createObject ( 1337, 0, 0, 499, 60 ) setElementAlpha ( theObject, 0 ) SpawnBtn = guiCreateButton( 0, 0, 125, 62.5, "Spawn", false ) centerWindow ( SpawnBtn, 1.2, 1.96 ) RightBtn = guiCreateButton( 0, 0, 70, 35, ">", false ) centerWindow ( RightBtn, 2, 1.4 ) LeftBtn = guiCreateButton( 0, 0, 70, 35, "<", false ) centerWindow ( LeftBtn, 2, 3.3 ) showCursor ( true ) end addEventHandler("onClientPlayerJoin", getRootElement(), joinPlayer) Or better use : onClientResourceStart and onClientPlayerWasted 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