Jump to content

root.

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by root.

  1. se você não tiver dificuldade em ler, verá que eu lhe disse para cancelar o evento onPlayerChat para adicionar um outputChatBox e não repeti-lo com o chat padrão
  2. Se você tiver problemas com o seu código, você deve publicá-lo. Quanto ao bate-papo com a tecla T, você deve usar o evento 'onPlayerChat' com um outputChatBox e cancelar o evento. Aqui está um exemplo que fornece o mesmo wiki do MTA: -- define our chat radius local chatRadius = 20 --units -- define a handler that will distribute the message to all nearby players function sendMessageToNearbyPlayers(message, messageType) -- we will only send normal chat messages, action and team types will be ignored if messageType == 0 then -- get the chatting player's position local posX1, posY1, posZ1 = getElementPosition(source) -- loop through all player and check distance for id, player in ipairs(getElementsByType("player")) do local posX2, posY2, posZ2 = getElementPosition(player) if getDistanceBetweenPoints3D(posX1, posY1, posZ1, posX2, posY2, posZ2) <= chatRadius then outputChatBox(message, player) end end end -- block the original message by cancelling this event cancelEvent() end -- attach our new chat handler to onPlayerChat addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers )
  3. Se você deseja fazer um bate-papo personalizado, desative qualquer recurso que use o evento onPlayerChat
  4. No sé si esto responderá tu duda pero puedes ver este tutorial donde te enseña como instalar la GM Paradise.
  5. bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, element material, float width, [ int color = white, [ bool postGUI = false, ] float faceTowardX, float faceTowardY, float faceTowardZ ] ) faceTowardX, faceTowardY, faceTowardZ
  6. function msg( player, cmd, ...) local msg = table.concat({...}, ' ') for i,player in pairs(getElementsByType('player')) do local acc = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup('user.'..acc, aclGetGroup('Everyone')) then outputChatBox('[User] '..getPlayerName(player)..': '..msg, player, 255, 255, 255, true) end end end addCommandHandler('sendmsg', msg) Use isso como uma referência
  7. Você não entendeu a parte do uso do formato de código ... ?
  8. Você não deve usar a função triggerClientEvent () no lado do cliente. Você deve usar triggerServerEvent () para enviar dados para o servidor e triggerClientEvent () para enviar dados para o cliente. E você deve postar a linha 188, é a que marca erro
  9. Sorry, it must have been a mistake in my browser, I was in the scripting section lmao
  10. I think it is not the right section to publish this
  11. addEventHandler('onPlayerWasted',root, function( attacker, weapon, bodypart ) if attacker then if getElementType( attacker ) == 'player' then giveMoney( attacker, 100 ) end end end ) addEventHandler ( 'onPedWasted', root, function ( _, killer ) if getElementType ( killer ) == 'player' then givePlayerMoney ( killer, 100 ) end end )
  12. Mostrar mais código, nessa parte não há "safe zone"
  13. toggleControl( player, 'radar', false ) This disables f11 but what is top text? I do not understand
  14. Esqueci de especificar o item, desculpe como o usuário acima colocou: local fala = getElementData(localPlayer,'falando') or false
  15. Você deve procurar o evento onClientRender em um dos arquivos do cliente
  16. -- Clientside addEventHandler("onClientRender",root, function() local fala = getElementData('falando') or false if fala == true then dxDrawText("Ativado", x*500, y*100, x*1132, y*37, tocolor(0, 255, 0, 221), 1.00, font, "left", "top", false, false, false, true, false) else dxDrawText("Desativado", x*500, y*100, x*1132, y*37, tocolor(255, 0, 0, 221), 1.00, font, "left", "top", false, false, false, true, false) end end ) addEventHandler ( "onClientPlayerVoiceStart", root, function() if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then setElementData(source, "falando", true); end end ); addEventHandler ( "onClientPlayerVoiceStop", root,function() if (source and isElement(source) and getElementType(source) == "player") and localPlayer == source then setElementData(source, "falando", false); end end);
  17. Yep, It is not necessary to use the useful function, I only put one option (not the best)
  18. You don't need to use a custom animation, try using the updatePosition argument setPedAnimation(thePlayer, 'ped', 'handsup', -1, false, true, false, false) bool setPedAnimation ( ped thePed [, string block = nil, string anim = nil, int time = -1, bool loop = true, bool updatePosition = true, bool interruptable = true, bool freezeLastFrame = true, int blendTime = 250, bool retainPedState = false ] )
  19. -- Serverside local szuretMarker = createMarker(-1003.563659668, -1249.7315673828, 130.26364135742, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( hitElement, matchingDimension ) if matchingDimension then triggerClientEvent (hitElement, "szuret", hitElement ) end end addEventHandler( "onMarkerHit", szuretMarker, MarkerHit ) addEventHandler( "onMarkerLeave", szuretMarker, MarkerHit) -- Clientside addEvent('szuret',true) addEventHandler('szuret',getRootElement(), function() if not addEventHandler('onClientRender',getRootElement(),showDX) then addEventHandler('onClientRender',getRootElement(),showDX) else removeEventHandler('onClientRender',getRootElement(),showDX) end end ) function showDX() --dxDrawRectangle() for example end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) -- Useful function if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end Not tested
  20. local spawnX, spawnY, spawnZ = 1769.55469, -1862.20325, 13.57658 function spawnThePlayer(player) spawnPlayer(player, spawnX, spawnY, spawnZ) fadeCamera(player, true) setCameraTarget(player) outputChatBox("You have been Murdered.", player) end addEventHandler ("onPlayerWasted", getRootElement(), spawnThePlayer)
  21. If possible create new weapons without having to replace others. (I witness it)
  22. Complicado de entender tu post la verdad. Pero prueba esto: function takeHealth( thePlayer, cmd ) local x, y, z = getElementPosition( thePlayer ) for i,players in ipairs(getElementsByType('player')) do local tx, ty, tz = getElementPosition( players ) if getDistanceBetweenPoints3D( x, y, z, tx, ty, tz ) <= 50 then setElementHealth( players, getElementHealth( players ) - 80 ) end end end addCommandHandler('take', takeHealth)
  23. root.

    ¿Tienda?

    --[[Client-side]]-- wnd = guiCreateWindow( float x, float y, float width, float height, string titleBarText, bool relative )) guiSetVisible(wnd,false) addEvent('open',true) addEventHandler('open',getLocalPlayer(), function() guiSetVisible(wnd,true) end ) --[[Server-side]]-- marker = createMarker( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] ) addEventHandler('onMarkerHit',marker, function(hit,md) triggerClientEvent(hit,'open',hit) end )
  24. addCommandHandler('llamarubicacion', function(source,cmd,type) if ( type == "1" ) then setPedAnimation ( source, "ped", "phone_in", -1, true, false, false ) elseif ( type == "2" ) then setPedAnimation ( source, "ped", "phone_talk", -1, true, false, false ) end end )
×
×
  • Create New...