Jump to content

t3wz

Members
  • Posts

    149
  • Joined

  • Last visited

Details

  • Interests
    Coding (C++ ~ Lua) and food :p

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

t3wz's Achievements

Busta

Busta (15/54)

1

Reputation

  1. I'm sorry for going out of the topic, But why you don't indent your codes @manawydan? Really, they look terrible that way.
  2. You can imagine a render target as a "new screen", When you do this: drawArea = dxCreateRenderTarget(800,700) You are creating a "new screen" with 800px as width and 700 as height, As you may know, When you draw elements outside the player's resolution ( < -0 or > your width ) the "dx" will cut and won't render completely (the parts outside the resolution will not be visible), This will occur in render targets also: text = "Sample Text"; render = dxCreateRenderTarget ( 200, 50, true ); x = 200 + 5; addEventHandler ( "onClientRender", root, function ( ) local minWidth = ( -dxGetTextWidth ( text, 1, "pricedown" ) - 5 ); x = ( x == minWidth ) and ( 200 + 5 ) or ( x - 0.5 ); dxSetRenderTarget ( render, true ); dxDrawRectangle ( 0, 0, 200, 50, 0xAA000000 ); dxDrawText ( text, x, 0, 200, 50, 0xFFFFFFFF, 1, "pricedown", "left", "center" ); dxSetRenderTarget (); dxDrawImage ( 200, 200, 200, 50, render ) end ) As you can see it's pretty simple, we have to use dxSetRenderTarget to tell MTA that we wish to render the text under the render target and not in the "normal screen", After going back to the "render-on-the-normal screen" mode (using dxSetRenderTarget without parameters) we have to draw the render target itself (using dxDrawImage) . The other things in the script are just maths to move the text (i don't think that i need to explain it btw). I hope that you have understood, Apologizes for my English, Also i have not tested the code (but it seems to work).
  3. @Tails That's really easy to make, if you want i can help you via PM
  4. @Tails Horizontal scroll isn't implemented, What you can do to "fix" this: Increase the gridlist's width. Put a character limit to the video name. About the centered text, it is made to work like this, if you want to, here's the line responsible for processing the text of the row, you can edit this as you wish. @Tomas Good idea, i'll take a look into this later.
  5. Ha, i thought that you were talking about HEX colors, btw i've added support to RGB colors, feel free to look at the repo if you want
  6. No, it uses the clip/wordBreak arguments so color-coded texts aren't possible.
  7. Just change the outputChatBox ... is it that hard? outputChatBox ( "/spam /caps ...", player );
  8. infohelpToggled = {} addCommandHandler ( "infohelp", function ( player ) infohelpToggled[player] = not infohelpToggled[player]; outputChatBox ( "infohelp turned " .. ( infohelpToggled[player] and "on" or "off" ), player ); end ) addCommandHandler ( "spam", function ( player ) if ( infohelpToggled[player] ) then outputChatBox ( "/spam message", root ); else outputChatBox ( "use /infohelp first", player ); end end )
  9. From what i understood you want to stop the animation after a while, if i'm correct you can use a timer: setTimer ( function () setPedAnimation ( localPlayer, false ) end , 3 * 1000, 1 ) -- 3 = seconds to stop the animation Btw this is the English section, you should go to the Portuguese section to write in Portuguese.
  10. function a () end function b () end addCommandHandler ( "bomb", a ); addCommandHandler ( "bomb", b ); btw you won't need 2 functions for this, read about tables and you can create it easily.
  11. t3wz

    Private skin

    addEventHandler ( "onElementModelChange", root, function ( oldModel ) if getElementType ( source ) == "player" then if not isObjectInACLGroup( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Owner" ) ) then if getElementModel ( source ) == SKIN_ID_HERE then outputChatBox ( "Only the server owners can use this skin", source, 255, 0, 0 ); -- for some reason using setElementModel without a timer doesn't set the skin setTimer ( function(p) setElementModel ( p, oldModel ); end , 100, 1, source ); end end end end ); don't forget to change SKIN_ID_HERE.
  12. Just check if weapon is equal to 24.
  13. t3wz

    [HELP]Input Memo

    I made an example using edits (which is the gui element made for this): guiCreateLabel ( 500, 80, 100, 50, "input the skin ID:", false ) -- create the label, nothing special here editbox = guiCreateEdit ( 500, 100, 100, 50, "", false ) -- create the edit box in the editbox variable setbutton = guiCreateButton ( 500, 160, 100, 50, "Set", false ) -- create a button in the setbutton variable showCursor ( true ) -- show the cursor, now the player is able to write in the edit box function changeskin ( ) local skinid = guiGetText ( editbox ) -- get the text written in the edit box and 'save' it in the skinid variable local number = tonumber ( skinid ) -- convert the skinid variable to a number setElementModel ( localPlayer, number ) -- set the player skin end addEventHandler ( "onClientGUIClick", setbutton, changeskin ) -- add the onClientGUIClick event (which is triggered when the player click on the set button) Hope you understand, ofc if you're going to use this you need to check if the skin is valid etc, this is just an example.
  14. x, y, z and vehicle weren't defined in your code (they were parameters from the onClientGUIClick event), but I think that you trigger the "playTheSoundEvent" event in the server side, so i didn't remove the old 'variables'. commandGUI = "speaker" screenW,screenH = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot, function() Window = guiCreateWindow((screenW - 384) / 2, (screenH - 102) / 2, 384, 102, "Speakers", false) guiWindowSetSizable(Window, false) bCreate = guiCreateButton(83, 64, 72, 27, "Create", false, Window) bRemove = guiCreateButton(160, 64, 72, 27, "Remove", false, Window) bClose = guiCreateButton(237, 64, 72, 27, "Close", false, Window) addEventHandler("onClientGUIClick",bCreate, playTheSound) addEventHandler("onClientGUIClick",bRemove, stopTheSound) link = guiCreateEdit(43, 31, 331, 26, "", false, Window) guiCreateLabel(10, 36, 26, 16, "Link:", false, Window) guiSetVisible (Window, false) end ) function openGUI() guiSetVisible (Window, true) showCursor (true) end function closeGUI() guiSetVisible (Window, false) showCursor (false) end function playTheSound(x, y, z, vehicle) local url = guiGetText( link ) local pos = type(x) ~= "string" and { x, y, z } or { getElementPosition ( localPlayer ) } local vehicle = isElement(vehicle) and vehicle or ( isPedInVehicle( localPlayer ) and getPedOccupiedVehicle ( localPlayer ) or false ) sound = playSound3D(url, unpack ( pos ) ) if (isElement(vehicle)) then attachElements(sound, vehicle) end end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) if sound and isElement(sound) then stopSound(sound) end end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == bClose) then closeGUI() end end ) addCommandHandler(commandGUI,openGUI)
×
×
  • Create New...