Jump to content

LeonardoWilliams

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by LeonardoWilliams

  1. Do you know any web`service that MTA supports for uploading photos such as textures, this is a system for skin textures that we upload on a specific site and i`m trying to make a MAX MB so players won`t be able to make skins that are higher than 1mb.
  2. Thank you so much The_GTA!! What do i need to put in fetchRemote at URL, everything i put i get the errorcode 0, i put https://i.imgur.com/jmf91Em + .jpeg and it still gives me errorcode 1, if i delete the https:// i don`t get an error but the size is always 0.. Can you give me a perfect example? function veziURL(thePlayer, command) fetchRemote('i.imgur.com/jmf91Em.jpeg', callBackFetch) end function callBackFetch(responseData, errno) if responseData == 'ERROR' then outputChatBox('A aparut o eroare cu ID-ul '..errno, root, 255, 100, 100) else local myfile = fileCreate('learnfile') fileWrite(myfile, responseData) local filesize = fileGetSize(myfile) outputChatBox('Marimea este de: '..filesize..' bytes!') end end addCommandHandler('veziurlul', veziURL, false, false) I made this script but the size is always 0 bytes
  3. I have a problem i`m so sorry... How do i get the guiGetText from this ? Is a weird script. local desc = { { 'skin', 'Base Skin' }, { 'url', 'URL'}, { 'description', 'Description'}, { 'price', 'Price ($)'} } for k, v in ipairs(desc) do v.label = guiCreateLabel(10, 22 * k + 3, 100, 22, v[2] .. ':', false, editing_window) guiLabelSetHorizontalAlign(v.label, 'right') v.edit = guiCreateEdit(115, 22 * k, editing_width - 125, 22, '', false, editing_window) end
  4. I will try this! Thank you a lot i will come back if it works!
  5. addEvent('clothing:save', true) addEventHandler('clothing:save', resourceRoot, function(values) if not values.id then values.id = exports.mysql:query_insert_free("INSERT INTO clothing (skin, url, description, price) VALUES (" .. tonumber(values.skin) .. ", '" .. exports.mysql:escape_string(values.url) .. "', '" .. exports.mysql:escape_string(values.description) .. "', " .. tonumber(values.price) .. ")") if values.id then triggerClientEvent(client, "printImageInfo", resourceRoot, responseData) savedClothing[values.id] = values outputChatBox('Clothes added with id ' .. values.id .. '.', client, 0, 255, 0) else outputChatBox('Unable to add clothes.', client, 255, 0, 0) end else local existing = savedClothing[values.id] if existing then if exports.mysql:query_free('UPDATE clothing SET skin = ' .. tonumber(values.skin) .. ', description = "' .. exports.mysql:escape_string(values.description) .. '", price = ' .. tonumber(values.price) .. ' WHERE id = ' .. tonumber(values.id)) then outputChatBox('Saved clothing.', client, 0, 255, 0) existing.skin = tonumber(values.skin) existing.description = tostring(values.description) existing.price = tonumber(values.price) else outputChatBox('Clothes couldn\'t be saved.', client, 255, 0, 0) end else outputChatBox('Unable to find clothes?', client, 255, 0, 0) end end end, false) This is the code i made, can you tell me how do i get the size of the URL that i entered inside the GUi? In the client is fileCreate('image.jpg') and the pixels are 0 when i print the filesize. Client: addEvent("printImageInfo", true) addEventHandler( "printImageInfo", resourceRoot, function(pixels) local image = fileCreate ("image.jpeg") fileWrite(image, pixels) local fileSize = fileGetSize(image) outputDebugString(fileSize) fileClose(image) outputDebugString('File size:'..fileSize) end) local save = guiCreateButton(editing_width - 110, editing_height - 30, 100, 25, 'Save', false, editing_window) addEventHandler('onClientGUIClick', save, function() local values = {} for k, v in ipairs(desc) do local value = guiGetText(v.edit) if k == 1 or k == 4 then value = tonumber(value) end values[v[1]] = value end values.id = editing_item and list[editing_item].id or nil triggerServerEvent('clothing:save', resourceRoot, values) closeEditingWindow() end, false)
  6. Hello i`m pretty new to scripting. I have a system where i put an URL and it sends me to a image for example https://imgur.com/a/ieaJ3py + .jpg and i want to get in the script the file size of it. Can you please tell me how do i make this?
  7. Hello! i got a little question i think is very easy for you. When i join my server it says * Connected! [MTA:SA Server 1.5.1 [Windows]] i want it to be MTA:SA Server 1.5.7 or last version, how can i do that can u please tell me ?
  8. By the way @Patrick, can you tell me what script writer you use ? i don`t know how is called, for example i use Sublime text 3
  9. Thank you so much patrick, i`ll learn a lot from this
  10. Please give me an exemple too if you know because i`m a beginner and i want to see a proof then learn that example and use it myself to further projects
  11. Hello guys, so i encountered a little problem. This is a icon for admin but, i can`t understand how this works. For example those tooltips are made in a straight line and i want to make my own line with tooltips, like box because i want them to be vertical not horizontal, and i can`t really understand this any help please, i tried a lot but i can`t seem to get it to work, i got no idea what to do to make them in straight line. local isAdmin = exports.integration:isPlayerTrialAdmin(localPlayer) if isAdmin then if getElementData( localPlayer,"duty_admin" ) == 1 then --dxDrawImage(ax,ay,iconH,iconH,"images/hud/adm_on.png") --dxDrawImage(1645, 500, 64, 64, "images/hud/adm_on.png") --table.insert(tooltips, "adminonduty") --This is a tooltip for it, and on the second script it fires something but i can t really understand it. else --dxDrawImage(ax, ay, iconH, iconH, "images/hud/adm_off.png") --dxDrawImage(1558, 501, 77, 63, "images/hud/adm_off.png", false) --table.insert(tooltips, "adminoffduty") end ax = ax - iconW end This is what i can`t really understand at all, trying already for 3 hours to understand this script. if isCursorShowing() then ax, ay = screenWidth, getElementData(localPlayer, "annHeight") or 0 bx, by = screenWidth, screenHeight - iconH + 4 cursorX, cursorY = cursorX * screenWidth, cursorY * screenHeight for i = 1, #tooltips do ax = ax - iconW if isInBox( cursorX, cursorY, ax, ax + iconW, ay, ay + iconH/2 ) then --ADMIN DUTY / MAXIME if tooltips[i] == "adminonduty" then --what does this mean tooltip( cursorX, cursorY, "Admin Duty is ON", "Click to go OFF duty") --this too if justClicked then triggerEvent("accounts:settings:updateAccountSettings", localPlayer, "duty_admin", 0) --triggerServerEvent("updateNametagColor", localPlayer) playToggleSound() end if isInBox( cursorX, cursorY, ax, ax + iconW, ay, ay + iconH/2 ) then -- FEEL LIKE THIS IS THE THING THAT MATTERS THE MOST BUT I HAVE NO IDEA HOW TO USE IT OR ROTATE IT UPWARDS SO IT CAN BE VERTICAL, FOR NOW IS ONLY HORIZONTAL..
  12. Understood, thank you now imma keep reading this script till i get it right, ur my teacher fr
  13. Thank you so much Patrick, you helped me again a lot!! You are the best
  14. Can someone please give me an example on how to draw an image on all resolutions positioned right in the right middle , i tried to do it myself but it s just too much to understand by just reading, i need to see a script like that to understand it i think, please
  15. I need to calculate it for every resolution ?
  16. if getElementData( localPlayer,"duty_admin" ) == 1 then --dxDrawImage(ax,ay,iconH,iconH,"images/hud/adm_on.png") dxDrawImage(1645, 500, 64, 64, "images/hud/adm_on.png") table.insert(tooltips, "adminonduty") Hello guys, so i`m learning slowly a lot of stuff when u answer my questions, now i got a problem, a bigger one i think, i draw that image but it shows different on other resolutions, can u please tell me how to do it or show me an example because i`m a beginner.. i tried following other scaling on all resolutions but i think they are no use, i want that icon basically to stand in the right middle screen..
  17. Thank you so much !! It works like charm, you are a saviour !
  18. local adminduty = getElementData(localPlayer, 'duty_admin') addEventHandler("onClientClick", root, function(button, state, clickX, clickY) if button == "left" and state == "up" then -- clicking with left button AND check only release if isClickingInsideArea(clickX, clickY, ax+5,ay+500,32,32) and exports.integration:isPlayerStaff(localPlayer) and adminduty == 0 then -- check is click coordinates inside image's zone? triggerEvent("accounts:settings:updateAccountSettings", localPlayer, "duty_admin", 1) setElementData(localPlayer, 'duty_admin', 1) elseif adminduty == 1 then triggerEvent('accounts:settings:updateAccountSettings', localPlayer, 'duty_admin', 0) setElementData(localPlayer, 'duty_admin', 0) end end end) So i did this, but when i click the second time it doesn t happen anything. If i`m off duty then it just puts me on duty, if i press again nothing happens. Can u please help me or correct my script ? i feel like i need to use a return or something but idk how exactly. @Patrick
  19. Thank you so much, i`ll start watching right now made my day
  20. Thank you so much, i love this forum already. On youtube there aren`t that many tutorials and i`m trying to learn how to script 3-4 hours a day. Now i got a source that will make this process much easier. Appreciate it have a nice day dude!
  21. Hello there, i recently got into scripting MTA, i learned a lot of new stuff but i`m stucked at a part where i got some ADMIN ICONS that u click and u go ON DUTY, but the thing is they are made with dxDrawImage and i don`t know what to use to make an event that fires when i click that image. My first post i`m glad i can start learning lua with your help and share with you new stuff. Peace guys!
×
×
  • Create New...