Jump to content

n3wage

Members
  • Posts

    290
  • Joined

Everything posted by n3wage

  1. Tente isso: -- fr_client.lua - Linha 60 (pode ser diferente ai) ssTime = false function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then if not ssTime or ssTime < getTickCount() then ssTime = getTickCount() + ( 20 *1000 ) -- 20 = 20 segundos server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) else outputChatBox ( "Aguarde "..math.floor ( ( ssTime - getTickCount() ) /1000 ).. " Segundos antes de trocar a skin novamente !", 255, 0, 0, true ) end end end addCommandHandler('setskin', setSkinCommand) addCommandHandler('ss', setSkinCommand)
  2. n3wage

    [HELP] Script

    isObjectInACLGroup See examples.
  3. hmm, i remade the script, try: ID = {} exports["scoreboard"]:scoreboardAddColumn ( "ID", root, 20, "ID", 1 ) --------------------------- [ Events ] --------------------------- addEventHandler ( "onPlayerJoin", root, function( ) for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = source setElementData ( source, "ID", i ) break; end end end) -- addEventHandler ( "onPlayerQuit", root, function( ) ID[getPlayerID(source)] = nil end) -- addEventHandler ( "onResourceStart", resourceRoot, function( ) for _,v in ipairs(getElementsByType("player")) do for i = 0, getMaxPlayers() do if not ID[i] then ID[i] = v setElementData ( v, "ID", i ) break; end end end end) --------------------------- [ Functions ] --------------------------- function getPlayerID (player) if player and isElement(player) and getElementType(player) == "player" and getElementData ( player, "ID" ) then return getElementData ( player, "ID" ) end return false end -- function getPlayerFromID (id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end
  4. Replace showIDs function with this one: function showIDs (option) if option == false then gameShowIDs = false exports["scoreboard"]:scoreboardRemoveColumn ( "id", root ) else gameShowIDs = true exports["scoreboard"]:scoreboardAddColumn ( "id", root, 50, "ID", 1 ) end end addEventHandler("onResourceStart", resourceRoot, showIDs)
  5. This: addEventHandler("onClientGUIClick", GUIEditor.button[1], teleportPlayer, false) addEventHandler("onClientGUIClick", GUIEditor.button[2], openLSTeleportGUI, false) Should be inside the createLSTeleportGUI function. function createLSTeleportGUI() GUIEditor.window[1] = guiCreateWindow(834, 424, 254, 111, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(29, 21, 192, 24, "Teleport to LS?", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) GUIEditor.button[1] = guiCreateButton(18, 57, 104, 33, "Yes", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(134, 57, 104, 33, "No", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") guiSetVisible(GUIEditor.window[1],false) addEventHandler("onClientGUIClick", GUIEditor.button[1], teleportPlayer, false) addEventHandler("onClientGUIClick", GUIEditor.button[2], openLSTeleportGUI, false) end
  6. For damage below 50%, use: getElementHealth For limit by minutes this should work: repairTick = false function repairVehicle() local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then if not repairTick or repairTick < getTickCount ( ) then server.fixVehicle(vehicle) repairTick = getTickCount() + 60000 else outputChatBox ( "Wait "..math.floor( ( repairTick - getTickCount() ) /1000 ) .." Seconds before repairing again !" ) end end end
  7. Faz alguma coisa Assim, Deve funcionar: Server: function iniciar__ ( ) triggerClientEvent ( root, "dominar_start", root ) outputChatBox ( "iniciando..." ) end addCommandHandler ( "dominar", iniciar__ ) Client: seg = 0 function dominar_start ( ) timer_ = setTimer ( function() seg = seg +1 end, 1000, 0 ) addEventHandler ( "onClientRender", root, dominar_render ) end addEvent ( "dominar_start", true ) addEventHandler ( "dominar_start", root, dominar_start ) function dominar_render () if seg >= 250 then removeEventHandler ( "onClientRender", root, dominar_render ) dominar_end() if isTimer ( timer_ ) then killTimer ( timer_ ) end end dxDrawRectangle(55, 478, seg, 20, tocolor(255, 100, 0, 255), false) dxDrawLine(54, 478, 304, 478, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(304, 478, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 498, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 478, 54, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawText("atacando territorio!", 53, 478, 304, 498, tocolor(255, 255, 255, 255), 0.65, "bankgothic", "center", "center", false, false, false, false, false) end function dominar_end ( ) outputChatBox ( "area dominada !!" ) --[[ aqui vc pode usar triggerServerEvent pra terminar de dominar; --]] seg = 0 end
  8. Qual o problema em criar o timer do lado do cliente ?
  9. addEventHandler("onPlayerLogin",root, function () textDisplayRemoveObserver(dis,source) textDisplayRemoveObserver(dis1,source) textDisplayRemoveObserver(dis2,source) setCameraTarget ( source, source ) spawnPlayer ( source, 0, 0, 3 ) end )
  10. Para seu primeiro problema use: setTimer -- Um loop (se for pra mostrar o dinheiro de todo mundo) getPlayerMoney guiSetText Para o segundo: isObjectInACLGroup -- Assim deve funcionar: addEventHandler( "onZombieGetsKilled", getRootElement(), function( killer ) if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( killer ) ), aclGetGroup ( "VIPs" ) ) then givePlayerMoney( killer, 10 ); -- Dar $10 Para vips else givePlayerMoney ( killer, 5 ) -- Apenas $5 para players normais. end end )
  11. Sim, entendi errado oque ele queria, Se quiser corrigir: for _,v in ipairs ( getPlayersInTeam(playerTeam) ) do if v ~= thePlayer then outputChatBox("#009AFF[AVISO]#00FF9BO jogador #009AFF"..getPlayerName(thePlayer).." #00FF9BOabandonou a gang!",v, 255, 255, 255, true) end end
  12. Confuso Seu código, Vou tentar ajudar .-. Veja bem os parâmetros da função getElementData: var getElementData ( element theElement, string key [, inherit = true] ) -- Como vc estava usando: getElementData( thePlayer, "Level", Lider) -- Solução: -- usar == para verificar igualdade; elseif mode == "deletar" then playerTeam = getPlayerTeam( thePlayer ) if ( playerTeam ) then local teamMate = getPlayersInTeam(playerTeam) for i, v in ipairs(teamMate) do local getLider = getElementData( thePlayer, "Level", Lider) --[[ /\ aqui vc usa getElementData de uma maneira errada, O correto seria: getElementData ( thePlayer, "Level" ) == "Lider" --]] if getLider then outputChatBox("#009AFF[AVISO]#00FF9BVocê deletou a gang!",thePlayer, 255, 255, 255, true) setElementData(thePlayer, "Level", "") if ( v ~= thePlayer ) then setElementData(v, "Level", "") outputChatBox("#009AFF[AVISO]#00FF9BO jogador #009AFF"..getPlayerName(thePlayer).."#00FF9B deletou a gang!",v, 255, 255, 255, true) end destroyElement(playerTeam) end end else outputChatBox("#009AFF[AVISO]#00FF9BVocê não possui uma gang!",thePlayer, 255, 255, 255, true) end Correto: elseif mode == "deletar" then playerTeam = getPlayerTeam( thePlayer ) if ( playerTeam ) then if getElementData ( thePlayer, "Level" ) ~= "Lider" then -- ~= significa diferente outputChatBox ( "vc n e lider da gang", thePlayer ) return -- para o codigo end outputChatBox("#009AFF[AVISO]#00FF9BVocê deletou a gang!",thePlayer, 255, 255, 255, true) local teamMate = getPlayersInTeam(playerTeam) setElementData(thePlayer, "Level", "") for i, v in ipairs(teamMate) do if ( v ~= thePlayer ) then setElementData(v, "Level", "") outputChatBox("#009AFF[AVISO]#00FF9BO jogador #009AFF"..getPlayerName(thePlayer).."#00FF9B deletou a gang!",v, 255, 255, 255, true) end destroyElement(playerTeam) end else outputChatBox("#009AFF[AVISO]#00FF9BVocê não possui uma gang!",thePlayer, 255, 255, 255, true) end No /gang abandonar só faltou arrumar o getElementData, desfazer o loop (desnecessario) e usar um return: elseif mode == "abandonar" then playerTeam = getPlayerTeam(thePlayer) if ( playerTeam ) then local liderTeam = getElementData(thePlayer, "Level", Lider ) if getElementData ( thePlayer, "Level" ) == "Lider" then outputChatBox("#009AFF[AVISO]#00FF9BO lider não pode abandonar a gang!",thePlayer, 255, 255, 255, true) return else setPlayerTeam(thePlayer, nil) setElementData(thePlayer, "Level", "") outputChatBox("#009AFF[AVISO]#00FF9BVocê abandonou a gang!",thePlayer, 255, 255, 255, true) outputChatBox("#009AFF[AVISO]#00FF9BO jogador #009AFF"..getPlayerName(thePlayer).." #00FF9BOabandonou a gang!",root, 255, 255, 255, true) end else outputChatBox("#009AFF[AVISO]#00FF9BVocê não possui uma gang!",thePlayer, 255, 255, 255, true) end end Fora isso recomendo vc usar tabelas em vez de set/getElementData, veja: https://forum.multitheftauto.com/viewtopic.php?f=148&t=77161
  13. n3wage

    Ammo list

    Use: getPedAmmoInClip getPedTotalAmmo dxDrawText Event: onClientRender
  14. n3wage

    Key binding

    create a function like that: function toggleGuixd () if YOURGUIVARIABLE and guiGetVisible ( YOURGUIVARIABLE ) then guiSetVisible ( YOURGUIVARIABLE, false ) showCursor ( false ) else lazpuer() -- performs the function that creates the gui showCursor ( true ) end end bindKey( "l", "down", toggleGuixd ) -- Or: function toggleGuixd2 () guiSetVisible ( YOURGUIVARIABLE, not guiGetVisible ( YOURGUIVARIABLE ) ) showCursor ( not isCursorShowing() ) end bindKey( "l", "down", toggleGuixd2 ) Change YOURGUIVARIABLE and lazpuer() (if necessary)
  15. funções dx precisam de um evento render para funcionarem; dxDrawRectangle ( x/18, y/3, x/3.5, y/3, tocolor ( 0, 0, 0, 180 ) ) dxDrawText ( "BEM VIDO A GALOCURA", x/6.5, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 0.8, "default-bold" ) -- Aqui você esta chamando a função no nada, sem eventos .. (n vai funcionar ) --[...] if not pickupInfoHandler then pickupInfoHandler = true addEventHandler("onClientRender", root, drawStuff) -- /\ aqui você adiciona o evento onClientRender a funcao drawStuff ( q n existe ) --[...] Tente assim : infoz = createPickup(2796.53076, -1549.46838, 10.92188,3,1239) -- imaginei q a variavel fosse 'infoz' (tava errada) local x,y = guiGetScreenSize() local Text = "Bem vindo a galocura" addEventHandler("onClientPickupHit", infoz, function (player,matchingDimension) if player == localPlayer and matchingDimension then lastInfoPickupHit = getTickCount()+5000 if not pickupInfoHandler then pickupInfoHandler = true addEventHandler("onClientRender", root, drawStuff) end end end) function drawStuff ( ) -- funcao drawStuff ( para parar ela use removeEventHandler ) dxDrawRectangle ( x/18, y/3, x/3.5, y/3, tocolor ( 0, 0, 0, 180 ) ) dxDrawText ( Text, x/6.5, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 0.8, "default-bold" ) end
  16. Isso é porque as coisas feitas do lado client só serão vistas pelo client (o jogador que digitou o comando, no caso), Use esse codigo: ServerSide: FazendoAnim = {} -- criamos a tabela 'FazendoAnim' addCommandHandler( "dançar", function(thePlayer) if FazendoAnim[thePlayer] then -- se o jogador estiver na tabela 'FazendoAnim' parar a animacao. setPedAnimation( thePlayer, false ) FazendoAnim[thePlayer] = nil -- retiramos o jogador da tabela else setPedAnimation( thePlayer, "dancing", "dance_loop", -1, true, false ) FazendoAnim[thePlayer] = true -- colocamos o jogador na tabela end end)
  17. try using the onClientPreRender event.
  18. this? https://community.multitheftauto.com/index.php?p=resources&s=details&id=7349
  19. Use this function: function string.split ( str, count ) if count > string.len(str) then return false end local Linhas = {} local LC = 1 while LC < string.len ( str ) do local linha = string.sub ( str, LC, LC + count -1 ):gsub(" ","") table.insert ( Linhas, linha ) LC = LC + count end return Linhas end Example: myString = "1234567891011121314151617181920abcdefghi" -- 40 Characters allLines = string.split ( myString, 20 ) for _, line in ipairs ( allLines ) do print ( line, line:len() ) end --[[ print: 12345678910111213141 20 51617181920abcdefghi 20 --]]
  20. try addCommandHandler ( "suicide", function(player) setElementFrozen( player, true ) setTimer( function(p) killPed ( p ) setElementFrozen ( p, false ) end, 5000, 1, player ) outputChatBox( "You will die in 5 seconds!!", player, 255, 255, 255, false ) end )
  21. Try (untested): Tick_ = {} function VipAbrir ( thePlayer ) if not Tick_[thePlayer] or Tick_[thePlayer] < getTickCount() then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then triggerClientEvent ( thePlayer, "GUIVIP", thePlayer) Tick_[thePlayer] = getTickCount() + ( 40 * 60000 ) else outputChatBox ( "You are not a VIP member",thePlayer) end else outputChatBox ( "Wait ".. math.floor ( ( Tick_[thePlayer] - getTickCount() ) / 60000 ) .." Minutes until open the panel Again !", thePlayer ) end end addCommandHandler ( "vip", VipAbrir )
  22. Recomendo você ler a Introdução ao Scripting (Em português, https://wiki.multitheftauto.com/index.ph ... _Scripting), Vou te dar uma base, Olhe bem os comentarios. Script 1: function tele ( thePlayer ) -- cria a funcao com o nome 'tele', como temos um comando o primeiro argumento da funcao sera o jogador ( thePlayer ) if isPedInVehicle ( thePlayer ) then -- se o jogador estiver em um veiculo local veh = getPedOccupiedVehicle ( thePlayer ) -- veh = variavel do veiculo | getPedOccupiedVehicle = retorna o veiculo do player; setElementPosition ( veh, 0, 0, 3 ) -- muda a posicao do veiculo para as coordenadas 0 0 3 outputChatBox ( "Voce foi Teleportado com um carro !", thePlayer ) -- Mensagem no chat, Visivel apenas para o jogador que digitou. else -- caso nao estiver em um veiculo setElementPosition ( thePlayer, 0, 0, 3 ) -- muda a posicao do player. outputChatBox ( "Voce foi Teleportado sem um carro !", thePlayer ) -- Mensagem no chat, Visivel apenas para o jogador que digitou. end -- termina o > if isPedInVehicle ( thePlayer ) then < end -- termina a funcao addCommandHandler ( "meutele", tele, false, false ) -- adiciona o comando "meutele" Script 2: function bloquearVeiculo ( thePlayer ) -- cria a funcao bloquearVeiculo, evento onVehicleEnter tem o parametro player. if getVehicleName ( source ):lower() == "infernus" then -- se NOMEDOVEICULO:letrasminuculas() == (igual a) "infernus" fazer | getVehicleName = Retorna o nome do veiculo | source = PARA O EVENTO ONVEHICLEENTER source é o veiculo, isso varia de evento a evento. if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then -- se o jogador estiver na ACL Admin... outputChatBox ( "bem vindo ao seu veiculo, admin !", thePlayer ) -- mensagem no chat... else -- se nao estiver na acl... outputChatBox ( "Voce nao pode usar esse veiculo !", thePlayer, 255, 0, 0 ) -- mensagem de erro ( 255, 0, 0 = cor vermelha ) removePedFromVehicle ( thePlayer ) -- tira o jogador do carro end -- finaliza o isObjectInACLGroup... end -- finaliza o if getVehicleName... end -- finaliza a funcao bloquearVeiculo addEventHandler ( "onVehicleEnter", root, bloquearVeiculo ) -- adiciona o evento onVehicleEnter ( que é acionado quando um player entra em um veiculo ) a funcao bloquerVeiculo Script 3: Vou usar o mesmo script do seu primeiro pedido como exemplo; function teleACL ( thePlayer ) -- cria a funcao com o nome 'teleACL', como temos um comando o primeiro argumento da funcao sera o jogador ( thePlayer ) if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then -- se o jogador estiver na ACL Admin... if isPedInVehicle ( thePlayer ) then -- se o jogador estiver em um veiculo local veh = getPedOccupiedVehicle ( thePlayer ) -- veh = variavel do veiculo | getPedOccupiedVehicle = retorna o veiculo do player; setElementPosition ( veh, 0, 0, 3 ) -- muda a posicao do veiculo para as coordenadas 0 0 3 outputChatBox ( "Voce foi Teleportado com um carro !", thePlayer ) -- Mensagem no chat, Visivel apenas para o jogador que digitou. else -- caso nao estiver em um veiculo setElementPosition ( thePlayer, 0, 0, 3 ) -- muda a posicao do player. outputChatBox ( "Voce foi Teleportado sem um carro !", thePlayer ) -- Mensagem no chat, Visivel apenas para o jogador que digitou. end -- termina o if isPedInVehicle ( thePlayer ) then < else -- se nao estiver na acl... outputChatBox ( "Voce nao pode usar esse comando ;(", thePlayer, 255, 0, 0 ) end -- termina o isObjectInACLGroup end -- termina a funcao addCommandHandler ( "meutele2", teleACL, false, false ) -- adiciona o comando "meutele2" Quando quiser fazer scripts e não souber as funções necessárias pesquise na wiki: Funções Server-Side: https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions Funções Client-Side: https://wiki.multitheftauto.com/wiki/Client_Scripting_Functions
×
×
  • Create New...