-
Posts
3,875 -
Joined
-
Days Won
67
Everything posted by DNL291
-
Is missing 'end' to close the if statement.
-
https://forum.multitheftauto.com/viewtopic.php?f=152&t=52482 https://forum.multitheftauto.com/viewtopic.php?f=148&t=40809 Para aprender sobre Lua scripting: Português-BR: https://wiki.multitheftauto.com/wiki/PT- ... _Scripting https://wiki.multitheftauto.com/wiki/PT- ... _scripting https://wiki.multitheftauto.com/wiki/PT-BR/Meta.xml Página inicial MTA Wiki (inglês): https://wiki.multitheftauto.com/wiki/Main_Page
-
Try this: 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) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, 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 Server: 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 addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) Make sure meta.xml is correct.
-
No, spawnPlayer is serverside only. And submitLogin is attached to loginHandler function.
-
Using the same function, but replacing a different ID. No, Replacing Clothes mods with Shader https://wiki.multitheftauto.com/wiki/Cl ... ponent_IDs
-
loginHandler function and submitLogin custom event should be serverside.
-
Try this: -- Gui sizes = 266, 450 function closePanel() local wX, wY = guiGetSize ( window, false ) local y = wY - 15 if (y > 0) then guiSetSize( window, wX, y, false ) else guiSetSize( window, wX, 0, false) guiSetVisible ( window, false) removeEventHandler ( "onClientPreRender", root, closePanel ) end end function openPanelPrepair() addEventHandler( "onClientPreRender", root, openPanel ) end
-
Use dxDrawText with onClientRender instead of guiCreateLabel.
-
Skin mod: https://community.multitheftauto.com/ind ... ls&id=8401 DONE
-
Você pode usar triggerClientEvent, e acionar a função para todos os jogadores usando o primeiro argumento da função.
-
playSound3D é tocado apenas para o jogador local.
-
The code still has many errors.
-
+ onClientChatMessage addCommandHandler unbindKey getChatboxLayout
-
engineRestoreModel should do it, there's no another function that do it (as far as I know).
-
That's because you're creating the marker locally. Just remove 'local' from mission1Marker variable or store the marker in a table.
-
function mission1 () local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) addEventHandler ("onMarkerHit", mission1Marker, onHit) end addEvent ("missionStarts", true) addEventHandler ("missionStarts", getRootElement(), mission1) function onHit (hitElement) if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then triggerClientEvent ("ShowWinWindow", hitElement) end end function onLeave () local money = math.random(2000, 2500) givePlayerMoney (source, money) outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) end addEvent ("GetRewards", true) addEventHandler ("GetRewards", getRootElement(), onLeave)
-
It's wrong. Should be: if (guiGetVisible(window) == true) then
-
Car mods: https://community.multitheftauto.com/ind ... ls&id=8361 https://community.multitheftauto.com/ind ... ls&id=8357 DONE
-
for i=1, #DoorPositions do outputChatBox(DoorPositions[i][1], DoorPositions[i][2], DoorPositions[i][3]) end -- OR for _,v in ipairs(DoorPositions) do outputChatBox(v[1], v[2], v[3]) end
-
showPlayerHudComponent() addEventHandler() "onClientRender" isPlayerHudComponentVisible("area_name") -- Min version: 1.3.1-9.04689 getElementPosition() getPedOccupiedVehicle() getZoneName() dxDrawText() removeEventHandler()
-
A alternativa mais fácil é usar: setTimer isPedDucked Tem também uma outra forma que é usar o evento onClientKey, verificar se o botão é a letra c e usar a função isPedDucked. Mas ainda assim terá alguns erros.
-
Skin mods: https://community.multitheftauto.com/ind ... ls&id=8315 https://community.multitheftauto.com/ind ... ls&id=8314 DONE