-
Posts
108 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Spakye
-
hmm im not sure if i understand your issue. So you create a button with relative values and then you want to retrieve his absolute position ? Anyway, you can use guiGetPosition() to retrieve the absolute position of your button but care the position will be relative to his parent.
-
Hello, GUI buttons can also use absolutes values ( according to the wiki, i didnt test it ).
-
Hello, did you see this topic already ? https://forum.multitheftauto.com/topic/88771-object-doublesided/
-
Hello, maybe just add a button to confirm the vehicle creation ? you could also add a timer to disable it for a while after its been used. Though dont forget vehicles created client side cant be driven so you will need to trigger the server at some point.
-
Looks really nice I will definitely try it, well done!
-
Hello, you need to trigger a server event as you said and then from server side you trigger all clients and call the function that manage the spoiler
-
Hello, maybe reducing the weight of the vehicle could help to make it "fly" more.
-
Hello, idk about Dxlib but you can take a look at DGS, i believe its still getting updates and there is a wiki. https://wiki.multitheftauto.com/wiki/Resource:Dgs
-
Hello, make sure that to check that the source of the marker hit event is a player, cause vehicles also trigger the event which cause the error you have. function moveGate(thePlayer) if getElementType(thePlayer) == "player" then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)) , aclGetGroup("pm")) then moveObject(gate, 3000, 978.79998779297, -1693, 8.1999998092651) end end end addEventHandler("onMarkerHit", marker, moveGate)
-
Hey i came up with something, i think its close to what you need. It creates a button in the corner to close the window, kind of attach it to the window so it will update the position whenever the window is moved or resized. It needs some more testing but you can probably make a resource out of it and export the functions createWdwCloseBtn(wdw), showWdwCloseBtn(wdw), hideWdwCloseBtn(wdw) so you can use it anytime you need. local windows = {} function createWdwCloseBtn(wdw) local wx, wy = guiGetPosition( wdw, false ) local ww, wh = guiGetSize( wdw, false ) local cb = guiCreateButton ( wx + ww -20, wy, 20, 20, "x", false) guiSetProperty ( cb, "AlwaysOnTop", "True") windows[wdw] = cb addEventHandler ( "onClientGUIClick", cb, closeTheWindow, false ) addEventHandler("onClientGUISize", wdw, updateCloseBtnPosition ) addEventHandler ( "onClientGUIMove", wdw, updateCloseBtnPosition ) end function updateCloseBtnPosition() local wx, wy = guiGetPosition( source, false ) local ww, wh = guiGetSize( source, false ) guiSetPosition( windows[source], wx + ww -20, wy, false ) guiSetVisible( windows[source], true ) end function closeTheWindow() guiSetVisible( source, false ) for w, b in pairs(windows) do if b == source then guiSetVisible( w, false ) end end end function showWdwCloseBtn(wdw) guiSetVisible( windows[wdw], true ) end function hideWdwCloseBtn(wdw) guiSetVisible( windows[wdw], false ) end local w = guiCreateWindow( 0.3, 0.1, 0.4, 0.4, "A Title", true) createWdwCloseBtn(w)
-
I did some tests, the button isn't showing cause he's hidden by the title bar. local test = guiCreateWindow( 0.3, 0.1, 0.2, 0.2, "test", true ) guiSetProperty ( test, "CloseButtonEnabled", "True") guiSetProperty ( test, "TitlebarEnabled", "False") Now the button will show, but it doesnt close the window when you clic on it and the onGuiClickEvent register it as the window when you clic on it. But have a look at this page : https://wiki.multitheftauto.com/wiki/IsMouseOnGUICloseButton
-
Hello, do you mean messages from scripts with outputChatBox ? If yes i dont think there is an event for it and you probably have to trigger a custom event each time you use outputChatBox. I might be wrong though edit: nvm its is possible with : https://wiki.multitheftauto.com/wiki/OnChatMessage
-
Hello, after some research i think there is a property to add a close btn to your window, I have no idea if it works and how it looks i never tried it. try this : guiSetProperty ( guiElement, "CloseButtonEnabled", "True") https://wiki.multitheftauto.com/wiki/GuiSetProperty http://static.cegui.org.uk/static/WindowsLookProperties.html
-
hello, the function to give money to a player is givePlayerMoney( theplayer, ammount), not givemoney()
-
Ok so the problem is the event handler for the button is out of the function, wich means when the ressource start it can't find the button as it was not created yet so it fails. I recommend you to do something like this : function createGuis() --in this function you place all the guis and event handler attached to guis element window = guiCreateWindow((sW - 406) / 2, (sH - 461) / 2, 455, 465, "Window", false) windowbutton1 = guiCreateButton(330, 432, 118, 22, "butt", false, window) addEventHandler("onClientGUIClick",windowbutton1,myFunction,false) guiSetVisible(window, false) -- we hide the window for now, so you can decide when its gonna be visible end function showWindow() guiSetvisible(window, true) end addCommandHandler ( "w", showWindow ) function myFunction() outputChatBox ("test", 231,217,176,false ) end addCommandHandler("z",myFunction) function ressourceStarted() createGuis() end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStarted) -- this event is triggered when the resource start client side The guis elements are created when the resource start and we hide them, then you show them when needed with showWindow()
-
Do you call the function window() at some point?
-
I tried the code and i have an error, the problem is the function comes after the handler, place the function before.
-
Im not sure why it doesnt work, any errors in debug?
-
Hello, have you tried with this ? guiSetProperty ( element guiElement, string property, string value ) http://static.cegui.org.uk/static/WindowsLookProperties.html#Button
-
local myButton = -- your button code addEventHandler("onClientGUIClick", myButton, myFunction, false) -- this event call the function when the button is clicked function myFunction() -- what to do when the button is clicked end addCommandHandler ( "z", myFunction )
-
Hello, idk if it will work but you can try with triggerEvent()
-
Ok thanks ill keep in that way then
-
Hello! Im currently working on an npc system similar to npcs in bethesda games like elder scrolls or fallout. Basicly if you are close enough to a character, you get an option to talk with him. For each line that the character has, you have few possible answers, each answer will lead you to an other line with new answers, ... Right now all the npcs's datas are saved in a client file like this : npcsData = { { 32.359825134277, --x 39.314876556396, --y 3.1171875, --z 67.613670349121, --rotation 249, --skin 30, --weapon id 0, --interior 0, -- dimension "Spakye", -- npc's name { --Lines : {animation, the line} {"wave","What a lovely day isn't it ?"}, {"talklong","My creator named me Spakye! Im a bot and my job is to answer to your questions.\nWell i don't know many lines but i do my best!"}, {"tired","Nothing really, im bored...\nIf only there was more people on this server..."}, {"talklong","You are in The Mist! A Survival/RPG server!\nWell I don't know if we can call it a server... Nobody ever joins and there is absolutly nothing to do at the moment...\nBut you can be sure my creator is working to make this place unique!"}, }, { -- answers : { line index, theAnswer, the line index it leads to } {1, "Who are you ?", 2}, {2, "Oh ok", 1}, {1, "What are you doing ?", 3}, {3, "What else?", 1}, {1, "Where are we ?", 4}, {4, "Sounds sad..", 1}, }, }, { 21.6, 50.9, 3.12, 170, 141, 0, 0, 0, "Trinity", { {"wave","Hello my name is Trinity!\nWhat can i do for you ?"}, {"talk","Ah then you probably have met me in the UVA server before! I also hangout here at times."}, {"vomit","Nothing much, just chilling arround."}, }, { {1, "Trinity ? i know that name!", 2}, {1, "What are you doing ?", 3}, {2, "Oh ok", 1}, {3, "Oh ok", 1}, }, } } animations = { ["wave"] = {"ped", "endchat_03"}, ["disagree1"] = {"ped", "endchat_02"}, ["disagree2"] = {"GANGS", "Invite_No"}, ["agree"] = {"GANGS", "Invite_Yes"}, ["calmdown"] = {"ped", "endchat_01"}, [":Oyou"] = {"ped", ":Ou"}, ["tired"] = {"ped", "IDLE_tired"}, ["suspicious"] = {"ped", "roadcross"}, ["whisper"] = {"BAR", "Barser_veorder"}, ["armscrossed"] = {"COP_AMBIENT", "Coplook_in"}, ["time"] = {"COP_AMBIENT", "Coplook_watch"}, ["give"] = {"DEALER", "shop_pay"}, ["vomit"] = {"FOOD", "EAT_Vomit_P"}, ["check"] = {"GANGS", "hndshkfa"}, ["shakehand"] = {"GANGS", "prtial_hndshk_biz_01"}, ["sign"] = {"GHANDS", "gsign2LH"}, ["cry"] = {"GRAVEYARD", "mrnF_loop"}, ["talk"] = {"PED", "idle_chat"}, ["talklong"] = {"MISC", "Idle_Chat_02"}, ["scaredhide"] = {"ON_LOOKERS", "panic_hide"}, } So all informations about npcs are saved in this file and the player downloads the file when joining. So i have a few questions, For now i only have 2npcs so the file is quite light, but what if i had like 1000 npcs with complex dialogues and a lot of lines? if instead i was to store all this data into a server file for instance, and then send it to the client when he joins, would that be heavier or lighter on performance? Is it there any difference (in performance) between a table written in a client file and a table that has been sent by the server to the client? What do you think would be the best way of storing this data, knowing that the end goal is to have a serious ammount of npcs arround, and all of them will have a lot of possible lines and answers?
-
Hello, i guess use onClientPlayerWeaponFire and check if the player is on fire with isPedOnFire. Cancel event if he is
-
local markersData = { --{x, y, z, interior, dimension}, } function createBlackjackMarkers() for i, m in ipairs(markersData) do local newMarker = createMarker( m[1], m[2], m[3], "cylinder") setElementInterior(newMarker, m[4]) setElementDimension(newMarker, m[5]) -- add your event handler here end Hello, if i understand well i would do something like that