-
Posts
877 -
Joined
-
Last visited
Everything posted by denny199
-
How could he show that part, when you are having the script? LoL
-
https://wiki.multitheftauto.com/wiki/GuiGetScreenSize There are some calculations there 2. Divide each of the DX text's position values by the screen size manually (remembering the resolution is 1024x768): Left position value is 684, 684/1024 = 0.668 Top position value is 731, 731/768 = 0.952 Right position values is 732, 732/1024 = 0.715 Bottom position value is 766, 766/768 = 0.997 You may want to use a calculator to help you count. 3. Now with the answer above remove all of the position values and replace it with the width or height variable multiplied by the answer. Which would be: local sWidth,sHeight = guiGetScreenSize() -- The variables dxDrawText("Hello World!",sWidth*0.668, sHeight*0.952, sWidth*0.715, sHeight*0.997,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) ---------------------------------------------------------------------------- So if you look at "2." then you need to calculate it like this: calc1 = Left position value / my local screenx = answer for all screen for next calculation screenX calc2 = Top position value / my local screeny = answer for all screen for next calculation screenY calc3 = Right position value/ my local screenx = answer for all screen for next calculation width calc4 = Bottom position value/ my local screeny = answer for all screen for next calculation height So after that you can use it like this: local sX,sY = guiGetScreenSize() sX*calc1, sY*calc2, sX*calc3, sY*calc4 This will be on all the resolutions the same. I hope that I helped you. Kindly regards, Danny
-
use getKeyState : https://wiki.multitheftauto.com/wiki/GetKeyState with onClientRender for GUI's use guiSetPosition and getCursorPosition for DX drawing use variables and getCursorPosition
-
The video is private? Edit: Another way ;p
-
Fraps? Or what do you mean?
-
And you are taking the money on client side, bad idea. Note: Using this function client side (not recommended) will not change a players money server side.
-
ait, thanks for the help! Just added this line: if ( eventName == "onClientResourceStart" ) then load(handlerFunction) end and everything works. Thanks for all your help everyone!
-
Thanks, it all works, but I have one problem, onClientResourceStart isn't triggered while it's storing it in the table? For example this is my code which will be loaded: outputChatBox ( "File loaded?" ) function Boosters () outputChatBox ( "Markers loaded?" ) -- Markers marker1 = createMarker(3284.22, -1774.68, 7.46, "corona", 3, 255, 0, 0, 0) --etc theres more code here end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), Boosters ) It doesn't work because "markers loaded" isn't outputting anything. My load code: function loadfile (data) local loadit = loadstring(data) loaded = pcall(loadit) if loaded then outputChatBox ( "loaded" ) end end And yes, it's outputting : "File loaded?"
-
You aren't triggering on server side: "sendMaxPlayers" to the client... Same with the servername. Even, almost the whole server-side lua file doesn't make any sense
-
Show us your server-side file: function maxP(v) maxPlayers = v end addEvent("sendMaxPlayers", true) addEventHandler("sendMaxPlayers", getRootElement(), maxP) We need that trigger
-
Thanks, but how can I export those functions to the loadstring function still with setfenv?
-
setPedWeaponSlot --To set the slot to a chainsaw toggleControl ( playerElement, "next_weapon", false ) -- disable next_wepaon control toggleControl ( playerElement, "previous_weapon", false ) --disable previous_weapon control --optional giveWeapon -- the player might not have a chainsaw. Or: onClientPlayerWeaponFire --with cancelEvent()
-
It could be anything.... I just need the help, I know outputChatBox is a shitty example. It even could be: local sandBox = {} sandBox.eventHandlers = {} _addEventHandler = addEventHandler function addEventHandler(...) sandBox.eventHandlers["denr.me"] = {...} return _addEventHandler(...) end Can you give me a example?
-
Hm, I readed very carfully, but now I'm stuck in some point what do I need to do next my code for now is: --server cache the file to client addCommandHandler ( "gvd", function(player) local hFile = fileOpen("test.denr") local data = fileRead(hFile, fileGetSize(hFile)) triggerClientEvent ( player, "get:data", player, data ) fileClose(hFile) end) --Client saving and sandbox thingys and i'm stuck here addEvent ( "get:data", true ) addEventHandler ( "get:data", root, function(data) local newFile = fileCreate("test.me") if (newFile) then fileWrite(newFile, data) fileClose(newFile) end loadFile(data) end) local sandBox = {} sandBox.chatbox = {} _outputChatBox = outputChatBox function outputChatBox(...) sandBox.chatbox["test.me"] = {...} return _outputChatBox(...) end function loadFile (data) local loaded = loadstring(data) setfenv(loaded, sandBox) return pcall(loaded) end The test.me contains: outputChatBox ( "Chinees" ) Errors: None What do I have to do now? I'm lost ;p
-
https://wiki.multitheftauto.com/wiki/BreakObject Or just set the handling of a vehicle very high and then attach it to the front of your vehicle.
-
Hi guys, I was busy with creating some gamemode like my own deathrace gamemode, and my own survival gamemode in one server with different arenas, but now I need to use loadstring to load those client side scripts, because i'm running to some own made single-player games only client side for the player. But the unloading is a big problem. I have readed serveral posts about wrappers, but I still don't understand it exactly how it works within loadstring. How does a wrapper work? like overwriting eventHandlers,etc. Do I just need to make wrappers inside the loading function with loadstring like this: _playSound = playSound function playSound(filepath, looped) _playSound ( "denr.mp3", looped ) end function loadscript(content) local loading = loadstring(content) end addCommandHandler ( "loadme", loadscript ) Does this wrapper overwrite the functions in loadstring too what uses playSound? Kindly regards, Danny
-
You can set the vehicle handling mass very heavy, so that it will break everything. Just try it with hedit.
-
Well, I'll explain it better: function specPlayer( player, cmd, typedArgument ) --player = the player who typed the command --cmd = the command name --typedArgument is a argument what you can pass with commandHandler end -- adding a end to close the function addCommandHandler ( "spectate", specPlayer ) When the player now typs: "/spectate danny" it will returnt typedArgument, because see here: https://wiki.multitheftauto.com/wiki/AddCommandHandler scroll down to "Handler function parameters"
-
As you can see on the wiki under "Handler function parameters" : player playerSource, string commandName, [string arg1, string arg2, ...] So: addCommandHandler ( "spectate", function (player, cmd, playername ) -- your code end) So you can excecute "playername" as the text what you have typed in game like: "/spectate [DenR]Danny" So now 'playername' will return "[DenR]Danny" if the argument isn't specifided it will return "nil" So you actually need to chek that argument: addCommandHandler ( "spectate", function (player, cmd, playername ) if ( playername ) then outputChatBox ( playername ) end end) edit: You want to spectate the player I guess, then these functions might help you: setCameraTarget getPlayerFromName Maybe some usefull functions that might help you to improve your code: https://wiki.multitheftauto.com/wiki/Get ... omNamePart
-
redirection to a new website with a software-downloader: https://community.multitheftauto.com/ind ... ls&id=7198 DONE
-
Because you are executing two functions with f1 at the same time, one function is showing the gui and one is hiding the gui. Try this: function opencloseGUI() local state = not guiGetVisible(shopWindow) guiSetVisible(shopWindow,state) showCursor(state) end bindKey ( "F1", "down", opencloseGUI )
-
A: Q:Do you love goat sex?
-
He ment this resource : https://community.multitheftauto.com/in ... ls&id=7146 , i can't help you right now because I need to go, I help you later on this day my exams are starting
-
You can disable it in the tab "settings" (up in the screen)
