Jump to content

Search the Community

Showing results for tags 'scripting'.

  • 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've found six issues so far. Being alone, everything seemed fine; with players, these issues are visible. For the sake of organization and to avoid overwhelming, I'll be going through each issue (if possible), instead of throwing everything at once —unless asked otherwise—. First in the list is about client.Lua's 'outputChatBox' showing to everyone in the chatbox: I've got two scripts in this moment that are causing said inconvenient: a quick ATM system and a teleport system. The ATM is a simple marker that, when hit, gives you $500, and outputs that information. The teleports work the same way, but instead, the set the interior, position and rotation of the player, and output a message. ATM: Client: (this example's location is at LV's gas station, next to Four Dragon's Casino). atm1 = createMarker (2123.0048828125, 897.57653808594, 10.1796875, "cylinder", 1, 0, 100, 0, 170) function moneyLawn (hitPlayer, matchingDimension) if (source == atm1) and (isPedInVehicle(hitPlayer) == false) then triggerServerEvent ("givePlayerMoney", hitPlayer) outputChatBox ("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: El servidor te regaló #006400$500.", 0, 0, 0, true) end end (translation: "The server gave you $500") Server: function giveToPlayer () givePlayerMoney (root, 500) end addEvent ("giveMoney", true) addEventHandler ("giveMoney", root, giveToPlayer) Because of its close relation, I'll also name another issue regarding this script. The money is being given to all players in the server, and it is being multiplied by each player. This means that is, for example, I have 3 players in my server, when any player touches the marker, each player will be given $500 x amountOfPlayers = $1500. Teleports: (I have a few other teleports, but they only change interior and position). Client: ------------------------- -- FOUR DRAGONS CASINO -- ------------------------- inFourD = createMarker (2019.76953125, 1007.0116577148, 9.7203125, "cylinder", 1, 255, 0, 0, 153) function inFourDragons (hitPlayer, matchingDimension) if (source == inFourD) and (isPedInVehicle(hitPlayer) == true) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: No se permiten vehículos dentro.", 0, 0, 0, true) elseif (source == inFourD) and (isPedInVehicle(hitPlayer) == false) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: Ingresaste al casino '#DD0000Four Dragons#FFFFFF'.", 0, 0, 0, true) setElementInterior (hitPlayer, 10) setElementPosition (hitPlayer, 2016.9376220703, 1017.0843505859, 996.875 ) setElementRotation (hitPlayer, 0, 0, 90) end end addEventHandler ("onClientMarkerHit", root, inFourDragons) outFourD = createMarker (2018.9376220703, 1017.0843505859, 995.875, "cylinder", 1, 255, 0, 0, 153) setElementInterior (outFourD, 10) function outFourDragons (hitPlayer, matchingDimension) if (source == outFourD) and (isPedInVehicle(hitPlayer) == true) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: No se permiten vehículos dentro.", 0, 0, 0, true) elseif (source == outFourD) and (isPedInVehicle(hitPlayer) == false) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: Te retiraste del casino '#DD0000Four Dragons#FFFFFF'.", 0, 0, 0, true) setElementInterior (hitPlayer, 0) setElementPosition (hitPlayer, 2021.76953125, 1007.0116577148, 10.7203125 ) setElementRotation (hitPlayer, 0, 0, 90) end end addEventHandler ("onClientMarkerHit", root, outFourDragons) [translation: (if player in veh) "No cars allowed". (if player not in veh) "You've entered/exited "Four Dragons" casino".] There is no server. This similar post, which I'm following, says that in client-side, the output is bound to be shown just for the player who triggered the event.
  2. Xwaw

    GuiEditor IMAGE

    I just want to know how you can import images into this "dxDrawImage" GUIEDITOR
  3. 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'
  4. This, don't work. Idk why. Look: addEventHandler("onClientRender", resourceRoot, function() dxDrawTextOnElement(localPlayer, "P L A Y E R", 1, 20, 0, 0, 255, 255, 1, "pricedown") end) Ofcourse, I have dxDrawTextOnElement() function in my script and script is in type client.
  5. 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?
  6. if key == 'backspace' and ePress then chat.input = string.sub(chat.input, 0, string.len(chat.input) - 1) end The backspace working with default characters (a,b,c,d...), but when i type a special character, for example: á, é, ű, ő, ü...etc., the backspace not working, what wrong?
  7. 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?
  8. denyk

    F11 label

    Hello im doing a label on bind to see it on map but it don't show me that label will you help me with that please? function init() loadstring(exports.dgs:dgsImportFunction())() label = dgsCreateLabel(...) dgsSetVisible(label, false) dgsCreateLabel(0.02,0.04,0.94,0.2,"Library",true,init) end addEventHandler("onClientResourceStart", resourceRoot, init) function toggleGUI() dgsSetVisible(label, not dgsGetVisible(label)) end bindKey("F11", "down", toggleGUI)
  9. 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??
  10. Hi, guys, help me. How to make a timer change the images? I've written a code but it doesn’t want to work. local screenSize = Vector2(guiGetScreenSize()) function random () if not systemUpTime then systemUpTime = getTickCount () end currentCount = getTickCount () tic = ( currentCount - systemUpTime ) outputDebugString( tic) if tic > 30000 then backgroundTexture = dxCreateTexture("assets/screen" .. tostring(math.random(1,6)) .. ".png") else backgroundTexture = dxCreateTexture("assets/screen1.png") end end setTimer( random, 35000, 0 ) local function draw( ) dxDrawImage ( 0, 0, screenSize.x, screenSize.y, backgroundTexture, angle, 0, -120 ) end addEventHandler("onClientRender", root, draw)
  11. Доброго времени суток! Подскажите пожалуйста я использую функцию dxDrawImage для отображения картинки. Я хочу чтоб картинка менялась через некоторое время рандомно моно и по порядку, как это моно реализовать? Вот что я пытался написать local screenSize = Vector2(guiGetScreenSize()) function random () if not systemUpTime then systemUpTime = getTickCount () end currentCount = getTickCount () tic = ( currentCount - systemUpTime ) outputDebugString( tic) if tic > 30000 then backgroundTexture = dxCreateTexture("assets/screen" .. tostring(math.random(1,6)) .. ".png") else backgroundTexture = dxCreateTexture("assets/screen1.png") end end setTimer( random, 35000, 0 ) local function draw( ) dxDrawImage ( 0, 0, screenSize.x, screenSize.y, backgroundTexture, angle, 0, -120 ) end addEventHandler("onClientRender", root, draw)
  12. Hi , guys! How to customize this panels ?
  13. 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:
  14. No errors / warnings in debugscript 3... then what wrong in this script? Client: requestBrowserDomains({"www.convertmp3.io"}) local browser = createBrowser( 1, 1, false ) local currentSound = {} addEvent( 'Play' , true ) addEventHandler( 'Play' , root , function( link ) local vehicle = getPedOccupiedVehicle ( source ) local x, y, z = getElementPosition(vehicle) currentSound[source] = playSound3D( link, x, y, z ) attachElements(currentSound[source],vehicle) setSoundMaxDistance(currentSound[source],30) setSoundVolume(currentSound[source],50) end ) function fetch(_,url) if url and url ~= "" then fetchRemote("http://www.convertmp3.io/fetch/?format=JSON&video="..url, callback) end end addCommandHandler("p",fetch) function callback(data, error) if (error ~= 0) then return outputChatBox(error) end if (data == "ERROR") then return outputChatBox("data error") end local data = fromJSON("["..data.."]") if (data) then outputChatBox("Title: "..data.title) outputChatBox("Length: "..data.length) outputChatBox("Link: "..data.link) loadBrowserURL( browser, data.link ) end end addEventHandler( "onClientBrowserNavigate", browser, function( link ) if not link:find("www.convertmp3.io") then triggerServerEvent( 'play' , localPlayer , link ) -- trigger the event when the script actially gets the playable link! end end ) server: addEvent( 'play' , true ) addEventHandler( 'play' , root , function( link ) triggerClientEvent( root , 'Play' , client , link ) end )
  15. local table = { {"1", "2", "3", "4"}, } function asdasdsdasdd() table.insert(table,"5","6","7","8") end What wrong? No errors and warnings in debugscript 3...
  16. Preciso de ajuda estou mexendo em um mod de armas que transfere de um jogador para outro mas n consegui colocar preço pra vender alguém me ajuda ===Client=== -- Script Criado by Torugo -- -- www.Modsbr-MTA.blogspot.com.br -- -- Obrigado por Baixar ;D -- local KEY = "F6" -- Hot Key outputChatBox("#0ffff0 Sistema de Armas criado por Torugo",255,0,0,true) -- My Right's ( Don't Change it ) -- ## Important Functions function centerWindow(center_window) -- local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end function getPedWeapons(ped) -- local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end -- ## Main Window ## wnd = guiCreateWindow(202,74,427,458,"Sistema de Transferir Armas",false) players_grid = guiCreateGridList(0.0211,0.0546,0.4707,0.9258,true,wnd) guiGridListSetSelectionMode(players_grid,1) guiGridListAddColumn(players_grid,"Pessoas...",0.9) weapons_grid = guiCreateGridList(0.5035,0.0546,0.4707,0.5415,true,wnd) guiGridListSetSelectionMode(weapons_grid,1) guiGridListAddColumn(weapons_grid,"Armas",0.6) guiGridListAddColumn(weapons_grid,"Municao",0.3) info = guiCreateLabel(0.5012,0.6092,0.4707,0.0699,"Digite o valor da municao",true,wnd) guiLabelSetColor(info,0,255,0) guiLabelSetVerticalAlign(info,"center") guiLabelSetHorizontalAlign(info,"center",false) guiSetFont(info,"default-bold-small") ammo = guiCreateEdit(0.5035,0.679,0.4731,0.0852,"",true,wnd) send = guiCreateButton(0.5035,0.7838,0.4731,0.0895,"Enviar Armas",true,wnd) guiSetFont(send,"default-bold-small") close = guiCreateButton(0.5035,0.8843,0.4731,0.0895,"Fechar",true,wnd) guiSetFont(close,"default-bold-small") guiSetVisible(wnd,false) centerWindow(wnd) bindKey(KEY,"down", function () if guiGetVisible(wnd) then guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(wnd,true) showCursor(true) guiSetInputEnabled(true) putPlayers() putWeapons() end end ) function putPlayers() guiGridListClear(players_grid) for _,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(players_grid) guiGridListSetItemText(players_grid,row,1,getPlayerName(player),false,false) end end function putWeapons() guiGridListClear(weapons_grid) for _,weapon in ipairs(getPedWeapons(localPlayer)) do if getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)) > 0 then local row = guiGridListAddRow(weapons_grid) guiGridListSetItemText(weapons_grid,row,1,getWeaponNameFromID(weapon),false,false) guiGridListSetItemText(weapons_grid,row,2,getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)),false,false) end end end function RefreshLists() putPlayers() putWeapons() end addEventHandler("onClientGUIClick",close, function () guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) end ,false) addEventHandler("onClientGUIClick",send, function () local sel_1 = guiGridListGetSelectedItem(players_grid) local sel_2 = guiGridListGetSelectedItem(weapons_grid) if sel_1 ~= -1 and sel_2 ~= -1 then local PlayerName = guiGridListGetItemText(players_grid,sel_1,1) local player = getPlayerFromName(PlayerName) if isElement(player) then if player ~= localPlayer then local WeaponName = guiGridListGetItemText(weapons_grid,sel_2,1) local WeaponAmmo = guiGridListGetItemText(weapons_grid,sel_2,2) local WeaponID = getWeaponIDFromName(WeaponName) local Ammo = guiGetText(ammo) if tonumber(Ammo) and tonumber(Ammo) >= 10 then if tonumber(WeaponAmmo) >= tonumber(Ammo) then setTimer(RefreshLists,500,1) triggerServerEvent("SendWeapon",localPlayer,player,WeaponID,Ammo) else outputChatBox("Erro: Você não tem munição suficiente para esta arma",255,0,0) end else outputChatBox("Error: Escreva um número na Editar",255,0,0) end else outputChatBox("Erro: Não é possível enviar Arma Para Seu Auto",255,0,0) end else RefreshLists() outputChatBox("Error: Jogador não encontrado, Lists refrescado",255,0,0) end end end ) fileDelete("Client.Lua") ===Server=== -- Script Criado por Torugo -- -- www.Modsbr-MTA.blogspot.com.br -- -- Obrigado por Baixar ;D -- addEvent("SendWeapon",true) addEventHandler("SendWeapon",root, function (player,id,ammo) local id = tonumber(id) local ammo = tonumber(ammo) giveWeapon(player,id,ammo) takeWeapon(source,id,ammo) outputChatBox("#ffffff Enviou #ff0000" .. getWeaponNameFromID(id) .. "#ffffffPara #ff0000" .. getPlayerName(player),source,255,0,0,true) outputChatBox("# " .. getPlayerName(source) .. " #ffffffEnviou #ff0000" .. getWeaponNameFromID(id) .. " #ffffffPara você com #ff0000" .. ammo .. " #FFFFFFMunição",player,255,0,0,true) end ) ===Meta=== <meta> <info author="Torugo" name="Sistema de Transferir armas" version="1.0.0" type="script" /> <script src="Client.Lua" type="client" /> <script src="Server.Lua" type="server" /> </meta> se alguém puder me ajudar
  17. This is in 1440x900 (in my resolution): This is in 1920x1080: I calculate the dx elements position with this: local sx_, sy_ = guiGetScreenSize() local sx, sy = sx_/1440, sy_/900 And i draw dx elements like this: dxDrawRectangle(sx / 2 + 290, sy / 2 +240,850,65,tocolor(0,0,0,200)) What wrong??? How can i fix this problem??
  18. This is the code: local normalScoreGorget = 0 local maxMegjelenit = 1 -------------------- for i, row in pairs(scoreboard_rows) do if (i > normalScoreGorget and elem < maxMegjelenit) then elem = elem + 1 if getElementType(row) == "player" then ---DX things here........ elseif getElementType(row) == "team" then ---DX things here........ end end end end bindKey("mouse_wheel_down", "down", function() if normalScoreGorget < #scoreboard_rows - maxMegjelenit then normalScoreGorget = normalScoreGorget + 1 end end ) bindKey("mouse_wheel_up", "down", function() if normalScoreGorget > 0 then normalScoreGorget = normalScoreGorget - 1 end end ) This is the bug: how can i fix this?.. :s
  19. I created a scoreboard system, but when i make a team, the team does not show in scoreboard.. how can i add this after playerlist?
  20. I created some handling with handling editor script, and i want set some cars default handling to these handlings with a script, when a player spawn this car, the handling in the car automatic set to the edited hand.. But how can i do this?
  21. client: local Admins = {} addEvent("updateAdmins",true) addEventHandler("updateAdmins",root, function(t) Admins = t end) function isPlayerAdmin(player) if(Admins[player]) then return true end return false end function asdi() for k,v in ipairs(Admins) do outputChatBox(k) end end addCommandHandler("asd",asdi) server: local Admins = {} function isPlayerAdmin(player) if(Admins[player]) then return true end return false end addEventHandler("onPlayerLogin",root, function() if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ))then if not(Admins[source])then Admins[source]= source triggerClientEvent("updateAdmins",source,Admins) end end end) addEventHandler("onPlayerQuit",root, function() if(Admins[source])then Admins[source]= nil triggerClientEvent("updateAdmins",source,Admins) end end) No errors, no warnings... What wrong?
  22. This is my code: local sp2 = getVehicleNitroLevel(car)*180 if sp2 ~= false and sp2 ~= nil and sp2 > 1 then dxDrawImage(x-w/1+36, y-h/1+260, 256, 256, "images/fuelindicator.png", sp2,0,0, 0xFFFFFFFF,true) dxDrawBorderedImage(x-180, y+45,245, 245, "images/fuelnum.png", 0,0,0, tocolor(colorR2, colorG2, colorB2,255)) dxDrawImage(x-105, y+110, 95, 95, "images/line.png", 0,0,0, tocolor(0,0,0,255)) dxDrawImage(x-105, y+110, 95, 95, "images/shadow.png", 0,0,0, tocolor(0,0,0,255)) end Working fine, but in debugscript flooding this error: the line 108 is the local sp2 = getVehicleNitroLevel(car)*180 how to fix this error?
  23. for index, info in ipairs(blips) do dxSetRenderTarget(MiniMap["RenderTarget"], true) local bx = info.x local by = info.y local actualDist = getDistanceBetweenPoints2D(playerX, playerY, bx, by) local dist = actualDist/(worldMaxSize/((worldWidth+worldHeight)/2)) local rot = findRotation(bx, by, playerX, playerY)-camZ local blipX, blipY = getPointFromDistanceRotation( (MiniMap_x+MiniMap["width"]+MiniMap_x)/2, (MiniMap_y+MiniMap_y+MiniMap["height"])/2, math.min(dist, math.sqrt((MiniMap_y+MiniMap_y+MiniMap["height"])/2-MiniMap_y^2 + MiniMap_x+MiniMap["width"]-(MiniMap_x+MiniMap["width"]+MiniMap_x)/2^2)), rot ) local blipX = math.max(MiniMap_x, math.min(MiniMap_x+MiniMap["width"], blipX)) local blipY = math.max(MiniMap_y, math.min(MiniMap_y+MiniMap["height"], blipY)) local color = 255 dxDrawImage(blipX - blipSize/2, blipY - blipSize/2, blipSize, blipSize, "blips/".. info.blipID ..".png",0,0,0,tocolor(255,2555,255,255)) dxSetRenderTarget() end Why not working? No errors/warnings..
  24. I want draw a dxdrawtext to a object, but how can i do it this?
×
×
  • Create New...