-
Posts
3,875 -
Joined
-
Days Won
67
Everything posted by DNL291
-
I don't understand where you want to create that text. Do you want to create a text in a row or what?
-
local year = getRealTime()["year"] + 1900 local month = getRealTime()["month"] + 1 local monthday = getRealTime()["monthday"] local hour = getRealTime()["hour"] local minute = getRealTime()["minute"] local second = getRealTime()["second"]
-
thePlayer at line 3 will return the player's previous account. Use source instead.
-
Você poderia abordar outras coisas além do comando sorte. como um item aleatório de uma tabela. Exemplo: local numeros = { "Um", "Dois", "Três", "Quatro", "Cinco", "Seis", "Sete", "Oito", "Nove", "Dez" } outputChatBox( numeros[math.random(1, #numeros)] ) No entanto, não sei se você ainda sabe lidar com tabelas. Apesar de ter faltado mais informações básicas sobre math.random (afinal o tutorial está abordando ela assim como givePlayerMoney), é um bom tutorial que poderá ajudar quem tem dúvidas com essas funções.
-
guiSetVisible(GUIEditor.window[1],false) Will make the window hidden. And table "GUIEditor" must be defined.
-
Na verdade não estamos aqui para desbugar códigos que vazaram do gamemode DayZ para você. Tente corrigir você mesmo, ninguém aprendeu Lua sem tentar fazer algo por si mesmo. Tenha em mente que se você quiser ter um servidor, terá que entender o básico de Lua para não precisar de ajuda com coisas simples. Espero que você tenha me entendido.
-
addEventHandler ( "onZombieWasted", root, function ( killer ) local kills = getElementData ( killer, "Zombie kills" ) if (kills >= 3 and kills <= 6) then givePlayerMoney(killer, 100) triggerClientEvent("mis1", getRootElement()) end end ) addEventHandler("onPlayerQuit", root, function() local kills = getElementData ( source, "Zombie kills" ) setAccountData( getPlayerAccount(source), "kills", kills ) end) addEventHandler("onPlayerLogin", root, function(_, account) local kills = getAccountData(account, "kills") if (kills >= 3 and kills <= 6) then triggerClientEvent("mis1", getRootElement()) end end) Must be: if (kills >= 3 and kills <= 6) then
-
Try this: function createTeamsOnStart() MainTeam = createTeam(":O Awesome Players!", 255, 50, 0) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function setTeam(_, account) local acc = getAccountName ( account ) if isObjectInACLGroup("user."..acc, aclGetGroup( "SuperModerator" )) or isObjectInACLGroup("user."..acc, aclGetGroup( "Admin" )) then if MainTeam then setPlayerTeam(source, MainTeam) end end end addEventHandler("onPlayerLogin", root, setTeam) function unassignTeam() local team = getPlayerTeam(source) if (team and MainTeam and team == MainTeam) then setPlayerTeam(source, nil) remove(source) end end addEventHandler("onPlayerLogout", root, unassignTeam) function remove(source) if MainTeam and (countPlayersInTeam(MainTeam) == 0) then destroyElement(MainTeam) end end
-
Try this: Client GUIEditor = { button = {}, window = {}, label = {} } local healmarker = createMarker( 2024.6821, -1411.6774, 16.9921, "cylinder", 2, 0, 255, 0) addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(537, 244, 298, 234, "buy Health", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(9, 154, 129, 70, "Buy Health\n($3.000)", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(159, 154, 129, 70, "Close", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.label[1] = guiCreateLabel(16, 25, 262, 115, "You can buy 200 health from here.\n\n200 HP costs $3.000", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 41, 255, 0) addEventHandler( "onClientGUIClick", GUIEditor.button[1], buyHealth, false ) addEventHandler( "onClientGUIClick", GUIEditor.button[2], closeWindow, false ) addEventHandler( "onClientMarkerHit", healmarker, onMarkerHit ) end ) function buyHealth() triggerServerEvent( "onHealth", localPlayer ) end function closeWindow() guiSetVisible( GUIEditor.window[1], false ) showCursor(false) end function onMarkerHit() guiSetVisible( GUIEditor.window[1], true ) showCursor(true) end Server addEvent ("onHealth", true) addEventHandler ("onHealth", getRootElement(), function() setPedStat(source, 24, 999) setElementHealth ( source, 200 ) end )
-
Isso está sendo definido apenas na função playerLogin, talvez esteja dando esse erro apenas quando o jogador se registra? Tente substituindo isto (na linha 351): destroyElement(getElementData(source, "playerCol")) Por isto: if getElementData(source, "playerCol") then destroyElement(getElementData(source, "playerCol")) end
-
Try this: function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end function assignNewTeam ( source, _, playername, teamname ) if not playername then outputChatBox("Please enter in the player's name that you would like to remove from team!",source,255,0,0) return end local player = getPlayerFromNamePart(playername) if not player then outputChatBox("Sorry, player doesn't exist!",source,255,0,0) return end local theTeam = getTeamFromName ( teamname ) if theTeam then setPlayerTeam ( source, theTeam ) end end addCommandHandler ( "invite", assignNewTeam ) function unassignTeam ( source, _, playername, teamname ) if not playername then outputChatBox("Please enter in the player's name that you would like to remove from team!",source,255,0,0) return end local player = getPlayerFromNamePart(playername) if not player then outputChatBox("Sorry, player doesn't exist!",source,255,0,0) return end local theTeam = getPlayerTeam ( player ) if not theTeam then outputChatBox("Player isn't on a team!",source,255,0,0) return end setPlayerTeam ( player, nil ) end addCommandHandler ( "dismiss", unassignTeam )
-
getElementData(source, "playerCol") está retornando false porque certamente não foi definido esse dado para o jogador.
-
Try removing: (getElementType(hitElement) == "vehicle")
-
playSound("som.mp3") Basta colocar isso no código.
-
Client: addEventHandler "onClientGUIClick" guiGridListGetSelectedItem guiGridListGetItemText triggerServerEvent server: addEvent addEventHandler createVehicle warpPedIntoVehicle takePlayerMoney
-
function createGui () gui = guiCreateWindow( 300, 100, 265, 500, "Bike Rent Shop", false) guiSetInputEnabled ( false ) guiSetVisible(gui, false) guiWindowSetMovable( gui, false ) guiWindowSetSizable( gui, false ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, false, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn1 = guiCreateButton( 149, 430, 99, 45, "Leave", false, gui ) guiSetFont( btn1, "default-bold-small" ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, true, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn2 = guiCreateButton(18,430,99,45,"Rent 50$",false, gui) guiSetProperty( btn1, "HoverTextColour", "FFFF0000" ) guiSetProperty( btn2, "HoverTextColour", "FFFFFF00" ) row = guiGridListAddRow (List) guiGridListSetItemText ( List, row, column, "Mountain Bike", false, false ) row2 = guiGridListAddRow (List) guiGridListSetItemText (List, row2, column, "BMX", false, false ) row3 = guiGridListAddRow (List) guiGridListSetItemText (List, row3, column, "Bike", false, false ) addEventHandler("onClientGUIClick", btn1, close, false) addEventHandler("onClientGUIClick", btn2, rent, false) end addEventHandler("onClientResourceStart", resourceRoot, createGui) function rent (button,state) if button == "left" and state == "up" then takeCash ( amount ) takePlayerMoney ( 100 ) end end local marker = createMarker (1220, -1415.5,12, "cylinder", 1.5, 0, 0, 225, 225) addEventHandler("onClientMarkerHit", marker, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then guiSetVisible( gui, true) showCursor( true) outputChatBox( "Bike shop : Welcome to the Rent Shop", 255, 255, 5) end end ) function close(button,state) if button == "left" and state == "up" then guiSetVisible ( lol, false) guiSetInputEnabled(false) guiSetVisible(gui, false) showCursor(false) end end
-
Try this: function gui () gui = guiCreateWindow( 300, 100, 265, 500, "Bike Rent Shop", false) guiSetInputEnabled ( false ) guiSetVisible(gui, false) guiWindowSetMovable( gui, false ) guiWindowSetSizable( gui, false ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, false, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn1 = guiCreateButton( 149, 430, 99, 45, "Leave", false, gui ) guiSetFont( btn1, "default-bold-small" ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, true, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn2 = guiCreateButton(18,430,99,45,"Rent 50$",false, gui) guiSetProperty( btn1, "HoverTextColour", "FFFF0000" ) guiSetProperty( btn2, "HoverTextColour", "FFFFFF00" ) row = guiGridListAddRow (List) guiGridListSetItemText ( List, row, column, "Mountain Bike", false, false ) row2 = guiGridListAddRow (List) guiGridListSetItemText (List, row2, column, "BMX", false, false ) row3 = guiGridListAddRow (List) guiGridListSetItemText (List, row3, column, "Bike", false, false ) addEventHandler("onClientGUIClick", btn1, close, false) addEventHandler("onClientGUIClick", btn2, rent, false) end function rent (button,state) if button == "left" and state == "up" then takeCash ( thePlayer, amount ) takePlayerMoney ( thePlayer, 100 ) end end local marker = createMarker (1220, -1415.5,12, "cylinder", 1.5, 0, 0, 225, 225) addEventHandler("onClientMarkerHit", marker, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then guiSetVisible( gui, true) showCursor( true) outputChatBox( "Bike shop : Welcome to the Rent Shop", 255, 255, 5) end end ) function close(button,state) if button == "left" and state == "up" then guiSetVisible ( lol, false) guiSetInputEnabled(false) guiSetVisible(gui, false) showCursor(false) end end
-
Open fr_server.lua and replace this (at line 399): addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() local r, g, b = getPlayerNametagColor(source) outputChatBox(getPlayerName(source) .. '#FFFFFF: #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) end end ) For this: Insults = { -- Note: USE lowercase LETTERS -- Format: { "Insult Word", "Replace Word" }, { "bitch", "cow" }, } function chatL ( msg, msgType ) if (not msgType == 0) then return end for k,v in ipairs (Insults) do if string.find( string.lower ( msg ),v[1]) then msg = msg:gsub ( msg, v[2] ) end end cancelEvent ( ) outputChatBox(getPlayerName ( source )..": #ffffff"..msg,root,0,255,0,true) end addEventHandler( "onPlayerChat", getRootElement(), chatL )
-
https://wiki.multitheftauto.com/wiki/Cl ... ponent_IDs engineLoadTXD engineImportTXD engineLoadDFF engineReplaceModel
-
Use getPlayerName em uma condição e verifique se é o nick determinado. Se você quiser obter a distância entre o jogador e o colshape, use getElementPosition + getDistanceBetweenPoints2D Esse código é server-side por causa do evento onResourceStart.
-
It must be only for normal message. Insults = { -- Note: USE lowercase LETTERS -- Format: { "Insult Word", "Replace Word" }, { "bitch", "cow" }, } function chatL ( msg, msgType ) if (not msgType == 0) then return end for k,v in ipairs (Insults) do if string.find( string.lower ( msg ),v[1]) then msg = msg:gsub ( msg, v[2] ) end end cancelEvent ( ) outputChatBox(getPlayerName ( source )..": #ffffff"..msg,root,0,255,0,true) end addEventHandler( "onPlayerChat", getRootElement(), chatL )
-
Tem como deixar o relógio mostrando a hora real?
DNL291 replied to Blouc's topic in Programação em Lua
Leia: https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/PT- ... _Scripting Coloque o código num arquivo de texto cuja extensão seja .lua. Depois crie o arquivo meta.xml: https://wiki.multitheftauto.com/wiki/Meta.xml -
addEventHandler( "onClientResourceStart", resourceRoot, function() LabelChaz = guiCreateLabel(0.22, 0.33, 0.59, 0.08, "Haz Modificado Tu Vehiculo!", true) guiSetFont(LabelChaz, "sa-gothic") guiLabelSetColor(LabelChaz, 11, 11, 160) guiSetVisible(LabelChaz, false) end ) function ChazShowLabel (hitElement) if (getElementType(hitElement) == "player") and (guiGetVisible(LabelChaz) == false) then guiSetVisible(LabelChaz, true) setTimer(guiSetVisible, 2000, 1, LabelChaz, false) end end addEventHandler("onClientMarkerHit", marker, ChazShowLabel) Try it.