Jump to content

Hydra

Members
  • Posts

    372
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Hydra

  1. 7 hours ago, Cronoss said:
    function giveMoney(cmd)
    	if (moneyChances == nil) then ------if moneyChances == nil | moneyChances doesn't appear before in the function, the value it's nil
    		givePlayerMoney(source, 50000) ------50.000 the amount of money the player get with the command. (You can edit this number)
    		moneyChances = 1 -------moneyChances = 1, so the first variable now it's NOT nil, that should block the option of giving the money to the player
    	else
    		outputChatBox("You already used this command.", source, 255, 0, 0) --------if moneyChances == 1 then this text shows  up
    	end
    end
    addCommandHandler("money", giveMoney) 

    (server-side)

    PD: Not tested, but this could give you an idea on how to make it, I hope it help you

    note: I'm new trying to help in this section, if I'm wrong or I missed something please tell me and I'll learn about my mistake :D

     

    Or like this:

    local used = false
    
    function givecash(command, thePlayer)
      if used == false then
        givePlayerMoney(thePlayer, 5000)
        used = true
        elseif used == true then
        outputChatBox("Already used this command", thePlayer, 255, 0, 0, true)
        end
      end
    addCommandHandler("cash", givecash)

     

  2. You can search on community website, I'm pretty sure there are a few gamemodes there

    Website: https://community.multitheftauto.com/

     

    You can also make your own gamemode if you learn scripting

    Some tutorials:

    https://wiki.multitheftauto.com/wiki/Scripting_Introduction

    https://forum.multitheftauto.com/topic/121619-lua-for-absolute-beginners/

    https://www.youtube.com/watch?v=Goqj5knKLQM&list=PLY2OlbN3OoCgTGO7kzQfIKPj4tJbYOgSR

     

    You can find more just from a simple search on google

    • Thanks 1
  3. 13 hours ago, Mahdi0793 said:

    Thank you very much. Can you enable and disable this code as above?

     

    g_P = getLocalPlayer() 
    rocketTimer = false
    function rocket()
    
        if not rocketTimer and isPedInVehicle(g_P) then
    
            local occupiedVehicle = getPedOccupiedVehicle(g_P)
    
            local rotX,rotY,rotZ = getElementRotation(occupiedVehicle)
    
            local x, y, z = getElementPosition(occupiedVehicle)
    
            local matrix = getElementMatrix(occupiedVehicle)
    
            local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1]
    
            local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2]
    
            local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3]
    
            local vx = offX - x
    
            local vy = offY - y
    
            local vz = offZ - z
    
            x = 0 * matrix[1][1] + 3 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1]
    
            y = 0 * matrix[1][2] + 3 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2]
    
            z = 0 * matrix[1][3] + 3 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3]
    
            createProjectile(g_P, 19, x, y, z, 200, nil, 0, 0, 360 - rotZ, vx, vy, vz)
    
            rocketTimer = setTimer(function() rocketTimer = false end, 3000, 1)
    
        else
    
            outputChatBox("#ff00003 Sec Wait!", 0, 0, 0, true)
    
        end
    
    end
    
    function onResourceStart()
    
        bindKey("lctrl", "down", rocket)
    
    end
    
    addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

     

    
    g_P = getLocalPlayer() 
    rocketTimer = false
    rocketActivated = false
    
    function rocket()
    if rocketActivated == true then
        if not rocketTimer and isPedInVehicle(g_P) then
            local occupiedVehicle = getPedOccupiedVehicle(g_P)
            local rotX,rotY,rotZ = getElementRotation(occupiedVehicle)
            local x, y, z = getElementPosition(occupiedVehicle)
            local matrix = getElementMatrix(occupiedVehicle)
            local offX = 0 * matrix[1][1] + 1 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1]
            local offY = 0 * matrix[1][2] + 1 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2]
            local offZ = 0 * matrix[1][3] + 1 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3]
            local vx = offX - x
            local vy = offY - y
            local vz = offZ - z
            x = 0 * matrix[1][1] + 3 * matrix[2][1] + 0 * matrix[3][1] + 1 * matrix[4][1]
            y = 0 * matrix[1][2] + 3 * matrix[2][2] + 0 * matrix[3][2] + 1 * matrix[4][2]
            z = 0 * matrix[1][3] + 3 * matrix[2][3] + 0 * matrix[3][3] + 1 * matrix[4][3]
            createProjectile(g_P, 19, x, y, z, 200, nil, 0, 0, 360 - rotZ, vx, vy, vz)
            rocketTimer = setTimer(function() rocketTimer = false end, 3000, 1)
        else
            outputChatBox("#ff00003 Sec Wait!", 0, 0, 0, true)
        end
    else
    outputChatBox("#ff0000Rocket is not enabled please use /erocket", 255, 255, 255, true)
    end
    end
    bindKey("lctrl", "down", rocket)
    
    function rocketEnable()
       if rocketActivated == false then
          rocketActivated = true
       elseif rocketActivated == true then
          rocketActivated = false
       end
    end
    addCommandHandler("erocket", rocketEnable)

    Try this

  4. local jumpActivated = false
    
    function jumpVehicle()
      if jumpActivated == true then
        local vehicle = getPedOccupiedVehicle(localPlayer)
        if vehicle then
           if isVehicleOnGround(vehicle) then
              local vx, vy, vz = getElementVelocity(vehicle)
              setElementVelocity(vehicle, vx, vy, vz+0.5)
           end
        end
      elseif jumpActivated == false then
        outputChatBox("#FF0000[CAR JUMP]: #FFFfffCar Jump is not activated, please use /ecarjump to activate", 255, 255, 255, true)
      end
    end
    bindKey("lshift", "down", jumpVehicle)
    
    function activateJump()
      if jumpActivated == false then
        jumpActivated = true
        elseif jumpActivated == true then
        jumpActivated = false
        end
      end
    addCommandHandler("ecarjump", activateJump)

    Is this what you want?

  5. From what I understand, he wants an effect for plants to grow when you approach them. ?. If this is what he is asking then he can make it with setObjectScale since plants are objects or with a shader. With script he could use colshape events

  6. Why don't you use this to stop the sound slowly:

    l

    function stopSoundSlowly (sElement)
        if not isElement(sElement) then return false end
        local sound_timer_quant = getSoundVolume(sElement)
        local slowlyStop = setTimer(
          function ()
            local soundVolume = getSoundVolume(sElement)
            setSoundVolume(sElement,soundVolume - 0.5)
    	if soundVolume >= 0 then 
              stopSound(sElement) end
    	end,400,sound_timer_quant*2
        )
    end

    https://wiki.multitheftauto.com/wiki/StopSoundSlowly

     

    You can also make something like startSoundSlowly with this function

  7. 19 hours ago, TheEcstasy said:

    Send an example whenever you can
    Because I did not understand exactly 

    thank you 

    function protectModel()
       if fileExists("model.dff") then
    
          local replaceDFF = engineLoadDFF("model.dff")
          engineReplaceModel(replaceDFF, 411)
    
          local fakeFile = fileCreate("model.3d")
          fileWrite(fakeFile, "Nope")
          fileClose(fakeFile)
    
          fileDelete("model.dff")
       end
    end
    addEventHandler("onClientResourceStart", resourceRoot, protectModel)

    This script will replace the model when the resource start, will make a fake file named model.3d and will delete the original file.

    • Like 1
  8. These are the functions you need to use:

    fileExists

    fileDelete

    fileOpen

    fileRead

    engine functions for replace the model

    Quick description: You can get the data from your original file using fileRead then use engine functions for the data you get from your .dff and .txd to replace the model and delete the files after using fileDelete. I hope you understand what I said because I'm on phone and can't give you an example

  9. Version 1.4.1(BETA VERSION)

    - Added coronas and lighting for the objects located in Missionary Hills

    - Added lighting for a few building objects in Los Santos

    - Added 2 new settings for settings.lua file

      * activationMessage (is set to false as default)

      * activateOnlyAtNight (is set to true as default)

    More info about the new settings are in settings.lua file

     

    Download the new version from here: https://community.multitheftauto.com/?p=resources&s=details&id=18637spacer.pngspacer.pngspacer.png

     

    Things that will be added in the next version:

    - Sun lighting

    - More lighting for buildings that do not have it

    • Like 1
    • Thanks 2
  10.  

    3 minutes ago, eoL|Shady said:

    hello ,i have an idea about it.

    @TheEcstasycan you try this code, it may help you, have a nice day

     

    function changeskin(playersource)
    	if not isPedOnGround(playersource) then outputChatBox("You have to be on the ground to use this command.",playersource) return end
    	if (getElementModel(playersource) == 12) then
    		setElementModel(playersource,73) --(73 this is the current skin ID)
    	else
    		setElementModel(playersource,12) --(12 this is the skin ID you can change)
    	end
    end
    addCommandHandler("changeskin",changeskin)

     

    I don't think this is what he needs. I think he is asking if he can load the txd and dff files with custom format such as 'myModel.blabla'. If this is what is he is asking then yes it can

  11. I started working on this resource again and I said to give 2 pictures for you to make an idea on how the map will look when this script is finished.
    Default:

    spacer.png

    With this resource:

    spacer.png

     

    Gonna change the name from ,,New Lamppost Lighting" in "New Lighting System"

×
×
  • Create New...