-
Posts
1,646 -
Joined
-
Last visited
Everything posted by CapY
-
Where are matrixCams defined ? EDIT:Doesnt work. Error on line 2.
-
Well i have a problem with switching matrix cams . local matrixCams = { --{camX,camY,camZ,sthZ,distance} {1614.837, -1301.275, 38.188, 200, 400}, --LS {2052.229, 1559.058, 10.671, 125, 200}, --LV {-1856.736, 807.699, 112.546, 300, 250}, --SF } function setCameraOnPlayerJoin() -- set the player's camera to a fixed position, looking at a fixed point if getCameraMatrix() then setTimer(matrixCams,5,5) addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) addEventHandler("onClientGUIClick", Btn2[2],camTarget, false ) addEventHandler("onClientGUIClick", Btn3[3],camTarget, false ) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),setCameraOnPlayerJoin) Error on line 11. EDIT: This is just a part of the code.
-
Thanks Qais , but i dont want that. EDIT: When somebody type /reconnect and get back into the game then setCameraMatrix doesnt work and then i must to restart the resource, how to make setCameraMatrix work everytime ? EDIT2:This part needs to be fixed, because it doesnt work when someone joins more times , it just work when someone joins first time . function setCameraOnPlayerJoin() -- set the player's camera to a fixed position, looking at a fixed point setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) end addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) Whole script: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Window = {} GUIEditor_Memo = {} GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) guiSetAlpha(GUIEditor_Window[1],0.80000001192093) GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490," Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) showCursor(true) guiSetVisible(GUIEditor_Window[1],true) addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(Window[ 1 ],true) end,false) end ) addEventHandler("onClientResourceStart",resourceRoot, function() Window = {} Button1 = {} Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) guiSetVisible(Window[1],false) showCursor(true) addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false ) end ) function MarkerHit() -- define MarkerHit function for the handler setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) guiSetVisible ( Window [ 1 ] , false ) showCursor ( false ) end function setCameraOnPlayerJoin() -- set the player's camera to a fixed position, looking at a fixed point setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) end addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) function camTarget() setCameraTarget(localPlayer) end
-
Okay i moved it to client side only , but now setCameraMatrix doesnt work. Script: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Window = {} GUIEditor_Memo = {} GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) guiSetAlpha(GUIEditor_Window[1],0.80000001192093) GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490," Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) showCursor(true) guiSetVisible(GUIEditor_Window[1],true) addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(Window[ 1 ],true) end,false) end ) addEventHandler("onClientResourceStart",resourceRoot, function() Window = {} Button1 = {} Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) guiSetVisible(Window[1],false) showCursor(true) addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false ) end ) addEvent("clientFalseCam",true) addEventHandler("clientFalseCam",resourceRoot,function() end) function MarkerHit() -- define MarkerHit function for the handler setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) guiSetVisible ( Window [ 1 ] , false ) showCursor ( false ) end function setCameraOnPlayerJoin() -- set the player's camera to a fixed position, looking at a fixed point setCameraMatrix( 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) addEventHandler("onClientGUIClick", Button1[1],camTarget, false ) end addEventHandler("onClientResourceStart",getRootElement(),setCameraOnPlayerJoin) function camTarget() setCameraTarget(localPlayer,false) end addEventHandler("onClientResourceStart",getRootElement(),camTarget)
-
Wait , why you just dont create that group in ACL and set the acl permissions ?
-
Well after GUI clicking the camera is not returned to a player. Client: addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Button = {} GUIEditor_Window = {} GUIEditor_Memo = {} GUIEditor_Window[ 1 ] = guiCreateWindow(0.2805,0.2139,0.4172,0.5713,"Rules ",true) guiSetAlpha(GUIEditor_Window[1],0.80000001192093) GUIEditor_Memo[1] = guiCreateMemo(16,38,501,490," Here is a list of our rules, respect them.\n\n\n1. Do NOT use any kinds of hacks and cheats. \n\n2. Do NOT argue with staff, our is last word.\n\n3. Respect other players , especially members.\n\n4. Dont fight with others.\n\n5. Dont use any outgame modified handlings ( use handling editor for that, more info on F9 ) \n\n6. Never ask for membership, we will ask you .\n\n7. Dont bother staff .\n\n8. Have a bit of experience .\n\n9. If something is not understand to you , just read help on F9 .\n\n10. Dont spam vehicles , dont RAM others.\n\n\nAbove all , have fun !\n\n\n\n\nNote: Every rule break can result as kick / ban or permaban.",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(211,547,128,29,"Accept !",false,GUIEditor_Window[1]) showCursor(true) guiSetVisible(GUIEditor_Window[1],true) addEventHandler("onClientGUIClick",GUIEditor_Button[1], function() guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(Window[ 1 ],true) end,false) end ) addEventHandler("onClientResourceStart",resourceRoot, function() Window = {} Button1 = {} Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"Teleport",true) Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) guiSetVisible(Window[1],false) showCursor(true) addEventHandler("onClientGUIClick", Button1[1],MarkerHit, false ) triggerServerEvent("setCamera",getRootElement(),setCameraOnPlayerJoin) setCameraTarget(thePlayer) end ) addEvent("clientFalseCam",true) addEventHandler("clientFalseCam",resourceRoot,function() end) function MarkerHit() -- define MarkerHit function for the handler setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) guiSetVisible ( Window [ 1 ] , false ) showCursor ( false ) end Server: function setCameraOnPlayerJoin(thePlayer) -- slowly fade the camera in to make the screen visible fadeCamera(source, true, 5) -- set the player's camera to a fixed position, looking at a fixed point setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) triggerClientEvent("clientFalseCam",resourceRoot,function() end) end addEventHandler("onPlayerJoin",getRootElement(),setCameraOnPlayerJoin) addEvent("setCamera",true) addEventHandler("setCamera",resourceRoot,setCameraOnPlayerJoin) and something is wrong with triggerClient and triggerServerEvent.
-
Yes i founded the function before your post, i'm using the wiki .
-
Okay, and how i can attach camera to the player again, after gui click .
-
Lol i checked the whole code , but i was think there is other function than guiSetVisible. Edit: I fixed the code, thanks for help you two. EDIT2:One question , when someone reads rules GUI ,how to set camera automatically moves trought some city?
-
I already fixed some errors , but i really didnt know the function . No problem.
-
Qaisjp you dont need to do it , it's fixed , that was an MTA bug .
-
Yes but i got 2 Windows started onClientResource start , i want it one after another. Does that function exists in the client side ? Like check is previous window closed if is then start teleport GUI .
-
Can i know how you did it , i must use it on few more GUI's . By the way , when i ( this is an example ) click Accept! on the rules window , can that teleport GUI show up after clicking Accept! button ? If yes , give me the function (from wiki).
-
One more bug , no matter where on the window i will click, i will get teleported and window will got closed , how to fix it ?
-
It works , but GUI doesnt hide and Cursor is still there, why ?
-
So i created this : Script: addEventHandler("onClientResourceStart",resourceRoot, function() Window = {} Button1 = {} Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"",true) Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) guiSetVisible(Window[1],true) showCursor(true) addEventHandler("onClientGUIClick", Button1[1],function() guiSetVisible(Window[1],false) showCursor(false) end,false) end ) function MarkerHit() -- define MarkerHit function for the handler local elementType = getElementType() -- get the hit element's type setElementPosition ( getLocalPlayer(), 1688.6726074219, 1428.3284912109, 30.770175933838 ) addEventHandler("onClientGUIClick", Button1[1], MarketHit() end ) Error on line 22 and 23.
-
By the way .. i created a GUI, when player joins he have to press "LS" button and then he will got spawned on airport , i only have a GUI (because i dont know which functions i need) addEventHandler("onClientResourceStart",resourceRoot, function() Window = {} Button1 = {} Window[1] = guiCreateWindow(0.7602,0.2939,0.2219,0.2373,"",true) Button1[1] = guiCreateButton(0.088,0.6379,0.5106,0.2263,"LS",true,Window[1]) guiSetVisible(Window[1],true) showCursor(true) addEventHandler("onClientGUIClick", Button1[1],function() guiSetVisible(Window[1],false) showCursor(false) end,false) end ) Can i know which functions i need for GUI Teleport ?
-
Is it possible to create it in client side a display it after 10 secs ?
-
Good work will, i tested all 3 versions.
-
Sorry for bumping , but i cant post the whole client in last post( it's too big, 67735 letters of 60k allowed ) -- THESE CAN BE CHANGED triggerKey = "tab" -- default button to open/close scoreboard settingsKey = "F7" -- default button to open the settings window drawOverGUI = true -- draw scoreboard over gui? seperationSpace = 120 -- the space between top/bottom screen and scoreboard top/bottom in pixels -- BUT DON'T TOUCH THESE scoreboardToggled = false scoreboardForced = false scoreboardDrawn = false forceScoreboardUpdate = false useAnimation = true scoreboardIsToggleable = false showServerInfo = false showGamemodeInfo = false showTeams = true useColors = true drawSpeed = 1 scoreboardScale = 1 teamHeaderFont = "clear" contentFont = "default-bold" columnFont = "default-bold" serverInfoFont = "default" rmbFont = "clear" cBlack = tocolor( 0, 0, 0 ) cWhite = tocolor( 255, 255, 255 ) cSettingsBox = tocolor( 255, 255, 255, 150 ) MAX_PRIRORITY_SLOT = 500 scoreboardColumns = {} resourceColumns = {} scoreboardDimensions = { ["width"] = 0, ["height"] = 0, ["phase"] = 1, ["lastSeconds"] = 0 } scoreboardTicks = { ["lastUpdate"] = 0, ["updateInterval"] = 500 } scoreboardContent = {} firstVisibleIndex = 1 sortBy = { ["what"] = "__NONE__", ["dir"] = -1 } -- -1 = dec, 1 = asc sbOutOffset, sbInOffset = 1, 1 sbFont = "clear" sbFontScale = 0.68 serverInfo = {} fontScale = { -- To make all fonts be equal in height ["default"] = 1.0, ["default-bold"] = 1.0, ["clear"] = 1.0, ["arial"] = 1.0, ["sans"] = 1.0, ["pricedown"] = 0.5, ["bankgothic"] = 0.5, ["diploma"] = 0.5, ["beckett"] = 0.5 } selectedRows = {} addEvent( "onClientPlayerScoreboardClick" ) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( resource ) cScoreboardBackground = tocolor( defaultSettings.bg_color.r, defaultSettings.bg_color.g, defaultSettings.bg_color.b, defaultSettings.bg_color.a ) cSelection = tocolor( defaultSettings.selection_color.r, defaultSettings.selection_color.g, defaultSettings.selection_color.b, defaultSettings.selection_color.a ) cHighlight = tocolor( defaultSettings.highlight_color.r, defaultSettings.highlight_color.g, defaultSettings.highlight_color.b, defaultSettings.highlight_color.a ) cHeader = tocolor( defaultSettings.header_color.r, defaultSettings.header_color.g, defaultSettings.header_color.b, defaultSettings.header_color.a ) cTeam = tocolor( defaultSettings.team_color.r, defaultSettings.team_color.g, defaultSettings.team_color.b, defaultSettings.team_color.a ) cBorder = tocolor( defaultSettings.border_color.r, defaultSettings.border_color.g, defaultSettings.border_color.b, defaultSettings.border_color.a ) cServerInfo = tocolor( defaultSettings.serverinfo_color.r, defaultSettings.serverinfo_color.g, defaultSettings.serverinfo_color.b, defaultSettings.serverinfo_color.a ) cContent = tocolor( defaultSettings.content_color.r, defaultSettings.content_color.g, defaultSettings.content_color.b, defaultSettings.content_color.a ) bindKey( triggerKey, "down", "Toggle scoreboard", "1" ) bindKey( triggerKey, "up", "Toggle scoreboard", "0" ) bindKey( settingsKey, "down", "Open scoreboard settings", "1" ) addEventHandler( "onClientRender", getRootElement(), drawScoreboard ) triggerServerEvent( "onClientDXScoreboardResourceStart", getRootElement() ) readScoreboardSettings() triggerServerEvent( "requestServerInfo", getRootElement() ) colorPicker.constructor() end ) addEventHandler( "onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo( output ) serverInfo = output end addEvent( "sendServerInfo", true ) addEventHandler( "sendServerInfo", getResourceRootElement( getThisResource() ), sendServerInfo ) function toggleScoreboard( _, state ) state = iif( state == "1", true, false ) if scoreboardIsToggleable and state then scoreboardToggled = not scoreboardToggled elseif not scoreboardIsToggleable then scoreboardToggled = state end end addCommandHandler( "Toggle scoreboard", toggleScoreboard ) function openSettingsWindow() if scoreboardDrawn then local sX, sY = guiGetScreenSize() if not (windowSettings and isElement( windowSettings ) and guiGetVisible( windowSettings )) then createScoreboardSettingsWindow( sX-323, sY-350 ) showCursor( true ) elseif isElement( windowSettings ) then destroyScoreboardSettingsWindow() end end end addCommandHandler( "Open scoreboard settings", openSettingsWindow ) addCommandHandler( "scoreboard", function () scoreboardToggled = not scoreboardToggled end ) function iif( cond, arg1, arg2 ) if cond then return arg1 end return arg2 end function drawScoreboard() local sX, sY = guiGetScreenSize() if #scoreboardColumns ~= 0 then local currentSeconds = getTickCount() / 1000 local deltaSeconds = currentSeconds - scoreboardDimensions.lastSeconds scoreboardDimensions.lastSeconds = currentSeconds deltaSeconds = math.clamp( 0, deltaSeconds, 1/25 ) if scoreboardToggled or scoreboardForced then local phases = { [1] = { ["width"] = s(20), ["height"] = s(5), ["incToWidth"] = s(20), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(20), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if not useAnimation then scoreboardDimensions.width = calculateWidth() scoreboardDimensions.height = calculateHeight() scoreboardDimensions.phase = #phases end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToWidth - scoreboardDimensions.width, maxChange ) local maxHeightDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToHeight - scoreboardDimensions.height, maxChange ) if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = scoreboardDimensions.width + maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end elseif scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth and not scoreboardDrawn then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end end if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = scoreboardDimensions.height + maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end elseif scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight and not scoreboardDrawn then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].incToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].incToHeight then if phases[scoreboardDimensions.phase + 1] then scoreboardDimensions.phase = scoreboardDimensions.phase + 1 else if not scoreboardDrawn then bindKey( "mouse2", "both", showTheCursor ) bindKey( "mouse_wheel_up", "down", scrollScoreboard, -1 ) bindKey( "mouse_wheel_down", "down", scrollScoreboard, 1 ) addEventHandler( "onClientClick", getRootElement(), scoreboardClickHandler ) if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end triggerServerEvent( "requestServerInfo", getRootElement() ) end scoreboardDrawn = true end end elseif scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then local phases = { [1] = { ["width"] = s(20), ["height"] = s(5), ["incToWidth"] = s(20), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(60), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(20), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(),
-
I know where .. i tried it , but doesnt work. EDIT:It's called dxscoreboard_client
-
How to resize scoreboard weight and height ? I already tried , but didnt worked.
-
Heh.. you cant know that , i have 2-3 friends who knows how to script and yes .. i know many balkan people who plays MTA , but dont have an acc on the forums .
-
Something is wrong with the function , because i know the GUI works(i tested it ) , but it's not displayed (visible), i just want GUI to be visible after 10 seconds.