Jump to content

Patrick

Scripting Moderators
  • Content Count

    984
  • Joined

  • Last visited

  • Days Won

    24

Patrick last won the day on January 17

Patrick had the most liked content!

Community Reputation

328 Superstar

About Patrick

  • Rank
    Hungarian Section Moderator & Scripting Section Moderator

Details

  • Location
    Hungary

Recent Profile Visitors

4,018 profile views
  1. Are you interested about how to calculate K/D? It's kills count / deaths count, a simple division... just make sure deaths count is not 0 because you can't divide by zero.
  2. Hi. When you check the element-data, here 'if getElementData(Planta, "Planta") == true then', you have to use source instead of Planta. On wiki, you can see source is the element that got clicked by the player. Because now, you only always check the last created object's element-data. Always make your variables local otherwise they become global variables, and most of times you don't want that... mostly on server-side. In your case, I see why you didn't make it local, but it's a bad practise. You can't store multiple players' carried objects in one single variable... so you
  3. You can change door's rotation with setVehicleDoorOpenRatio. Also here is a resource.
  4. This "bug" happens because you save it into one variable only. So you always overwrite the previous one. You should do same as weapons save, something like that: local playerSkins = {} -- save player's skin in the table, when player dies addEventHandler ( "onPlayerWasted", root, function ( ) playerSkins[source] = tonumber(getElementModel(source)) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot )
  5. If the "coordinate" extends beyond the size of the image, it starts from the beginning. You need to make sure you can't go over the total size of the image with scrolling.
  6. Patrick

    [HELP] F11 Map

    for _, area in ipairs(getElementsByType('radararea')) do local areaX, areaY = getElementPosition(area) local sizeX, sizeY = getRadarAreaSize(area) local dx = (((areaX*mapH)/6000)+(mapH/2))+((Width/2)-(mapH/2)) local dy = mapH - (((areaY*mapH)/6000)+(mapH/2))+((Height-mapH)/2) local dendx = ((((areaX+sizeX)*mapH)/6000)+(mapH/2))+((Width/2)-(mapH/2)) local dendy = mapH - ((((areaY+sizeY)*mapH)/6000)+(mapH/2))+((Height-mapH)/2) local red,green,blue,alpha = getRadarAreaColor(area) dxDrawRectangle(dx, dy, dendx-dx, dendy-dy, tocolor(red,green,blue,alpha)) end Shou
  7. Wrong language, moved to Spanish section.
  8. Welcome! Here are some excellent resources to learn the basics of Lua scripting: - https://wiki.multitheftauto.com/wiki/Main_Page - https://wiki.multitheftauto.com/wiki/Scripting_Introduction - https://www.lua.org/manual/5.1/ - https://wiki.multitheftauto.com/wiki/Category:Tutorials - https://forum.mtasa.com/topic/34453-manuals - https://forum.mtasa.com/topic/64228-the-ultimate-lua-tutorial/ - https://forum.mtasa.com/topic/121619-lua-for-absolute-beginners - https://forum.mtasa.com/topic/95654-tut-debugging/ - https://forum.mtasa.com/topic/114541-tut-events/ - https
  9. It isn't a matrix, 6-7-8th arguments are rx, ry, rz .
  10. You can disable shooting with toggleControl. toggleControl("fire", false)
  11. Hi. You have to unpack values first, because now you pass only a table to createObject. function just_a_function() -- get the values from table local model, x, y, z, rx, ry, rz = narrows[1][1], narrows[1][2], narrows[1][3], narrows[1][4], narrows[1][5], narrows[1][6], narrows[1][7] createObject(model, x, y, z, rx, ry, rz) -- or you can use 'unpack' local model, x, y, z, rx, ry, rz = unpack(narrows[2]) createObject(model, x, y, z, rx, ry, rz) end
×
×
  • Create New...