Jump to content

Search the Community

Showing results for tags 'script'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. I cant seem to find a solution to have a toggle system for a sound to play. For Example: If i press "b" The sirens should go off, if i press "b" again it should stop. This is what I want to happen. when i press "b" the siren should sound, and when i press "b" again the siren should stop. CODE (Client-Side) --Sirens Section function sound003 (player) local sound = playSound("Sirens/Sound_003.wav") setSoundVolume(sound, 0.3) end addCommandHandler("sound003", sound003) bindKey("num_1", "down", "sound003") function sound012 (player) local sound = playSound("Sirens/Sound_012.wav") setSoundVolume(sound, 0.3) end addCommandHandler("sound012", sound012) bindKey("n", "down", "sound012") every time I press the bindKey it keeps spamming the sound.
  2. -- client -- function boom ( ) local pX, pY, pZ = getElementPosition ( getLocalPlayer() ) createExplosion ( pX+3, pY+3, pZ, 2 ) createExplosion ( pX-3, pY-3, pZ, 2 ) createExplosion ( pX+5, pY-2, pZ, 2 ) createExplosion ( pX-4, pY+4, pZ, 2 ) end addEvent( "rob", true ) addEventHandler( "rob", root, boom ) -- server -- function robbant(p,s) if hasObjectPermissionTo(p,"command.rob") then triggerClientEvent(getRootElement(),"rob",getRootElement()) end end addCommandHandler("rob",robbant) When i type 'rob', explode everyone.. Why? How to fix this?
  3. -- client -- local w, h = guiGetScreenSize () local destroyTime local asd = 0.138 local target local localPlayer = getLocalPlayer () local allowed = true addEvent ( "allowIt", true ) addEventHandler ( "allowIt", root, function ( element ) allowed = true end ) addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon, _, _, _, _, _, element ) if not element or not allowed then return end if weapon == 23 then target = element if not destroyTime then addEventHandler ( "onClientRender", root, drawProgress ) end destroyTime = getTickCount () end end ) function drawProgress () if not getPedTarget ( localPlayer ) then destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local prog = getTickCount () - ( destroyTime or getTickCount () ) if prog > 1000 then triggerServerEvent ( "destroyIt", localPlayer, target ) destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local w2, h2 = math.floor ( w/2 ), math.floor ( h/2 ) dxDrawLine ( w2 - 72, h2 - 6, w2 - 72, h2 + 6 ) dxDrawLine ( w2 + 72, h2 - 6, w2 + 72, h2 + 6 ) dxDrawRectangle ( w2 - 69, h2 - 6, prog * asd, 12 ) end -- server -- function destroyIt (target) destroyElement(source, target) end addEvent( "destroyIt", true ) addEventHandler( "destroyIt", root, destroyIt ) no warnings / errors...
  4. function boom ( ) local pX, pY, pZ = getElementPosition ( source ) createExplosion ( pX, pY, pZ, 2 ) end addCommandHandler( "rob", boom, getLocalPlayer() ) bad argument @ 'addCommandHandler' [Expected bool at argument 3, got player]
  5. ma2med

    Sorting JSON

    Hello, I want to sort json but when I'm converting table to JSON it become like this Table [1] = "blabla", [2] = "blabla2", [3] = "blabla3" JSON [2] = "blabla2", [3] = "blabla3", [1] = "blabla" I mean by that example that the JSON is not sorted when its converted thanks.
  6. Server Log ~ [22:38:39] Starting movinggate [22:38:39] WARNING: movinggate\server.lua:6: Bad argument @ 'addEventHandler' [Expected element at argument 2, got function] [22:38:39] movinggate restarted successfully [22:38:45] WARNING: movinggate\server.lua:11: Bad argument @ 'addEventHandler' [Expected element at argument 2, got function] Script Code ~ Object = createObject(968, 1546.1999511719, -1631, 13.39999961853, 0, 90, 90) Marker = createMarker(1551.0999755859, -1627.3000488281, 12.5, "cylinder", 2, 100, 0, 12.5, 100) function gateo(player) moveObject(object, 500, 1546.1999511719, -1631, 13.39999961853, 0, 0, 90) end addEventHandler("onMarkerHit",gateo) function gateo(player) moveObject(object, 500, 1546.1999511719, -1631, 13.39999961853, 0, 90, 90) end addEventHandler("onMarkerLeave",gateo) Please help me solve this "addEventHandler" Problem. I'm new to the scripting,, Ive tried my research but i dont get it.
  7. Server: ---------------------------Motos ----------------- addEvent ("vehicle", true) addEvent ("carBuyy", true) addEventHandler ("carBuyy", getRootElement(), function(id2, cost2, name2, vehCol, veh, x, y, z, sRz) local account = getPlayerAccount(source) if (getPlayerMoney (source) >= tonumber(cost2)) then outputChatBox ("You bought " ..name2.. " for"..cost2, source, 255, 255, 0, false) outputChatBox ("Precio: $" .. cost2, source, 0, 255, 0, false) takePlayerMoney (source, tonumber (cost2)) local x,y,z = getElementPosition (source) local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) local x,y,z = veh[1],veh[2],veh[3] veh = createVehicle(id2,x,y,z) vehCol = createColSphere(x,y,z,1.5) attachElements ( vehCol, veh, 0, 0, 0 ) local vehicle = setElementData(vehCol,"parent",veh) local vehicle = setElementData(veh,"parent",vehCol) local vehicle = setElementData(vehCol,"vehicle",true) local vehicle = setElementData(vehCol,"MAX_Slots",6) local tires,engine = getVehicleAddonInfos (getElementModel(veh)) local vehicle = setElementData(vehCol,"Tire_inVehicle",math.random(0,tires)) local vehicle = setElementData(vehCol,"Engine_inVehicle",math.random(0,engine)) --vehicle_indentifikation setElementData(vehCol,"spawn",{id2,x,y,z}) --others setElementData(vehCol,"fuel",10) warpPedIntoVehicle(source, vehicle) else outputChatBox ("Sorry, you don't have"..cost2.."$", source, 255, 0, 0, false) end end ) -- Modify The coordenates And blips local varkers = {} local nums = 0 cordinatess = { {-2504.19653 ,732.67963 , 35}, {-2101.19824 , -2257.89087 , 30}, {2040.43188, 2269.98828, 10}, {241.55659 , -154.18588 , 1}, } for i, h in pairs(cordinatess) do nums = nums + 1 varkers[nums] = createMarker(h[1], h[2], h[3], "cylinder", 1.5, 254, 0, 0, 170 ) createBlip(h[1], h[2], h[3], 55, 0, 0, 0, 255, 10, 0, 500 ) end function entro_al_marcadorrr ( hitElement ) triggerClientEvent(hitElement, "AbrirrSids", hitElement) outputChatBox("Make sure, you have extra tires or engine!!!", hitElement) end addEventHandler ( "onMarkerHit", resourceRoot, entro_al_marcadorrr ) client: local motoss = { {487, 1}; {509, 40000}; {481, 45000}; {462, 50000}; {521, 150000}; {463, 90000}; {510, 70000}; {470, 1}; {461, 1}; {448, 50000}; {468, 1}; {586, 17000} } lagUII = guiCreateWindow(24, 145, 215, 372, "Shop", false) guiWindowSetSizable(lagUII, false) guiSetAlpha(lagUII, 0.84) guiSetProperty(lagUII, "CaptionColour", "FFFD0000") gridMotos = guiCreateGridList(0.04, 0.10, 0.91, 0.81, true, lagUII) guiGridListSetSelectionMode(gridMotos,0) nombres = guiGridListAddColumn(gridMotos, "Vehiculos", 0.5) precios = guiGridListAddColumn(gridMotos, "Precios", 0.5) compros = guiCreateButton(11, 341, 92, 18, "Comprar", false, lagUII) guiSetFont(compros, "default-bold-small") guiSetProperty(compros, "NormalTextColour", "FF031AFB") cierras = guiCreateButton(113, 341, 92, 18, "Cerrar", false, lagUII) guiSetFont(cierras, "default-bold-small") guiSetProperty(cierras, "NormalTextColour", "FF05F811") guiSetVisible(lagUII, false) for i,v in ipairs (motoss) do local carNames = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (gridMotos) guiGridListSetItemText (gridMotos, row, 1, carNames, false, true) guiGridListSetItemText (gridMotos, row, 2, tostring(v[2]), false, true) end function onClientCarBuyy (button, state, absoluteX, absoluteYe) if (source == compros) then guiSetVisible (lagUII, false) showCursor (false) if (guiGridListGetSelectedItem (gridMotos)) then local carNames = guiGridListGetItemText (gridMotos, guiGridListGetSelectedItem (gridMotos), 1) local carIDs = getVehicleModelFromName (carNames) local carCosts = guiGridListGetItemText (gridMotos, guiGridListGetSelectedItem (gridMotos), 2) triggerServerEvent ("carBuyy", getLocalPlayer(), carIDs, carCosts, carNames) end end end addEventHandler ("onClientGUIClick", compros, onClientCarBuyy) --- function closeShops() if guiGetVisible(lagUII) then guiSetVisible(lagUII,false) showCursor(false) end end addEventHandler ("onClientGUIClick", cierras, closeShops, false) function abrirsr( ) guiSetVisible (lagUII, true) guiSetVisible (lagUI, false) showCursor(true) end addEvent( "AbrirrSids", true ) addEventHandler( "AbrirrSids", localPlayer, abrirsr ) HELP
  8. marinov327

    Help me

    Hello! I am from Bulgaria and I have my server. My question is how to do shader motd/resource as example shaderwetroads2. I understand the secret lies most - especially in .fx files. What programs do .fx files?
  9. hola por favor ayúdenme con esta puerta automática en verdad la saque de una pagina pero solo es para clanes y quiero cambiarla para todo tipo de user espero que me ayuden por favor este es el .lua objeto = createObject ( 975, -2469.1000976563, -616.70001220703, 133.19999694824, 0, 0, 271.99951171875 ) x,y,z = getElementPosition (objeto) Zona = createColCircle ( -2469.1000976563,-616.70001220703, 5, 5 ) function Funcion (source) if ( getElementData ( source, "gang" ) == "NOMBRE-CLAN" ) then moveObject ( objeto, 6000, -2469.3000488281, -616.70001220703, 133.19999694824, 0, 0, 271.99951171875 ) outputChatBox ( "Bienvenido", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres del clan!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 () moveObject ( objeto, 6000, -2469.1000976563, -616.70001220703, 133.19999694824, 0, 0, 0 ) outputChatBox ( "Abandonando Base!", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) ayudenme porfa, gracias.
  10. addEventHandler( "onClientRender", root, function () plrs = getElementsByType'thePlayer' for i=1,#plrs do if getElementData(plrs[i], "OnDuty") and plrs[i] ~= localPlayer then dxDrawTextOnElement(plrs[i],"]-Pie clan-[",1,30,255,255,255,255,3,"default-bold") end end end ) function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font) local distance = distance or 20 local height = height or 1 local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+4, sy+4, sx, sy, tocolor(0, 0, 0, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") dxDrawText(text, sx, sy, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end function giveblood ( thePlayer ) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ( "Admin") ) then if not getElementData(thePlayer, "OnDuty") then outputChatBox ("#1AFF00 Admin "..getPlayerName(thePlayer).."#1AFF00IS NOW - ON DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",999999999) setElementData(thePlayer, "food",95) setElementData(thePlayer, "thirst",95) setElementData(thePlayer, "temperature",36.5) setElementData(thePlayer, "currentweapon_1",false) setElementData(thePlayer, "currentweapon_2",false) setElementData(thePlayer, "currentweapon_3",false) setElementData(thePlayer, "bleeding",false) setElementData(thePlayer, "brokenbone",false) setElementData(thePlayer, "pain",false) setElementData(thePlayer, "cold",false) setElementData(thePlayer, "bandit",false) setElementData(thePlayer, "humanity",2500) setElementData(thePlayer, "skin",210) end addCommandHandler("duty", giveblood) end function bloodback(thePlayer) local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin,Moderator,Owner")) then end outputChatBox ("#FF0000 Admin "..getPlayerName(thePlayer).."#FF0000IS NOW - OFF DUTY",root,255,255,255,true) setElementData(thePlayer, "blood",12000) end addCommandHandler("offduty", bloodback) end Can anyone tell me whats wrong and can anyone fix it and send it back?
  11. I create a custom interior, and I put folders me to the server, after I try to use a custom interior, passing / setintid and I actually in heaven, and not in the interior I made, perhaps no one can tell and help me, where the problem where, thanks before. np: Sorry if I'm wrong forum, because I've just joined this forum mtasa.
  12. Ayuda porfavor como pongo musica en Login Server side: function addNotification(player, text, type) if (player and text and type) then triggerClientEvent(player, 'addNotification', player, text, type); end end function loginPlayer(source, username, password) local account = getAccount ( username ) if ( account ~= false ) then local account = getAccount ( username, password ) if ( account ~= false ) then addNotification(source, "Te has logeado correctamente!", "success") logIn (source, account, password) triggerClientEvent("belepesfunkctsiker", source) else addNotification(source, "Contraseña Incorrecta!", "error") end else addNotification(source, "Contraseña Incorrecta!", "error") end end addEvent("attemptLogin", true) addEventHandler("attemptLogin", getRootElement(), loginPlayer) function registerPlayer(source, username, password) local account = getAccount (username) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then triggerClientEvent("belepesfunkctsikerregisztracio", source) addNotification(source, "Has creado la cuenta correctamente! Logeate para obtener tu nueva cuenta.", "success") else addNotification(source, "Un error a ocurrido!", "error") end else addNotification(source, "Una cuenta con el Username que ingreso ya existe!", "error") end end addEvent("attemptRegister", true) addEventHandler("attemptRegister", getRootElement(), registerPlayer) addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "logout" then cancelEvent() elseif cmd == "register" then cancelEvent() elseif cmd == "login" then cancelEvent() end end) Client Side: local screenWidth, screenHeight = guiGetScreenSize() local page = "http://mta/local/index.html" local initBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false) local theBrowser = guiGetBrowser(initBrowser) addEventHandler("onClientBrowserCreated", theBrowser, function() loadBrowserURL(source, page) showCursor(true) guiSetInputEnabled(true) addNotification("Porfavor Crea una cuenta o logeate!", "info") end ) function belepesfunkc(UsernameValue, PasswordValue) username = tostring(UsernameValue) password = tostring(PasswordValue) UsernameValue = nil PasswordValue = nil if (string.len(username)<4) then addNotification("Username should be at least 4 characters long.", "warning") elseif (string.len(username)>35) then addNotification("Username not be longer than 35 characters.", "warning") elseif (string.len(password)<4) then addNotification("Password should be at least 4 characters long.", "warning") elseif (string.len(password)>35) then addNotification("Password not be longer than 35 characters.", "warning") else triggerServerEvent("attemptLogin", getRootElement(), getLocalPlayer(), username, password) end end addEvent("belepesfunkc", true) addEventHandler("belepesfunkc", root, belepesfunkc) function belepesfunkct() destroyElement(initBrowser) destroyElement(zene) guiSetInputEnabled(false) showCursor(false) end addEvent("belepesfunkctsiker", true) addEventHandler("belepesfunkctsiker", getLocalPlayer(), belepesfunkct) function belepesfunkctsikerregisztraciohandler() executeBrowserJavascript ( theBrowser, "gotologinfromregister()" ) end addEvent("belepesfunkctsikerregisztracio", true) addEventHandler("belepesfunkctsikerregisztracio", getLocalPlayer(), belepesfunkctsikerregisztraciohandler) function belepesfunkcregisztral(UsernameValue, PasswordValue, PasswordConfirmValue) username = tostring(UsernameValue) password = tostring(PasswordValue) passwordC = tostring(PasswordConfirmValue) UsernameValue = nil PasswordValue = nil PasswordConfirmValue = nil if (string.len(username)<4) then addNotification("El nombre de usuario debe tener al menos 4 caracteres.", "warning") elseif (string.len(username)>35) then addNotification("El nombre de usuario no debe tener más de 35 caracteres.", "warning") elseif (string.len(password)<4) then addNotification("La contraseña debe tener al menos 4 caracteres.", "warning") elseif (string.len(password)>35) then addNotification("La contraseña no debe tener más de 35 caracteres.", "warning") elseif (password ~= passwordC) then addNotification("Las contraseñas no coinciden.", "error") else triggerServerEvent("attemptRegister", getRootElement(), getLocalPlayer(), username, password) end end addEvent("belepesfunkcregisztral", true) addEventHandler("belepesfunkcregisztral", root, belepesfunkcregisztral) local displayWidth, displayHeight = guiGetScreenSize(); local notificationData = {}; local notificationFont = dxCreateFont('files/fonts/roboto.ttf', 12 * 2, false); local iconsFont = dxCreateFont('files/fonts/icons.ttf', 12 * 2, false); addEventHandler('onClientRender', root, function() for k, v in pairs(notificationData) do if (v.State == 'fadeIn') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(0, 0, 0, 255, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 255; end if (alphaProgress > 1) then v.Tick = getTickCount(); v.State = 'openTile'; end elseif (v.State == 'fadeOut') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(255, 0, 0, 0, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 0; end if (alphaProgress > 1) then notificationData = {}; end elseif (v.State == 'openTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.StartX, 0, 0, v.EndX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(0, 0, 0, v.Width, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end if (tileProgress > 1) then v.State = 'fixTile'; setTimer(function() v.Tick = getTickCount(); v.State = 'closeTile'; end, string.len(v.Text) * 45 + 5000, 1); end elseif (v.State == 'closeTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.EndX, 0, 0, v.StartX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(v.Width, 0, 0, 0, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.StartX; v.CurrentWidth = 0; end if (tileProgress > 1) then v.AlphaTick = getTickCount(); v.State = 'fadeOut'; end elseif (v.State == 'fixTile') then v.Alpha = 255; v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end roundedRectangle(v.CurrentX, 20, 25 + v.CurrentWidth, 25, tocolor(0, 0, 0, 150 * v.Alpha / 255), _, true); dxDrawRectangle(v.CurrentX, 20, 25, 25, tocolor(0, 0, 0, 255 * v.Alpha / 255), true); if (v.Alpha == 255) then dxDrawText(v.Text, v.CurrentX + 25 + 10, 20, v.CurrentX + 25 + 10 + v.CurrentWidth - 20, 20 + 25, tocolor(255, 255, 255, 255), 0.40, notificationFont, 'center', 'center', true, false, true); end if (v.Type == 'error') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(215, 90, 90, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'warning') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(220, 180, 80, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'info') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(85, 180, 245, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'success') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(80, 205, 105, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); end end end ) addEvent('addNotification', true); function addNotification(text, type) if (text and type) then if (notificationData ~= nil) then table.remove(notificationData, #notificationData); end table.insert(notificationData, { StartX = (displayWidth / 2) - (25 / 2), EndX = (displayWidth / 2) - ((dxGetTextWidth(text, 0.40, notificationFont) + 20 + 25) / 2), Text = text, Width = dxGetTextWidth(text, 0.40, notificationFont) + 20, Alpha = 0, State = 'fadeIn', Tick = 0, AlphaTick = getTickCount(), CurrentX = (displayWidth / 2) - (25 / 2), CurrentWidth = 0, Type = type or 'info' } ); playSoundFrontEnd(11); end end addEventHandler('addNotification', root, addNotification); function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, postGUI); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right end end Les agradeceria la ayuda
  13. -- client -- local displayWidth, displayHeight = guiGetScreenSize(); local notificationData = {}; local notificationFont = dxCreateFont('files/fonts/roboto.ttf', 12 * 2, false); local iconsFont = dxCreateFont('files/fonts/icons.ttf', 12 * 2, false); addEventHandler('onClientRender', root, function() for k, v in pairs(notificationData) do if (v.State == 'fadeIn') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(0, 0, 0, 255, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 255; end if (alphaProgress > 1) then v.Tick = getTickCount(); v.State = 'openTile'; end elseif (v.State == 'fadeOut') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(255, 0, 0, 0, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 0; end if (alphaProgress > 1) then notificationData = {}; end elseif (v.State == 'openTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.StartX, 0, 0, v.EndX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(0, 0, 0, v.Width, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end if (tileProgress > 1) then v.State = 'fixTile'; setTimer(function() v.Tick = getTickCount(); v.State = 'closeTile'; end, string.len(v.Text) * 45 + 5000, 1); end elseif (v.State == 'closeTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.EndX, 0, 0, v.StartX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(v.Width, 0, 0, 0, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.StartX; v.CurrentWidth = 0; end if (tileProgress > 1) then v.AlphaTick = getTickCount(); v.State = 'fadeOut'; end elseif (v.State == 'fixTile') then v.Alpha = 255; v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end roundedRectangle(v.CurrentX, 20, 25 + v.CurrentWidth, 25, tocolor(0, 0, 0, 150 * v.Alpha / 255), _, true); dxDrawRectangle(v.CurrentX, 20, 25, 25, tocolor(0, 0, 0, 255 * v.Alpha / 255), true); if (v.Alpha == 255) then dxDrawText(v.Text, v.CurrentX + 25 + 10, 20, v.CurrentX + 25 + 10 + v.CurrentWidth - 20, 20 + 25, tocolor(255, 255, 255, 255), 0.40, notificationFont, 'center', 'center', true, false, true); end if (v.Type == 'error') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(215, 90, 90, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'warning') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(220, 180, 80, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'info') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(85, 180, 245, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'success') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(80, 205, 105, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); end end end ) addEvent('addNotification', true); function addNotification(text, type) if (text and type) then if (notificationData ~= nil) then table.remove(notificationData, #notificationData); end table.insert(notificationData, { StartX = (displayWidth / 2) - (25 / 2), EndX = (displayWidth / 2) - ((dxGetTextWidth(text, 0.40, notificationFont) + 20 + 25) / 2), Text = text, Width = dxGetTextWidth(text, 0.40, notificationFont) + 20, Alpha = 0, State = 'fadeIn', Tick = 0, AlphaTick = getTickCount(), CurrentX = (displayWidth / 2) - (25 / 2), CurrentWidth = 0, Type = type or 'info' } ); playSoundFrontEnd(11); end end addEventHandler('addNotification', root, addNotification); function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, postGUI); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right end end -- server -- function addNotification(player, text, type) if (player and text and type) then exports["notices"]:addNotification("Test","success"); triggerClientEvent(player, 'addNotification', player, text, type); end end addEventHandler("onResourceStart", addNotification, player, text, type)
  14. function checkAFKPlayers() for index, source in ipairs(getElementsByType("player")) do if (getPlayerIdleTime(source) > 1000) then setElementDimension ( source, 50) setElementAlpha(source, 50) outputChatBox("#004B00[DDC - Afk] #FFffFFNem mozogtál 2 percig, afk módba léptél! Kikapcsoláshoz mozdulj meg!", root, 255,000,000, true) elseif isElementMoving(source) then setElementAlpha(source, 255) setElementDimension ( source, 0) outputChatBox("#004B00[DDC - Afk] #FFffFFKiléptél az afk módból!", root, 255,000,000, true) end end end setTimer(checkAFKPlayers, 1000, 0) function isElementMoving ( theElement ) if isElement ( theElement ) then local x, y, z = getElementVelocity( theElement ) return x ~= 0 or y ~= 0 or z ~= 0 end return false end how to fix this? i want once outputChatbox
  15. Hello everyone I want a script to my server but I don't write that. This script is a car_buy script. I think you can do this. What is my idea?: - The car's price is hover above the car. - The players can't damage the car as long as the car is parking. - And they don't get in the car as long as they don't buy that. That's all!
  16. Hello any1 knows how to add more guns on server? I have dayz server and i would like to get some help. Just tell me here or contact me if you know how to script.
  17. function replaceModel() txd = engineLoadTXD("santa.txd", 290 ) engineImportTXD(txd, 290 ) dff = engineLoadDFF("santa.dff", 290 ) engineReplaceModel(dff, 290 ) txd = engineLoadTXD("male01.txd", 44 ) engineImportTXD(txd, 44 ) dff = engineLoadDFF("male01.dff", 44 ) engineReplaceModel(dff, 44 ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) addCommandHandler ( "reloadcar", replaceModel ) First skin (santa) is working fine, second (male01) got this error: Error loading DFF @ 'engineLoadDFF' [male01.dff] and bad argument @ engineReplaceModel [expected dff at argument 1, got boolean]... Wtf.. How to fix this? I do not understand this..
  18. function addToGroup( group ) group = aclGetGroup( group ) if group == false or group == nil then error( "The value of the 'group' is nil or false !" ) end account = getPlayerAccount( source ) if not isGuestAccount( account ) then local name = getAccountName( account ) local add = aclGroupAddObject( group, "user."..name ) if getPlayerMoney(source) >= 2500 then elseif add then outputChatBox( "Színesen írsz, amíg turbesz el nem veszi.", root, 0, 255, 0, true ) triggerClientEvent( source, "hideall", source ) takePlayerMoney ( source, 2000 ) else outputChatBox("Nincs erre pénzed.", source, 255, 0, 0, false) end else outputChatBox( "Regisztrálj, és jelentkezz be.", source, 255, 0, 0, true ) end end addEvent( "addToGroup", true ) addEventHandler( "addToGroup", root, addToGroup )
  19. Error, Help? Line: if curGear > lastGear then playBlowoffSound(vehicle) end if downgrading then if ( lastRPM < rpm and ( lastGear <= curGear ) ) or lastGear < curGear then if isTimer ( downgradingTimers[1] ) then killTimer ( downgradingTimers[1] ) end if isTimer ( downgradingTimers[2] ) then killTimer ( downgradingTimers[2] ) end downgrading = false end local temprpm = interpolateBetween ( downgradingRPM[1], 0, 0, downgradingRPM[2], 0, 0, downgradingProgress, "Linear" ) setSoundSpeed ( sound, temprpm/vehiclesSounds[model].coeff ) else setSoundSpeed ( sound, rpm/vehiclesSounds[model].coeff ) end end setElementData ( vehicle, "carsound:lastGear", curGear, false ) setElementData ( vehicle, "carsound:lastRPM", rpm, false ) end end end end end function playGearSound(vehicle) if isElement ( vehicle ) then local x,y,z = getElementPosition ( vehicle ) local px,py,pz = getElementPosition ( localPlayer ) if getDistanceBetweenPoints3D ( x,y,z, px,py,pz ) < 10 then local model = getElementModel ( vehicle ) local gearSound = playSound3D ( vehiclesSounds[model].gear, x, y, z, false ) setSoundVolume(gearSound, 2) attachElements ( gearSound, vehicle ) end end end
  20. Hi! This script makes possible to play a 3d sound (looped sound) by pressing the CTRL button, and stop the sound when the CTRL button is "up". Well, it has a really annoying sync bug. As you can see, there is a setElementData function in my client side script, that stores the sound element. When the player stops pressing the CTRL button then the script stops the sound with the stored element. Well the problem is that when another player press the CTRL button then the setElementData will be overwritted, and will cause really strange, annoying bugs. So the bug is: when player1 press CTRL, and after that player2 also press CTRL then the sound for player1 will not stop anymore, because player2 owerwrited the setElementData, when he pressed CTRL. Well, its not easy to explain, so i hope you understood me. Is the any way to avoid this owerwriting? or do i have to do this another way, without setElementData? Thanks in advance. client --start sound function start_fire_sound() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 476 then triggerServerEvent ( "start_fire_sound", resourceRoot, veh ) end end end bindKey("lctrl", "down", start_fire_sound) function start_fire_c(veh) local x,y,z = getElementPosition (veh) local sound_fire = playSound3D("files/fire.wav",x,y,z, true) setSoundMaxDistance( sound_fire, 500 ) setSoundVolume(sound_fire, 1) attachElements ( sound_fire, veh, 0,0,0 ) setElementData(localPlayer, "sound_fire", sound_fire) end addEvent( "start_fire_sound", true ) addEventHandler( "start_fire_sound", localPlayer, start_fire_c ) --stop sound function stop_fire_sound() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 476 then triggerServerEvent ( "stop_fire_sound", resourceRoot, veh ) end end end bindKey("lctrl", "up", stop_fire_sound) function stop_fire_sound_c(veh) local x,y,z = getElementPosition (veh) local sound_fire_lastshot = playSound3D("files/fire_lastshot.wav",x,y,z, false) setSoundMaxDistance( sound_fire_lastshot, 500 ) setSoundVolume(sound_fire_lastshot, 1) attachElements ( sound_fire_lastshot, veh, 0,0,0 ) local sound_fire = getElementData(localPlayer, "sound_fire") stopSound(sound_fire) end addEvent( "stop_fire_sound", true ) addEventHandler( "stop_fire_sound", localPlayer, stop_fire_sound_c ) server function start_fire_sound(veh) triggerClientEvent ("start_fire_sound", getRootElement(), veh) end addEvent( "start_fire_sound", true ) addEventHandler( "start_fire_sound", getRootElement(), start_fire_sound ) function stop_fire_sound(veh) triggerClientEvent ("stop_fire_sound", getRootElement(), veh) end addEvent( "stop_fire_sound", true ) addEventHandler( "stop_fire_sound", getRootElement(), stop_fire_sound )
  21. Por favor pasenme paquete de RP para abrir un servidor de paquetes necesitan sus mods de ayuda lo que me ayuda a abrir un servidor
  22. Prank online players on your server by showing them a BSOD (blue screen) and let them believe their PC has crashed while they are playing MTA. https://community.multitheftauto.com/index.php?p=resources&s=details&id=13748 use: /bsod PlayerName (exact) After 5 seconds the bluescreen and error sound disappears and everything is back normal. (hud elements and chat etc that are hidden to make the bluescreen look real will also return) 2 sound effects are incuded: buzzing sound loop (like can happen with Windows 7, 8, 10 bluescreens) and Windows XP error beep. Win7+ BSOD sound: bs1.mp3 (demonstration: https://www.youtube.com/watch?v=TDOolCOjE30) WinXP BSOD beep: bs2.mp3 (demonstration: https://www.youtube.com/watch?v=WdOuIJLHBEs) If you want to change the effect from default buzzing sound to the XP beep, change in client.lua the .mp3 filename to bs2.mp3 behind ''playSound''
  23. ---server function warpMe(targetPlayer) local interior = getElementInterior(targetPlayer) setElementInterior(source, interior) setCameraInterior(source, interior) if getElementData(targetPlayer, "IsWarpLocked") then outputChatBox("Ez a játékos nem engedte meg, hogy rá warpoljanak!", source, r, g, b, false) return end if isPedDead(source) then spawnMe() end local vehicle = getPedOccupiedVehicle(targetPlayer) if not vehicle then -- target player is not in a vehicle - just warp next to him local x, y, z = getElementPosition(targetPlayer) clientCall(source, 'setPlayerPosition', x + 2, y, z) else -- target player is in a vehicle - warp into it if there's space left if getPedOccupiedVehicle(source) then --removePlayerFromVehicle(source) outputChatBox('Get out of your vehicle first.', source) return end local numseats = getVehicleMaxPassengers(vehicle) for i=0,numseats do if not getVehicleOccupant(vehicle, i) then if isPedDead(source) then local x, y, z = getElementPosition(vehicle) spawnMe(x + 4, y, z + 1) end warpPedIntoVehicle(source, vehicle, i) return end end outputChatBox("No free seats left in " .. getPlayerName(targetPlayer) .. "'s vehicle.", source, 255, 0, 0) end end function(player) setElementData(player, "IsWarpLocked", true) else removeElementData(player, "IsWarpLocked") end addEvent( "warponoff", true ) addEventHandler( "warponoff", root, giveWeaponsOnSpawn ) ---client function warponoff ( ) triggerServerEvent("warponoff", getLocalPlayer(), group) end {'chk', id='Warp', onclick=warponoff, width=60},
  24. i tried create a window in freeroam, but doesn't working --------------------------- -- Teszt --------------------------- local GUIEditor = { button = {}, window = {}, label = {} } wnd.GUIEditor.window[1] = guiCreateWindow(541, 375, 360, 222, "Teszt", false) guiWindowSetSizable(wnd.GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(10, 182, 340, 30, "teszt", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(9, 26, 341, 156, "- Teszt", false, GUIEditor.window[1]) guiSetVisible( wnd.GUIEditor.window[1], false ) {'btn', id='gift', window=wnd.GUIEditor.window[1], width=250} Error: gui.lua:283: attempt to index local 'wnd' (a userdata value) what wrong?
  25. local screenW, screenH = guiGetScreenSize() local GUIEditor = { button = {}, window = {}, edit = {} } GUIEditor.window[1] = guiCreateWindow(0.35, 0.40, 0.32, 0.12, "Event hírdető panel", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(0.04, 0.68, 0.78, 0.23, "Beírt szöveg kiírása", true, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(0.03, 0.21, 0.93, 0.38, "", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.84, 0.68, 0.14, 0.23, "Bezár", true, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], false) guiSetInputMode("no_binds_when_editing") function showGUI() guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) end addEvent( "showguii", true ) addEventHandler( "showguii", localPlayer, showGUI ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick", GUIEditor.button[1], function ( ) text1 = guiGetText ( GUIEditor.edit[1] ) --text2 = guiGetText ( valasz1 ) --text3 = guiGetText ( valasz2 ) if text1 ~= "" then triggerServerEvent( "server",localPlayer,text1 ) setTimer ( function( ) text1 = nil end,5000, 1 ) end end,false ) addEventHandler ( 'onClientRender',root, function ( ) dxDrawText(text1, (screenW * 0.2924) + 1, (screenH * 0.3778) + 1, (screenW * 0.7014) + 1, (screenH * 0.5400) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) dxDrawText(text1, screenW * 0.2924, screenH * 0.3778, screenW * 0.7014, screenH * 0.5400, tocolor(0, 186, 255, 255), 2.50, "default-bold", "left", "top", false, true, false, false, false) end ) the dx text why not show on all players screen? o-O
×
×
  • Create New...