Search the Community
Showing results for tags 'question'.
-
I am writing a task for the server and attached an object to the player using a bone attachment, but after it stands on the marker that should remove the object, it does not disappear, although it is deleted. This happens when you press the space bar Client function clickedWood(source) if getElementData(source, "job") == true then addEventHandler("onClientKey", root, function (button, press) if (button == "mouse1") and (getPedWeapon(source) == 9) then setTimer( function () if getKeyState("mouse1") then setTimer(toggleControl, 50, 1, "fire", false) setTimer(toggleControl, 50, 1, "jump", false) toggleControl("sprint", false) triggerServerEvent("createWood", source, source) triggerServerEvent("takeGun", getLocalPlayer()) return setTimer(triggerServerEvent, 1000, 1, "setAnimWood", source) end end, 5000, 1 ) end end ) end end addEventHandler("onClientColShapeHit", colrec1, clickedWood) addEventHandler("onClientColShapeHit", colrec2, clickedWood) addEventHandler("onClientColShapeHit", colrec3, clickedWood) addEventHandler("onClientColShapeHit", colrec4, clickedWood) addEventHandler("onClientColShapeHit", colrec5, clickedWood) addEventHandler("onClientColShapeHit", colrec6, clickedWood) addEventHandler("onClientColShapeHit", colrec7, clickedWood) addEventHandler("onClientColShapeHit", colrec8, clickedWood) addEventHandler("onClientColShapeHit", colrec9, clickedWood) addEventHandler("onClientColShapeHit", colrec10, clickedWood) addEventHandler("onClientColShapeHit", colrec11, clickedWood) addEventHandler("onClientColShapeHit", colrec12, clickedWood) addEventHandler("onClientColShapeHit", colrec13, clickedWood) Server function jobStartEnd(source) setTimer(setPedAnimation, 1000, 1, source) if getElementType(source) == "player" then if not (getElementData(source, "getSkin")) then local skin = getElementModel(source) setElementData(source, "skin", skin) end if getElementData(source, "job") then setElementFrozen(source, true) local skin = getElementData(source, "skin") destroyElement(getElementData(source,'wood')) setElementData(source, "job", nil) setElementData(source, "getwood", false) setElementData(source, "wood", nil) setElementModel(source, skin) toggleControl(source, "jump", true ); toggleControl(source, "fire", true ); toggleControl(source, "aim_weapon", true ); toggleControl(source, "next_weapon", true ); toggleControl(source, "previous_weapon", true ); toggleControl(source, "fire", true) destroyElement(areaWood1) destroyElement(areaWood2) destroyElement(areaWood3) destroyElement(areaWood4) destroyElement(areaWood5) destroyElement(areaWood6) destroyElement(markerWood1) destroyElement(markerWood2) destroyElement(markerWood3) destroyElement(markerWood4) outputChatBox("Вы уволились", source) local x, y, z = getElementPosition(source) setElementPosition(source, x, y, z + 0.3) toggleControl(source, "sprint", true) setElementFrozen(source, false) else outputChatBox("Вы устроились на работу лесника", source) setElementData(source, "p", source) setElementData(source, "job", true) setElementData(source, "getSkin", true) setElementModel(source, 16) giveWeapon(source, 9) areaWood1 = createRadarArea (-585.30011, -121.91802, 40, 30, 173, 93, 0, 100 ) areaWood2 = createRadarArea (-579.24915, -70.05952, 40, 30, 173, 93, 0, 100 ) areaWood3 = createRadarArea (-503.365234375, -70.92578125, 40, -60, 173, 93, 0, 100 ) areaWood4 = createRadarArea (-494.6416015625, -166.755859375, 40, 25, 173, 93, 0, 100 ) areaWood5 = createRadarArea (-556.4951171875, -172.0068359375, 40, 35, 173, 93, 0, 100 ) areaWood6 = createRadarArea (-536.49609375, -207.3017578125, 40, 25, 173, 93, 0, 100 ) markerWood1 = createMarker(-531.42578125, -74.357421875, 62, "cylinder", 1, 255, 0, 0, 100, source) markerWood2 = createMarker(-526.537109375, -60.978515625, 62, "cylinder", 1, 255, 0, 0, 100, source) markerWood3 = createMarker(-488.0556640625, -184.6318359375, 77.6, "cylinder", 1, 255, 0, 0, 100, source) markerWood4 = createMarker(-472.7919921875, -184.6298828125, 77.6, "cylinder", 1, 255, 0, 0, 100, source) addEventHandler("onMarkerHit", markerWood1, putWood) addEventHandler("onMarkerHit", markerWood2, putWood) addEventHandler("onMarkerHit", markerWood3, putWood) addEventHandler("onMarkerHit", markerWood4, putWood) end end end addEventHandler("onPickupHit", woodJobPickup, jobStartEnd) addEvent("takeGun", true) function takeGun() if (isElement(source)) then takeWeapon(source, 9) end end addEventHandler("takeGun", getRootElement(), takeGun) addEvent("setAnimWood", true) function setAnimWood() if (isElement(source)) then setPedAnimation(source, 'CARRY', 'crry_prtial', 0) end end addEventHandler("setAnimWood", getRootElement(), setAnimWood) addEvent("createWood", true) function createWood(source) if (isElement(source)) then outputChatBox("дад") local wood = createObject(1463,0,0,0) setElementData(source, 'wood', wood) setObjectScale(wood, 0.3) setElementData(source, 'getwood', true) exports.bone_attach:attachElementToBone(wood, source, 11,-0.2,0.14,0.2,-90,-10) end end addEventHandler("createWood", getRootElement(), createWood) local i = 3 local j = 3 function putWood(source) if (getElementData(source, "job") == true) and (getElementData(source, "getwood")) and (getElementData(source, "wood")) then setElementFrozen(source, true) local w = getElementData(source,'wood') setTimer(destroyElement, 100, 1, w) -- setTimer(setPedAnimation, 10, 1, source, 'CARRY', 'putdwn') -- setTimer(setPedAnimation, 1000, 1, source) setElementData(source, "getwood", false) setTimer(toggleControl, 1500, 1, source, "sprint", true) setTimer(toggleControl, 1500, 1, source, "jump", true) toggleControl(source, "fire", true ) giveWeapon(source, 9) setElementFrozen(source, false) if i == #woods then i = i + 3 zW = zW + 0.5 yW = yW - 2.4 else yW = yW + 1.2 end if i - j == 15 then zW = oldZ xW = xW + 2 j = i end if i == j then local wood = createObject(1463, xW, yW, zW) table.insert(woods, wood) else local wood = createObject(1463, xW, yW, zW) table.insert(woods, wood) end end end Shared woodJobPickup = createPickup(-529.8564453125, -80.2939453125, 62.62984085083, 3, 1275, 0) woodMarker = {{-617.02716, -94.44028, 64.95531}, {-626.70172, -106.32458, 65.56329}, {-632.42773, -86.30462, 64.97336}, {-642.29059, -105.41351, 63.60108}, } woods = {} xW, yW, zW = -547.6201171875, -76.923828125, 62.38 oldZ = zW colrec1 = createColRectangle(-581.52441, -103.12855, 28, 6.5) colrec2 = createColRectangle(-585.52490, -119.83871, 28, 14.5) colrec3 = createColRectangle(-578.76282, -69.81663, 28, 14.5) colrec4 = createColRectangle(-575.37988, -52.70491, 28, 6.5) colrec5 = createColRectangle(-503.365234375, -99.92578125, 16, 29) colrec6 = createColRectangle(-485.3544921875, -99.0732421875, 15, 29) colrec7 = createColRectangle(-501.85546875, -112.2431640625, 30, 7) colrec8 = createColRectangle(-491.478515625, -121.9234375, 30, 9) colrec9 = createColRectangle(-491.20703125, -129.0595703125, 30, 7) colrec10 = createColRectangle(-494.6416015625, -166.755859375, 30, 14) colrec11 = createColRectangle(-556.4951171875, -172.0068359375, 30, 8) colrec12 = createColRectangle(-548.1435546875, -159.056640625, 30, 8) colrec13 = createColRectangle(-536.49609375, -207.3017578125, 29, 15)
-
local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 13) addEventHandler("onClientKey", root, function (button, press) if getElementData(getLocalPlayer(),"playerFallen") then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" then cancelEvent() end end end ) function text() for _, player in ipairs(getElementsByType('player')) do if isElementOnScreen(player) and getElementData(player, "playerFallen") then local x, y, z = getElementPosition(player) local cx, cy, cz = getCameraMatrix() local vx, vy, vz = getPedBonePosition(player, 8) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) local drawDistance = 30.0 if (dist < drawDistance or player == target) then if(isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false)) then local x, y = getScreenFromWorldPosition (vx, vy, vz + 0.6) if(x and y) then local px, py = getScreenFromWorldPosition (vx, vy, vz + 0.3) local w = dxGetTextWidth("PRECISANDO DE CURA!", 1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawImage(x -6 - w / 2,y - 15 - h - 12, w + 25, h + 115, 'images/hp.png', 0, 0, 0, tocolor(255, 0, 0, math.abs(math.sin(getTickCount()/170))*200)) --dxDrawRectangle(x -6 - w / 2,y - 15 - h - 12, w + 9, h, tocolor(0, 0, 0, 194), false) --dxDrawText("#FFFFFFNECESIDAD DE #FF0000CURACION#FFFFFF!", x - 0 - w / 2,y - 15 - h - 12, w, h, tocolor(255,0,0, math.abs(math.sin(getTickCount()/170))*200), 1, "default-bold", "left", "top", false, false, false, true, false) end end end end end end addEventHandler("onClientRender", root, text) function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 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 function contador() local timer = interpolateBetween(deadTime, 0, 0, 0, 0, 0, (getTickCount()-tick)/deadTime, "Linear") local minutes, seconds = convertTime(timer) if minutes < 10 then minutes = "0"..minutes end if seconds < 10 then seconds = "0"..seconds end dxDrawRectangle(screenW * 0.3580, screenH * 0.8099, screenW * 0.2621, screenH * 0.1328, tocolor(0, 0, 0, 182), false) dxDrawText("BVA EMERGÊNCIA", screenW * 0.3580, screenH * 0.7878, screenW * 0.6201, screenH * 0.8151, tocolor(255, 25, 25, 255), 1.20, "default-bold", "center", "top", false, false, false, false, false) dxDrawText("Estás lesionado y necesitas un médico.", screenW * 0.3580, screenH * 0.8229, screenW * 0.6201, screenH * 0.8477, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Llame a los paramédicos al /192 y espere", screenW * 0.3580, screenH * 0.8477, screenW * 0.6201, screenH * 0.8724, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("um paramédico chegar.", screenW * 0.3580, screenH * 0.8724, screenW * 0.6201, screenH * 0.8971, tocolor(255, 255, 255, 255), 1.20, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("TIEMPO DE VIDA:", screenW * 0.3616, screenH * 0.9154, screenW * 0.4305, screenH * 0.9375, tocolor(255, 254, 254, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("#ff0000".. minutes.."#ffffff:#ff0000"..seconds, screenW * 0.3580, screenH * 0.9023, screenW * 0.6201, screenH * 0.9505, tocolor(255, 25, 25, 255), 1.40, "default-bold", "center", "center", false, false, false, true, false) if getElementHealth(localPlayer) < 30 then end end function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") end function DxChamar() dxDrawText("Llamaste a un paramédico, espera.", screenW * 0.3580, screenH * 0.7500, screenW * 0.6223, screenH * 0.7799, tocolor(245, 254, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) end function updateShader() upDateScreenSource() if (oldFilmShader) then local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource); dxSetShaderValue(oldFilmShader, "Flickering", flickering); dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function render() if not isEventHandlerAdded("onClientRender", root, contador) then tick = getTickCount() createShader() addEventHandler("onClientRender", root, contador) addEventHandler("onClientPreRender", root, updateShader) end end addEvent("startDeadTime", true) addEventHandler("startDeadTime", root, render) function remove() if isEventHandlerAdded("onClientRender", root, contador) then removeEventHandler("onClientRender", root, contador) removeEventHandler("onClientPreRender", root, updateShader) end end addEvent("stopDeadTime", true) addEventHandler("stopDeadTime", root, remove) i made a knock system and i want to put godmode to the player who knocked
-
How to encrypt server vehicle mods dff and txd
- 1 reply
-
- 1
-
I had mta open and was connected to a server but was alt-tabbed out of the game for around 20 minutes and when I alt-tabbed back in to the game I was greeted by an error saying I had DLL Injectors and could not connect to the server, So I assumed it was a glitch and could be fixed by realunching MTA but after launching mta when I tried to connect back to the server I was greeted by a CD47 Ban with description of using DLL Injector. The ban was only for an hour so that's not the problem I wanted to know which process caused the ban to try and avoid this in the feature, I was hoping there would be like a log or something that I could see to indicate what caused it? Because I did not have any DLL Injector open and neither Injected anything into the game. For now my I think it might have been the MSI Afterburner and Rivatuners overlay but I'm not sure. tl;dr I got banned for dll injector and I want to know which process caused it.
-
I want to do this: Using webhook, something like this: -- created by zsenel local discordWebhookURL = "https://discord.com/api/webhooks/835103134270488596/FY5*********EXAMPLE************yKEaRsKJp4" function sendDiscordMessage(message) sendOptions = { formFields = { content = "Example:", username = "webhook - Example", embed = { description= "```Some user have typed \"help\" command.```", color= null, author= { name= "Webhook - Example" }, footer = { text = "I want to do this..." }, }, }, } fetchRemote ( discordWebhookURL, sendOptions, WebhookCallback ) end function WebhookCallback(responseData) outputDebugString("(Discord webhook callback): responseData: "..responseData) end function SendDiscordTestMessage(player, command, ...) local msg = table.concat({...}," ") -- for multiple words sendDiscordMessage(msg) end Return < Thats only a example do i want to do, any kind of help please?
-
Hi guys, this is my first topic and I hope to get my answer soon :D The question I had was, can the cmd be entered into MTA:SA Server through Discord Bot? for example: Inside the discord: !kill <playerid> Then inside the MTA:SA: function kill(player) { setElementHealth(player, 0) } I just wanted to know if this is done or not. In that case, I'm glad you taught me a solution :D
-
Anyone can send me a working yt mp3 converter API? Or how to create one, to play music from youtube on my server?
-
Hello, I would like some help. Imagine a hypothetical situation. I create 100 pickups on my server and each pickup sends a different message to the player. I came up with 2 ways to do this and I wish you could tell me which is the best in terms of resources. addEventHandler("onPickupHit", pickupSourceHere, function(player) outputChatBox("the message here", player) cancelEvent() end) addEventHandler("onPickupHit", resourceRoot, function(player) if source == pickupSourceHere then outputChatBox("the message here", player) cancelEvent() end end) Thanks! Oh, and sorry about my english.
-
Hey, someone knows where can i find a host company to my mta:sa server? I do not want to buy from a reseller, I want to be the reseller but only do it for my server
-
Hi! I'm a kind of noob scripter making a VIP panel, but I do not find a way to set.. for example, I want the player to spawn op weapons (only for vip users in this case), like Rocket Launcher, only a few times at day, not more than the established number of times for spawning it. Is it possible to do that? Also spawn Rhino's and some vehicles that I made only for VIP's.
-
Buenas gente, alguno me podria ayudar a darle la funcion de traer o warp un vehiculo para un boton de un panel de concesionario
-
Buenas Gente, Alguno me puede explicar como bloquear un comando para que solo funcione para un usuario?. Lo que quiero hacer es spawnear un auto por comando pero que solo un usuario pueda hacerlo
-
I want to know something.. When someone does a script and finds something hard to do for him to make his script works well.. I know we have to ask here for help but if he found what he was looking for in a free resource.. Does that consider stealing? For example: -if he wanted to use a table function in a certain way but doesn't know how & he found a script using that table in the same way he wanted. So if he used it. Consider stealing? Btw he used just the way not the script
-
como hago para quitar los nombres de autos que aparecen cuando me subo a un auto y quitar los nombres de los lugares que aparecen cada que paso por una parte del mapa
-
I created a youtube player, and i want to remove the event handler, when the music ends, but i dont know how to get the song length from web browser... anyone can help?
-
Hi, I would like to know if there's a way to change the texture of the objects as in SA-MP, I have many mappings on another server, and I would like to use them here too. I've been looking around but didn't find anything similar. Thank you.
-
Sooo, how can I use (I think for you well known) dxDrawTextOnElement() (client-side function, MTA Wiki site: [click]) in server-side scripts? I tried to export, plus this code: addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then call(resourceRoot, "dxDrawTextOnElement", source, message, 1, 20, 255, 255, 255, 255, 1, "default-bold") end end) (export in meta.xml for proof): <meta> <info author="VaporZ" name="VaporZ's utility [PL]" description="(desc)" type="script" version="1.0.1"/> <script src="cars.Lua" type="server"/> <script src="bank.Lua" type="server"/> <script src="utility.Lua" type="server"/> <script src="utility-c.Lua" type="client"/> <script src="testy.Lua" type="server"/> <file src="bank/accounts.xml"/> <file src="bank/atms.xml"/> <file src="cars/saved.xml"/> <file src="cars/shops.xml"/> <export function="dxDrawTextOnElement" type="client"/> </meta> But this don't work. Any ideas? Okay, I got further, but still it's not good. Look at this one (console error): ERROR: systems\utility.Lua:108: call: failed to call 'systems:dxDrawTextOnElement'
- 2 replies
-
- dxdrawtext
- dxdrawtextonelement
-
(and 7 more)
Tagged with:
-
This is the dumbest question I've ever asked on this forum, but I have problem even not only with this. So, how can I add scripts from different folders in my meta.xml? And in these scripts, how can I load xml files from different folders, too? Any idea? If yes, please, show me example I know, that I would use xml = xmlLoadFile("filename.xml") But how to load xml in different folders? Same <script src="script.Lua" type="server"/> But how to tell MTA to load script from different folder?
-
I want create a HUD with image progress bars. I think i need dxDrawImageSection, but i don't know how to use this for a progress bar. Anyone can give me a example of this progress bar with imagesection?
-
ENGLISH Let's say I have a player and I want to spawn a car in front of it with a specific distance away from the player. It must considers the player's rotation. It involves some math calculations, but I can't formulate it. BRASIL Vamos supor que eu tenha um player e eu queira spawnar um carro na frente dele com uma distância específica. Para fazer isso, deve levar em consideração a rotação atual do player. Eu sei que isso envolve cálculos matemáticos, mas não consegui formulá-los. Thanks all
-
This is the code: local now = getTickCount() local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 2500) - start), "Linear") local now2 = getTickCount() local x2,y2 = interpolateBetween(asd, asd1, 0, fgh, fgh1, 0, (now2 - start2) / ((start2 +2500) - start2), "Linear") if right == false then dxDrawRectangle(x, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) else dxDrawRectangle(x2, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) end -- if x >= 1063 and x <= 1073 and right == false then test = true elseif x >= 1089 and x <= 1099 and right == false then test = true elseif x >= 1158 and x <= 1172 and right == false then test = true elseif x >= 1212 and x <= 1232 and right == false then test = true elseif x >= 1276 and x <= 1293 and right == false then test = true elseif x >= 1423 and x <= 1433 and right == false then test = true elseif x >= 1476 and x <= 1487 and right == false then test = true else test = false end i want change the test to true when the rectangle is in the granted position, but how can i get the momentary position of the dx rectangle?
-
This is the code: function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end else return false end end function payScript(player,cmd,other,amount) local name = getPlayerFromPartialName(other) local atg local rpm = getPlayerMoney(player) local err = {} local penz = getElementData(player,"char:money") or 0 if name == false then err[#err+1] = "#FFffFFA név nem található!" end if tonumber(amount) < 0 then err[#err+1] = "#FFffFFNegatív szám nem lehet!" end atg = tonumber(amount) if (penz-atg) < 0 then err[#err+1] = "#FFffFFNincs elég pénzed!" end if(player == name) then err[#err+1] = "# nem tudsz." end if #err == 0 then setElementData(player,"char:money",penz-atg) setElementData(name,"char:money",atg+penz) else for i=1,#err do end end end addCommandHandler( "pay", payScript ) the other and the local player's money changes to the same... how to fix this??
-
I want to render a rectangle to the cursor, but the rectangle too far from the cursor.. How to fix this in my code? code: local sx_, sy_ = 1920, 1080 local sx__, sy__ = guiGetScreenSize() local xm, ym = sx__/sx_, sy__/sy_ function render() local screenx, screeny = getCursorPosition() dxDrawRectangle((sx_-687) * xm * screenx, (sy_/2+70) * ym * screeny, 170 * xm, 25 * ym,tocolor(255,181,64,80)) end addEventHandler("onClientRender",root,render) the problem: