
drk
Members-
Posts
1,607 -
Joined
-
Last visited
Everything posted by drk
-
Não é necessário converter skins... Use a função engineLoadDFF, engineReplaceModel, engineLoadTXD e engineImportTXD. Exemplo: addEventHandler('onClientResourceStart',resourceRoot, function() txd = engineLoadTXD ( 'data/infernus.txd' ) -- troque data/infernus.txd pelo diretorio/nome do seu veiculo engineImportTXD( txd, 411 ) dff = engineLoadDFF ( 'data/infernus.dff', 411 ) -- troque data/infernus.dff pelo diretorio/nome do seu veiculo engineReplaceModel ( dff, 411 ) outputChatBox '* Replacing models... Done! Check out new vehicles!' end )
-
Can you post videos Killerbee?
-
Only groups in ACL are supported.
-
Color codes? #ff0000, #00ff00 in text argument ? Use my edited dxDrawColorText: function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end
-
You're welcome We are here to help.
-
Sometimes I get this bug too but I don't know why. Reconnect and try.
-
xml example: Some amazing text In all xml files. And change xmlFindChild "rules" to your node ( in my example, node is "one" without " " )
-
I'm back! No. You forgot " on the end of argument 1 ( text ) in outputChatBox. Try: addEventHandler('onPlayerWasted',root, function(ammo,attacker,weapon,bodypart) if attacker and attacker ~= source then local car = getPedOccupiedVehicle(attacker) if car then if getElementModel(car) == 425 then outputChatBox ( getPlayerName(attacker).." has killed you!",source,255,255,255,false) outputChatBox ( getPlayerName(attacker).." has killed "..getPlayerName(source),root,255,255,255,false) end end end end ) I've not tested but I get no error in debug
-
Sorry but we only help solving issues or creating scripts. We not create the full script. But if you want help ... Now I don't have much time.. I will be AFK.
-
You have to replace "replaceWithYourNode" with your xml's nodes names. Example: Change in your xml's the node names ( e.g: WHAT THE FUCK ) that you want to get. And set the same for all.
-
It gives in an in-look to others, it is quite useful, plus, if ran on RPG / RP, it can easily be converted to bank money. I agree with JR10. It isn't useful. Anyone can do this, it's so easy to do ( and anyone can make better than this ).
-
Working now, Thank's. -- You're welcome Last question about the GUI: How to make a Register panel to it? -- Use mine code as a base and instead of login in into the account use addAccount ( https://wiki.multitheftauto.com/wiki/addAccount ). Any problem post here. We are here to help.
-
Client: wdwLogin = guiCreateWindow(0.375, 0.375, 0.25, 0.25, "Please Log In", true) guiCreateLabel(0.0825, 0.2, 0.25, 0.25, "Username", true, wdwLogin) guiCreateLabel(0.0825, 0.5, 0.25, 0.25, "Password", true, wdwLogin) edtUser = guiCreateEdit(0.415, 0.2, 0.5, 0.15, "", true, wdwLogin) edtPass = guiCreateEdit(0.415, 0.5, 0.5, 0.15, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) btnLogin = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Log In", true, wdwLogin) guiSetVisible(wdwLogin, false) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(wdwLogin, true) showCursor(true) guiSetInputEnabled(true) end ) addEventHandler('onClientGUIClick',root, function() if source == btnLogin then local user = guiGetText(edtUser) local pass = guiGetText(edtPass) if user and pass then triggerServerEvent('submitLogin',localPlayer,user,pass) guiSetInputEnabled(false) showCursor(false) guiSetVisible(wdwLogin,false) else outputChatBox("Please enter a username and password.") end end end ) Server: addEvent("submitLogin",true) function loginHandler(thePlayer,username,password) local account = getAccount ( username, password ) if account ~= false then logIn ( thePlayer, username, password ) spawnPlayer(thePlayer, 1959.55, -1714.46, 10) fadeCamera(thePlayer, true) setCameraTarget(thePlayer,thePlayer) outputChatBox("Welcome to My Server.", thePlayer) else outputChatBox("Invalid username and password. Please re-connect and try again.",thePlayer) end end addEventHandler("submitLogin",root,loginHandler) If it not work now, please wait for any more experienced help you.
-
CLIENT local myFiles = { ["Destruction Zones"] = "destruction.xml", ["Environment"] = "env.xml", ["Ferris Wheel"] = "ferris.xml", ["HeadQuarters"] = "hq.xml", ["Horseshoe Mission"] = "horseshoe.xml", ["Shops"] = "shops.xml", ["Skins"] = "skins.xml", ["UFO"] = "ufo.xml", ["Vehicles"] = "veh.xml", ["Weapons"] = "weap.xml", ["Weed Mission"] = "weed.xml", } helpWindow = guiCreateWindow(0.1768,0.2188,0.6475,0.6641,"Help Window",true) guiSetAlpha(helpWindow,1) guiWindowSetSizable(helpWindow,false) closeButton = guiCreateButton(0.3725,0.8922,0.2398,0.0784,"Close",true,helpWindow) guiSetFont(closeButton,"default-bold-small") helpEdit = guiCreateEdit(0.2247,0.1471,0.7225,0.7137,"",true,helpWindow) guiEditSetReadOnly( helpEdit, true ) helpGrid = guiCreateGridList(0.0136,0.1451,0.1961,0.7157,true,helpWindow) guiGridListSetSelectionMode(helpGrid,2) guiGridListAddColumn(helpGrid,"Freeroam",0.2) for name, file in pairs(myFiles) do local row = guiGridListAddRow(helpGrid) guiGridListSetItemText(helpGrid,row,1,tostring(name),false,false) end guiSetVisible(helpWindow,false) function seeWindow() guiSetVisible(helpWindow,not guiGetVisible(helpWindow)) showCursor(not isCursorShowing()) guiSetInputEnabled(not guiGetInputEnabled()) end bindKey('f9','down',seeWindow) addCommandHandler('help',root,seeWindow) addEventHandler("onClientGUIClick",root, function () if (source == helpGrid) then local row,col = guiGridListGetSelectedItem(source) if (row and col and row ~= -1 and col ~= -1) then local name = guiGridListGetItemText(source,row,1) if fileExists(myFiles[name]) then local file = xmlLoadFile(myFiles[name]) local node = xmlFindChild( file, "replaceWithYourNode", 0 ) local text = xmlNodeGetValue(node) guiSetText(helpEdit, tostring(text)) xmlUnloadFile(file) end end end end ) META.XML <meta> <info description="Help manager" author="MTA" type="script" version="1.0.0"/> <script src="newhelp.lua" type="server"/> <file src="destruction.xml" /> <file src="env.xml" /> <file src="ferris.xml" /> <file src="horseshoe.xml"/> <file src="hq.xml" /> <file src="shops.xml" /> <file src="skins.xml" /> <file src="ufo.xml" /> <file src="veh.xml" /> <file src="weap.xml" /> <file src="weed.xml" /> </meta>
-
Client: function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) -- define new X and Y positions for the first label X = 0.0825 Y = 0.2 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) -- make the window invisible guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () -- create the log in window and its components createLoginWindow() -- output a brief welcome message to the player outputChatBox("Welcome to My MTA:SA Server, please log in.") -- if the GUI was successfully created, then show the GUI to the player if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "down" then -- get the text entered in the 'username' field local user = guiGetText(edtUser) -- get the text entered in the 'password' field local pass = guiGetText(edtPass) -- if the username and password both exist if user and pass then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", localPlayer, user, pass) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) Server: -- define our custom event, and allow it to be triggered from the client ('true') addEvent("submitLogin",true) function loginHandler(player,username,password) local account = getAccount ( username, password ) if account ~= false then if logIn ( player, username, password ) == true then spawnPlayer(player, 1959.55, -1714.46, 10) fadeCamera(player, true) setCameraTarget(player,player) outputChatBox("Welcome to My Server.", player) end else -- if the username or password are not correct, output a message to the player outputChatBox("Invalid username and password. Please re-connect and try again.",player) end end -- add an event handler so that when submitLogin is triggered, the function loginHandler is called addEventHandler("submitLogin",root,loginHandler)
-
Client: function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) -- define new X and Y positions for the first label X = 0.0825 Y = 0.2 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) -- make the window invisible guiSetVisible(wdwLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () -- create the log in window and its components createLoginWindow() -- output a brief welcome message to the player outputChatBox("Welcome to My MTA:SA Server, please log in.") -- if the GUI was successfully created, then show the GUI to the player if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(edtUser) -- get the text entered in the 'password' field local password = guiGetText(edtPass) -- if the username and password both exist if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) Server: -- define our custom event, and allow it to be triggered from the client ('true') addEvent("submitLogin",true) function loginHandler(username,password) -- check that the username and password are correct if username == "user" and password == "apple" then -- the player has successfully logged in, so spawn them if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server.", client) end else -- if the username or password are not correct, output a message to the player outputChatBox("Invalid username and password. Please re-connect and try again.",client) end end -- add an event handler so that when submitLogin is triggered, the function loginHandler is called addEventHandler("submitLogin",root,loginHandler) Meta.xml:
-
I don't think the same.. When you not define the type, it will be server-side. Then, he don't specify the type, the type will be Server.