LeonardoWilliams
Members-
Posts
25 -
Joined
-
Last visited
Details
-
Gang
None
-
Location
Romania
-
Occupation
None
-
Interests
Scripting
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
LeonardoWilliams's Achievements
Advanced Member (8/54)
2
Reputation
-
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
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. -
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
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 -
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
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 -
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
I will try this! Thank you a lot i will come back if it works! -
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
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) -
[QUESTION] How do i get a URL`s size.
LeonardoWilliams replied to LeonardoWilliams's topic in Scripting
Thank you so much!!! -
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?
-
Thank you so much
-
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 ?
-
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
-
Thank you so much patrick, i`ll learn a lot from this
-
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
-
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..
-
Understood, thank you now imma keep reading this script till i get it right, ur my teacher fr
-
Thank you so much Patrick, you helped me again a lot!! You are the best