
NeXTreme
Members-
Posts
117 -
Joined
-
Last visited
Everything posted by NeXTreme
-
Thanks, that did the trick
-
Bad argument @ "getElementByID" | Switch two functions
NeXTreme replied to dragonofdark's topic in Scripting
Like Aibo said, it's a question if you can attach to elements that are already attached. However from what I've read on the wiki, you CAN do that. function lightsOpen1 ( player, cmd ) fld1 = createMarker ( 0,0,0,"corona",0.2,255,165,0) -- and a lot of same code attachElements ( fld1, balis, -1.5, -0.1, -1 ) -- and a lot of same code end addCommandHandler ( "flechedroite", lightsOpen1 ) If that doesn't work, try to attach the marker to the vehicle instead of the panel. -
Hello, so I'm working on a little project, and I have a super-epic code that spawns a vehicle lol... -- Here's the super-epic code, note that "posX","posY" and "posZ" variables change over time so I didn't specify their value here addCommandHandler("create", function(player,command) createVehicle(411,posX,posY,posZ,0,0,0) end) My question is, is there a way to only spawn this vehicle if no players are looking at the point at where it spawns (so the spawn point is not in their field of view). Thanks.
-
I don't exactly know what you want, however "rclick" is not a valid key. If you want the right mouse button, use "mouse2".
-
About your 3rd question.... Sine Function: sin(θ) = Opposite / Hypotenuse Cosine Function: cos(θ) = Adjacent / Hypotenuse Tangent Function: tan(θ) = Opposite / Adjacent An example: Use the sine function to find "d" We know * The angle the cable makes with the seabed is 39° * The cable's length is 30 m. And we want to know "d" (the distance down). Start with: sin 39° = opposite/hypotenuse = d/30 Swap Sides: d/30 = sin 39° Use a calculator to find sin 39°: d/30 = 0.6293… Multiply both sides by 30: d = 0.6293… x 30 = 18.88 to 2 decimal places. (obviously you could just use the math.sin function here, and then multiply by 30) The depth "d" is 18.88 m Take a look at this website, it has some more explanations on this (it's also where I got this nice explanation and pictures from): http://www.mathsisfun.com/sine-cosine-tangent.html It has more explanations on how to use sine, cosine and tangent math functions. A good example of using these functions is in a loop generator, where you need to find the angles at which to place the pieces of the track. Also another link: http://www.mathsisfun.com/algebra/trigo ... index.html You can find virtually everything about trigonometry here. Good luck
-
Howdy :3 I'm currently working on a speedometer that has a nitro gague, which starts to deplete when you press CTRL or left mouse button (like set as default). My problem is that ALT is bound as the secondary control for firing a vehicle weapon which will also start nitro, which proves to be a bug if someone Alt+tabs out of the game, because nitro will then automatically start whenever available, and my script won't detect that. So, is there a way to unbind the ALT key? I've tried with unbindKey("lalt"), but it returns false. Any other way of preventing nitro to start with ALT key is good too
-
If you would like the function to stop executing when the "Fehler!" is outputted, add a return before the end else outputChatBox( "Fehler!", source ) return end
-
Yes, add that dxDrawColorText function somewhere in your code (CLIENT SIDE). Then, all you need to do is get the player's NAMETAG text and draw it with dxDrawColorText. It's essentially the same as dxDrawText, but it will automatically find hex codes and color the text correctly. -- First, get the player's nametag text. playerName = getPlayerNametagText(player) -- Now add an event handler onClientRender to keep drawing the colorized text addEventHandler("onClientRender", getRootElement(), function() dxDrawColorText(playerName,sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, "default-bold") end)
-
Use a table to queue messages, then retrieve them one by one. messages = {} messages[1] = "Hey, this is the first message" messages[2] = "This is teh 2nd msg" outputChatBox(messages[1]) -- Would write in chatbox: -- [i]Hey, this is the first message[/i]
-
While the map is "downloading", the element count should be increasing. Try something like this mapDownloading = true totalElements = 0 function checkElementCount() local tempCount = 0 for i,elem in ipairs(getElementsByType("object")) do tempCount = tempCount + 1 end if tempCount > totalElements then totalElements = tempCount setTimer(checkElementCount,1000,1) else mapDownloading = false end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),checkElementCount) function isMapDownloading() return mapDownloading end
-
This is what I use, thanks to Aiboforcen for the dxDrawColorText: function dxDrawColorText(str, ax, ay, bx, by, color, scale, font) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) end last = e+1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end Example: colorCodedName = getPlayerNametagText(getLocalPlayer()) addEventHandler("onClientRender", getRootElement(), function() dxDrawColorText(colorCodedName, 100, 100, 900, 900, tocolor(255,255,255,255),1.0,"bankgothic") end)
-
Excuse me for bumping this topic, but Asia is no scripter. He's a little kid stealing and scamming anyone he can. Somebody should ban that fool from MTA.
-
Well if they aren't on the wiki, you can't use them, can you
-
Uhm I don't get it -.- I don't see any new voice functions being added. It's just a name of a folder?
-
I haven't heard of any "voice" functions. There are "sound" functions if you want to play sounds (playSound, playSound3D, setSoundVolume, etc.).
-
Have you read this? viewtopic.php?f=91&t=26541
-
Alright, I'll try to crack it Save that 500€ for me lol
-
Is it even possible to decrypt? The encryption uses a password to generate the code, without it you're basically screwed
-
Nope, you will have to use a nightly copy of 1.1 to do that, or wait until it is released.
-
There isn't any function like this in MTA so far. In 1.1 though, you will be able to add live sound streams to the game.
-
First of all you have two functions with the same name (playerDied)
-
Oh now I finally know what you want. The problem is that guiGridListGetSelectedItem will not return the text, but the index of the selected row and column in the gridlist. You then have to use that with guiGridListGetItemText, which will grab the text from your gridlist This should do what you want: function create_veh ( playerSource ) local row,column = guiGridListGetSelectedItem ( list_vehicles ) id = guiGridListGetItemText(row,column) x, y, z = getElementPosition ( getLocalPlayer () ) showCursor ( false ) guiSetVisible ( Main_Window, false ) createVehicle ( id, x + 2, y + 1, z + 1.5 ) triggerServerEvent ( spawn, getLocalPlayer (), id ) end
-
Jaysds1 this will not work, because as long as you have more than 0 points, the IF statement will always pass at the first check. If you want to set ranks like this, the highest rank (1,000,000 points) needs to be the FIRST in the IF statement, then the 50,000 points rank, then the 10,000, etc. function getPlayerPoints (thePlayer) local Points = loadPlayerData (thePlayer,"wins") if (Points > 1000000 ) then savePlayerData (thePlayer,"rank",loadPlayerData(thePlayer,"rank") + 1) elseif (Points > 50000 ) then savePlayerData (thePlayer,"rank",loadPlayerData(thePlayer,"rank") + 1) elseif (Points > 10000 ) then savePlayerData (thePlayer,"rank",loadPlayerData(thePlayer,"rank") + 1) -- and so on.... The loadPlayerData and savePlayerData functions are from jasperNL's pointsystem resource on the community, which saves data to an XML file (unless he changed it). For a ranking system like this you should use a table to set the next rank instead of checking for points all the time. You will have to post the loadPlayerData function so we can see if you have an error in there. On the other hand, you could just have an error somewhere in the code. I never saw "attempt to compare error with a number" message in the debugging window.
-
Mhm.. Server: root = getRootElement() addEventHandler("onPlayerJoin",root, function ( ) local veh = createVehicle(470,2759.697265625,-2484.0651855469,13.822604942322) warpPedIntoVehicle(source,veh) setElementVelocity(veh,0,0.33,0) setTimer(function(thePlayer) if isElement (thePlayer) then setCameraTarget(thePlayer,thePlayer) triggerClientEvent(thePlayer,"setContrl",thePlayer) end end,9500,1,source) setCameraMatrix(source,2751.2658691406,-2419.8408203125,13.6328125,2761.0546875,-2454.3334960938,13.554655075073) end ) Client: addEvent("setContrl",true) addEventHandler("setContrl",root, function( ) setPedControlState(source,"enter_exit",true) end )
-
I'm not sure what exactly you want to do.