-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
Nem sourcePlayer, hanem csak source
-
source a player elementje, nem a thePlayer
-
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.
-
'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)
-
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.
-
Como compilar mods
Patrick replied to Matheus_Teteu's topic in Ajudas relacionadas ao MTA:SA (Cliente/Servidor)
Welcome @Matheus_Teteu! Please use only English in this section, I moved your thread to Portuguese scripting. -
Wrong language, moved to Portuguese section.
-
Ohh.. yeah, probably. Then he asked in wrong place. Here they are: https://github.com/multitheftauto/mtasa-blue/blob/a0410c68945b6b3d9225c8c90af2bb6b1cda5eaa/Client/core/CNickGen.cpp
-
Hi. You can enable it with setPlayerNametagShowing.
-
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.
-
Hmm.. that's a good question ?
-
https://github.com/botder/mtasa-webradio
-
https://wiki.multitheftauto.com/wiki/SetAmbientSoundEnabled
-
https://wiki.multitheftauto.com/wiki/SetPedTargetingMarkerEnabled
-
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
-
Alguem vende um scrpt q seta skin por acl ou serial com o /skin?
Patrick replied to Alissont3's topic in Programação em Lua
Wrong language, moved to Portuguese section. -
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.
-
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.
-
You can change door's rotation with setVehicleDoorOpenRatio. Also here is a resource.
- 5 replies
-
- 1
-
- scripting help
- imposible
-
(and 1 more)
Tagged with:
-
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 )
-
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.
-
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.