
root.
Members-
Posts
60 -
Joined
-
Last visited
Everything posted by root.
-
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 )
-
Se você deseja fazer um bate-papo personalizado, desative qualquer recurso que use o evento onPlayerChat
-
No sé si esto responderá tu duda pero puedes ver este tutorial donde te enseña como instalar la GM Paradise.
-
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
-
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
-
Como eu edito a zona safe ? as coordenadas no caso..
root. replied to +JOKER's topic in Programação em Lua
Você não entendeu a parte do uso do formato de código ... ? -
Sim é correto.
-
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
-
Sorry, it must have been a mistake in my browser, I was in the scripting section lmao
-
I think it is not the right section to publish this
-
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 )
-
Como eu edito a zona safe ? as coordenadas no caso..
root. replied to +JOKER's topic in Programação em Lua
Mostrar mais código, nessa parte não há "safe zone" -
toggleControl( player, 'radar', false ) This disables f11 but what is top text? I do not understand
-
Você deve procurar o evento onClientRender em um dos arquivos do cliente
-
-- 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);
-
onMarkerHit shows the DX Rectangle & Lines only for a second
root. replied to thund3rbird23's topic in Scripting
Yep, It is not necessary to use the useful function, I only put one option (not the best) -
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 ] )
-
onMarkerHit shows the DX Rectangle & Lines only for a second
root. replied to thund3rbird23's topic in Scripting
-- 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 -
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)
-
If possible create new weapons without having to replace others. (I witness it)
-
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)
-
--[[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 )
-
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 )
-
Primero que nada: Y podes utilizar este recurso. https://community.multitheftauto.com/index.php?p=resources&s=details&id=5195