Jump to content

MrDante

Members
  • Posts

    176
  • Joined

  • Last visited

Everything posted by MrDante

  1. Stop Sound has to be the music of the variable, not the playsound if isMouseInPosition ( botX+sizeX+420, botX2+sizeX2+100, 150, 150 ) then playSound(click) setTimer ( function() stopSound(click) end, 50, 1 ) dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat2.png", 0, 0, 0, tocolor ( 255, 255, 255) ) else dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) end
  2. no need to create a function for this, use the isCursorOnElement if in the very function dx if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) else -- you can opt for it if you want to test stopSound(click) OBS: I have not tested, if not right tell me
  3. Já resolvi aqui, mas muito obrigado
  4. nick_de_quem_limpou vai ser o nick do jogador que limpou o chat, Porem essa variavel só existe na função abrirchat (porque passamos ela via triggerClientEvent) então definimos a variavel global name como sendo igual a variavel nick_de_quem_limpou, Assim teremos o nick fora da função abrirchat, e ai podemos usar ele no dxDrawText. function dxchat() dxDrawRectangle(168, 203, 600, 62, tocolor(0, 0, 0, 109), false) dxDrawBorderedText(""..name.." Limpou o Chat", posone, 215, 197, 383, tocolor(255, 255, 255, textAlpha),1.00, font) end function abrirchat(nick_de_quem_limpou) name = nick_de_quem_limpou; addEventHandler ("onClientRender", root, dxchat) setTimer(function() removeEventHandler ("onClientRender", root, dxchat) end, 4000, 1 ) end addEvent ("limparchat", true) addEventHandler ("limparchat", root, abrirchat) Agr vem outro problema, eu coloquei no name uma string pra retirar os hexadecimal do nome, mas agr aparece o hexadecimal
  5. Interessante, ajudou muito , mas assim, eu não entendi direito esse name = nick_de_quem_limpou;, ele serve para que? eu usei isso e deu erro global
  6. Galera, estou com um problema, é o seguinte, eu quero que quando o player digita tal comando, apareça em dx o nome dele e o o que ele fez, só que, tem um problema, se o player digitar tal comando, na tela de outros jogadores aparece o nome do jogador Exemplo, eu executei o comando, na minha tela: MrDante limpou o chat na tela de outros players, vamos chamar o player de JogadorOne: JogadorOne limpou o chat o problema é, só existe localPlayer, nem com loop funciona, pois aparece o nome de todos os jogadores.. alguem sabe alguma forma de aparecer so de quem executar este comando? Client textAlpha = 255 posone = 700 font = "bankgothic" name = getPlayerName( localPlayer ):gsub('#%x%x%x%x%x%x', '') function dxchat() dxDrawRectangle(168, 203, 600, 62, tocolor(0, 0, 0, 109), false) dxDrawBorderedText(""..name.." Limpou o Chat", posone, 215, 197, 383, tocolor(255, 255, 255, textAlpha),1.00, font) end function abrirchat() addEventHandler ("onClientRender", root, dxchat) setTimer(function() removeEventHandler ("onClientRender", root, dxchat) end, 4000, 1 ) end addEvent ("limparchat", true) addEventHandler ("limparchat", root, abrirchat) Server function clearChat(player, cmd) local accountname = getAccountName(getPlayerAccount(player)) if ( hasObjectPermissionTo ( player, "command.mute", true ) ) then triggerClientEvent(root, "limparchat", root) outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") outputChatBox(" ") end end addCommandHandler("chat", clearChat)
  7. Então, eu consegui, e acho que foi um erro meu não sei ou não salvei na hora de testa-lo o jeito que o n3wage ajudou , mas dessa forma eu consegui kkkkk, obrigado e desculpa pela minha "lerdeza"
  8. isso mesmo que eu fiz, nao mudou em nada
  9. Galera é o seguinte, estou querendo que o dx fique piscando, diminuindo o alpha e aumentando , porem não estou conseguindo , qual é o problema? fadeIn = false textAlpha = 255 font = "bankgothic" function dxchat() dxDrawBorderedText(""..getPlayerName(localPlayer).." Está assaltando a loja", 197, 215, 197, 383, tocolor(255, 255, 255, textAlpha),1.00, font) dxDrawRectangle(168, 203, 468, 62, tocolor(0, 0, 0, 109), false) end function abrirchat() addEventHandler ("onClientRender", root, dxchat) if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkAlpha() setTimer(function() removeEventHandler ("onClientRender", root, dxchat) end, 20000, 1 ) end addEvent ("limparchat", true) addEventHandler ("limparchat", root, abrirchat) function checkAlpha() if textAlpha < 130 then fadeIn = true elseif textAlpha >= 247 and textAlpha <= 255 and fadeIn == true then fadeIn = false end end function dxDrawBorderedText(text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(text, x - 2, y - 2, w - 2, h - 2, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x + 2, y - 2, w + 2, h - 2, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x - 2, y + 2, w - 2, h + 2, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x + 2, y + 2, w + 2, h + 2, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x - 1, y, w - 1, h, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x + 1, y, w + 1, h, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x, y - 1, w, h - 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x, y + 1, w, h + 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false) dxDrawText(text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end
  10. eu já falei pra vc q da pra fazer o setPedAnimation no lado do server. Ja consegui brother
  11. Eu preciso que ele execute a animação e trave em uma tal parte da animação,por isso o render, tens como fazer isso no server?
  12. Galera, estou com um problema, eu quero que uma animação do lado client passe pro lado server, usei triggerClientEvent mas deu certo Client function onClientRender() for k, v in ipairs(getElementsByType("player")) do if getElementData(v,"algemado") then local block, animation = getPedAnimation(v) if animation ~= "gift_give" then setPedAnimation(v, "kissing", "gift_give", 200, true, false, false, true) end setPedAnimationProgress(v, 'gift_give', 0.15) end end end addEventHandler("onClientRender",root,onClientRender) Server function algemar_jogador (thePlayer, _, nick) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then local player_a_ser_algemado = getPlayerFromPartialName ( nick ) local nick_do_jogador = getPlayerName ( player_a_ser_algemado ) local policial = getPlayerName(thePlayer) local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial local algemadox, algemadoy, algemadoz = getElementPosition ( player_a_ser_algemado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, algemadox, algemadoy, algemadoz ) if ( dist > 5 ) then outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!", thePlayer, 255, 255, 255, true) -- Chat Box elseif ( dist < 4 )then setElementData(player_a_ser_algemado,"algemado", nick_do_jogador) setElementFrozen ( player_a_ser_algemado, true ) toggleControl(player_a_ser_algemado, "fire", false ) outputChatBox ( "#000000|#FF0000POLICIAL#000000| #A09E9ESuspeito #FFFFFF"..nick_do_jogador.."#A09E9E Foi Algemado Pelo |#FF0000POLICIAL#000000|"..policial..".", root, 255, 255, 255, true) outputChatBox ( "#000000|#FF0000POLICIAL#000000| #A09E9EVoce Foi Algemado pelo |#FF0000POLICIAL#000000|"..policial..".", player_a_ser_algemado, 255, 255, 255, true) end else outputChatBox("#000000|#FF0000POLICIA#000000| Você não tem permissão para usar este comando!", thePlayer, 255, 255, 255, true) end end end end addCommandHandler ( "algemar", algemar_jogador)
  13. one day I do something more complex'm still medium in the script,
  14. Thank you, but I managed to do in a way, nothing complex OBS: I had no need to use the server, but only to define the data element Client: function onPedRender() local ped = getElementsByType ( "ped" ) for theKey, thePed in ipairs(ped) do if getElementData(thePed, "shoot") then cancelEvent() local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setPedControlState(thePed, "right", false) setPedControlState(thePed, "fire", true) setPedAimTarget(thePed, sx, sy, sz) addEventHandler("onClientRender", root, onPedRender) end end end addEventHandler("onClientPedDamage", root, onPedRender) Server local vendedor1 = createPed ( 67, 290.14352416992, -111.51473999023, 1001.515625, 354.35003662109,true ) local vendedor2 = createPed ( 28, 291.11795043945, -104.48545837402, 1001.515625, 181.09841918945,true) setElementData(vendedor1, "shoot", true) setElementData(vendedor2, "shoot", true) Thank you for the patience
  15. My God !, I went in his direction and tried man, I'm sorry if I have difficulty ok, I did without my old functions, and now has an Error? Client function peddamage() end addEvent("fire", true) addEventHandler("fire", root, peddamage) addEventHandler("onClientRender", root, peddamage) Server function atiranoped() for index, player in ipairs(getElementsByType("ped")) do triggerClientEvent(source,"fire", root) end end
  16. Client function onClientRender() local ped = getElementsByType ( "ped" ) for theKey, thePed in ipairs(ped) do if (isElement(thePed)) then local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setPedControlState(thePed, "right", false) setPedControlState(thePed, "fire", true) setTimer(function() setPedControlState(thePed, "right", true) end, 3000, 1) setTimer(function() setPedControlState(thePed, "fire", true) end, 1000, 1) if (Dist < 2) then setPedAimTarget(thePed, sx, sy, sz) elseif (Dist > 4 ) then setPedAimTarget(thePed, sx, sy, sz) elseif (Dist > 5 ) then setPedAimTarget(thePed, sx, sy, sz) elseif(Dist > 6) then setPedAimTarget(thePed, sx, sy, sz) elseif(Dist > 7) then setPedAimTarget(thePed, sx, sy, sz) elseif(Dist > -- s8) --> then setPedAimTarget(thePed, sx, sy, sz) elseif(Dist > 9) then setPedAimTarget(thePed, sx, sy, sz) elseif(Dist > 10) then setPedControlState(thePed, "fire", false) setPedControlState(thePed, "right", false) end end end end function peddamage(thePed) if (isElement(thePed)) then if getElementData(thePed,"tiro") then cancelEvent() addEventHandler("onClientRender", root, onClientRender) onClientRender() end end end addEventHandler("onClientPedDamage", root, peddamage) addEvent("fire", true) addEventHandler("fire", root, peddamage) Server function atiranoped() triggerClientEvent(source,"fire", root) end I do not know where to move the onClientRender the function '-'
  17. I have not tested now, but is that correct? Client function atirar() if getElementData(source, "tiro") then cancelEvent() local ped = getElementsByType ( "ped" ) for theKey, thePed in ipairs(ped) do local x ,y, z = getElementPosition(thePed) local sx, sy, sz = getElementPosition(localPlayer) local Dist = getDistanceBetweenPoints3D (x, y, z, sx, sy, sz) givePedWeapon(thePed, 31, 5000, true) setPedAimTarget(thePed, sx, sy, sz) end end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar) Server function atiranovendedor() local ped = getElementsByType ( "ped" ) for theKey, thePeds in ipairs (ped) do triggerClientEvent(source, "atirar", thePeds) end end end I never got to use loop, always had doubts with him
  18. Ok... I tried something like this, but continues in the same way Server function atiranovendedor() setPedControlState(vendedor1, "fire", true) setPedControlState(vendedor2, "fire", true) triggerClientEvent(source, "atirar", vendedor1) triggerClientEvent(source, "atirar", vendedor2) end Client function atirar() if getElementData(source, "tiro") then cancelEvent() -- let invincible givePedWeapon(source, 31, 5000, true) local x, y, z = getElementPosition(localPlayer) setPedAimTarget(source, x, y, z) end end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar)
  19. Thanks for information, but I give an example with my script?
  20. I did not understand at the change the state of the fire, and need setPedControlState because without it the ped does not shoot, and I have no idea how to catch the attacker's position on the server side and move to the client because the setPedAimTarget's side then the client would not in any way, and if I use that function that I showed in the previous post ped sights in the position of the player, but if the player moves, the ped the aim remains the same position and does not follow the player First of all, I am Brazilian sorry for bad English
  21. atiranovendedor = shoot for seller I tried this but not given function atirar(attacker) givePedWeapon(source, 31, 5000, true) setPedControlState(source, "fire", true) local x, y, z = getElementPosition(source) setPedAimTarget(attacker, x, y, z) end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar) or function atirar(attacker) givePedWeapon(source, 31, 5000, true) setPedControlState(source, "fire", true) local x, y, z = getElementPosition(localPlayer) setPedAimTarget(source, x, y, z) end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar)
  22. First of all, I am Brazilian sorry for bad English Hello Guys!, I have a problem(novelty ), finally, I wanted the player to shoot the ped and ped starts shooting at player, only has two problems, that ped not shoot the player, and that all peds that starts shooting, not only those selected,I looked everywhere in wiki and not found, anyone knows how to solve? Client function atirar(attacker) givePedWeapon(source, 31, 5000, true) setPedControlState(source, "aim_weapon", true) setPedControlState(source, "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar) Server local ped1 = createPed ( 170, 291.88595581055, -108.11327362061, 1001.515625, 266.90405273438,true ) local ped2 = createPed ( 215, 292.69845581055, -108.1056060791, 1001.515625, 88.905662536621,true ) local vendedor1 = createPed ( 67, 290.14352416992, -111.51473999023, 1001.515625, 354.35003662109,true ) local vendedor2 = createPed ( 28, 291.11795043945, -104.48545837402, 1001.515625, 181.09841918945,true ) -- The peds (ped1, ped2) They are shooting well, but I have not selected them to shoot function atiranovendedor(source) triggerClientEvent(source, "atirar", vendedor1) triggerClientEvent(source, "atirar", vendedor2) end
  23. E ai galera, estou com um problema! (novidade ) enfim, eu queria que se o player atirasse no ped, o ped começa a atirar no player, só que, vem dois problemas, que ele n atira no player, e que todos os peds q começa a atirar, não só os que selecionei, alguem sabe resolver? Client function atirar(attacker) givePedWeapon(source, 31, 5000, true) setPedControlState(source, "aim_weapon", true) setPedControlState(source, "fire", true) end addEventHandler("onClientPedDamage", root, atirar) addEvent("atirar", true) addEventHandler("atirar", root, atirar) Server local ped1 = createPed ( 170, 291.88595581055, -108.11327362061, 1001.515625, 266.90405273438,true ) local ped2 = createPed ( 215, 292.69845581055, -108.1056060791, 1001.515625, 88.905662536621,true ) local vendedor1 = createPed ( 67, 290.14352416992, -111.51473999023, 1001.515625, 354.35003662109,true ) local vendedor2 = createPed ( 28, 291.11795043945, -104.48545837402, 1001.515625, 181.09841918945,true ) -- Os peds (ped1, ped2) They are shooting well, but I have not selected them to shoot function atiranovendedor(source) triggerClientEvent(source, "atirar", vendedor1) triggerClientEvent(source, "atirar", vendedor2) end
  24. Bom... consegui resolver, o problema era saber acrescentar essa função no server function msgentrar (source) triggerClientEvent(source,"verarma", root) -- Abrir o dx end addEventHandler( "onMarkerHit", MarkerArma1, msgentrar) -- Ao entrar no marker function fecharverarma(source) triggerClientEvent(source,"fecharverarma", root) -- Fechar o dx end addEventHandler ("onMarkerLeave", MarkerArma1, fecharverarma) -- Quando o player sair do marker
×
×
  • Create New...