Jump to content

Patrick

Moderators
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by Patrick

  1. Akkor a thePlayer nem a megfelelő játékos / olyan rangod van amihez nincs adminTitle beállítva / akármi. Több többet nem tudok mondani ennyiből.
  2. 'adminrang' értéke nil (és a nil-t nem tudod belefűzni a stringbe az outputChatBoxnál), tehát valószínűleg nem létezik a 'exports.sas_global:getPlayerAdminTitle' függvény (bár erről is kéne lennie egy errornak)
  3. Tippelgethetünk, hogy mi a gond, de milyen hibát ír a debugscript? Mert írnia kell, már csak a helytelenül használt elseif miatt is.
  4. Welcome @Matheus_Teteu! Please use only English in this section, I moved your thread to Portuguese scripting.
  5. Wrong language, moved to Portuguese section.
  6. Ohh.. yeah, probably. Then he asked in wrong place. Here they are: https://github.com/multitheftauto/mtasa-blue/blob/a0410c68945b6b3d9225c8c90af2bb6b1cda5eaa/Client/core/CNickGen.cpp
  7. Hi. You can enable it with setPlayerNametagShowing.
  8. There are several createBlips already. Please be more specific. Also I want to remind you, this is a scripting related topic, where you can ask for help about your OWN code. I'm sure this is not your code.
  9. https://github.com/botder/mtasa-webradio
  10. https://wiki.multitheftauto.com/wiki/SetAmbientSoundEnabled
  11. https://wiki.multitheftauto.com/wiki/SetPedTargetingMarkerEnabled
  12. Patrick

    Hud problem

    Probably because getHealthColor function doesn't return a color if health > 100. Just remove '(health <= 100)' condition from the first IF. function getHealthColor(health) if (health > 0) then if (health > 50) then return {238, 71, 71} elseif (health <= 50) and (health > 25) then return {235, 52, 52} elseif (health <= 25) and (health > 0) then return {176, 24, 24} end else return {198, 195, 195} end end
  13. 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.
  14. 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 have to store them in a table. Something like that: local objectCarries = {} -- store carryed objects in this table function PegarVaso( player ) local Px, Py, Pz = getElementPosition( player ) local Vaso = createObject( 2203, Px, Py, Pz ) objectCarries[player] = Vaso -- store: player carry this object setPedAnimation( player, "CARRY", "crry_prtial", 4.1, true, true, true ) exports.pAttach:attach(Vaso, player, 1.7, 0, 0.4, 0.4, 90, 0, 0 ) end addCommandHandler( "pegarvaso", PegarVaso ) function LargarVaso( player ) local Px, Py, Pz = getElementPosition( player ) setPedAnimation( player, "CARRY", "putdwn", 1.0, false, false, false, true ) setTimer(function() setPedAnimation( player ) if objectCarries[player] and isElement(objectCarries[player]) then -- is player carrying an object? destroyElement( objectCarries[player] ) -- yes... so destroy it objectCarries[player] = nil -- and don't forget to remove it from our table too end local Planta = createObject( 2203, Px , Py , Pz -0.85) setElementData( Planta, "Planta", true ) end, 1200, 1) end addCommandHandler( "soltarvaso", LargarVaso ) function Planta( button, state, player ) -- Add the function if button == "left" and state == "down" then if getElementData(source, "Planta") == true then triggerClientEvent( "MenuPlantar", player ) end end end addEventHandler( "onElementClicked", root, Planta ) ... and one more thing, source is a hidden variable what MTA define for you in most of times. Don't call your variables as source because you overwrite the hidden one... and can cause other problems.
  15. You can change door's rotation with setVehicleDoorOpenRatio. Also here is a resource.
  16. 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 ) if ( ammo > 0 ) then if (weapon == 37) then ammo = ammo/10 end playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then if getElementData(source, "selecting") == nil then setElementModel(source, playerSkins[source] or 0) for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end end playerWeapons [ source ] = nil end )
  17. 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.
  18. 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 Should look like something like that, based on the blip's one.
×
×
  • Create New...