Jump to content

Markeloff

Members
  • Posts

    230
  • Joined

  • Last visited

Posts posted by Markeloff

  1. I don't think using 'call' as a function name is correct because

    call 
    

    is already there.

      
    function adjustHydras() 
          for i,veh in ipairs(getElementsByType ( "vehicle" )) do 
               if getElementModel(veh) == 520 then 
               setVehicleAdjustableProperty (veh,5000) 
               end 
          end 
    end 
    addEventHandler( "onClientResourceStart", resourceRoot, adjustHydras) 
      
    

  2. I gave a try and made this. I hope it helps you to figure out how to do.

      
    var = false 
    local screenWidth, screenHeight = guiGetScreenSize() 
    browser_ = createBrowser(screenWidth, screenHeight, false, false)  
      
    function webBrowserRender() 
        if isElement(browser_) then 
        dxDrawImage(0, 0, screenWidth, screenHeight, browser_, 0, 0, 0, tocolor(255,255,255,255), true) 
        end 
    end 
      
      
    function loadBrowser_(bool) 
        if bool == true then 
        showCursor(true) 
        loadBrowserURL(browser_, "https://www.youtube.com/watch?v=ohBQ59OXnYM") 
        focusBrowser(browser_) 
        addEventHandler("onClientRender", root, webBrowserRender) 
        elseif bool == false then 
        destroyElement(browser_) 
        removeEventHandler("onClientRender", root, webBrowserRender) 
        showCursor(false) 
        end 
    end 
      
      
    bindKey("b","down", 
    function() 
        if var == true then 
        var = false 
        loadBrowser_(false) 
        elseif var == false then 
        var = true 
            if isPedInVehicle(localPlayer) then 
            loadBrowser_(true) 
            end 
        end 
    end) 
      
    

  3. Copy this.

      
    -- Copyright (c) 2008, Alberto Alonso
    --
    -- All rights reserved.
    --
    -- Redistribution and use in source and binary forms, with or without modification,
    -- are permitted provided that the following conditions are met:
    --
    --     * Redistributions of source code must retain the above copyright notice, this
    --       list of conditions and the following disclaimer.
    --     * Redistributions in binary form must reproduce the above copyright notice, this
    --       list of conditions and the following disclaimer in the documentation and/or other
    --       materials provided with the distribution.
    --     * Neither the name of the superman script nor the names of its contributors may be used
    --       to endorse or promote products derived from this software without specific prior
    --       written permission.
    --
    -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    local Superman = {}
     
    -- Settings
    local ZERO_TOLERANCE = 0.00001
    local MAX_ANGLE_SPEED = 6 -- In degrees per frame
    local MAX_SPEED = 1.0
    local EXTRA_SPEED_FACTOR = 1.85
    local LOW_SPEED_FACTOR = 0.40
    local ACCELERATION = 0.025
    local EXTRA_ACCELERATION_FACTOR = 1.8
    local LOW_ACCELERATION_FACTOR = 0.85
    local TAKEOFF_VELOCITY = 1.75
    local TAKEOFF_FLIGHT_DELAY = 750
    local SMOKING_SPEED = 1.25
    local GROUND_ZERO_TOLERANCE = 0.18
    local LANDING_DISTANCE = 3.2
    local FLIGHT_ANIMLIB = "swim"
    local FLIGHT_ANIMATION = "Swim_Dive_Under"
    local FLIGHT_ANIM_LOOP = false
    local IDLE_ANIMLIB = "cop_ambient"
    local IDLE_ANIMATION = "Coplook_loop"
    local IDLE_ANIM_LOOP = true
    local MAX_Y_ROTATION = 55
    local ROTATION_Y_SPEED = 3.8
     
    -- Static global variables
    local thisResource = getThisResource()
    local rootElement = getRootElement()
    local localPlayer = getLocalPlayer()
    local serverGravity = getGravity()
     
     
    --
    -- Utility functions
    --
    local function isPlayerFlying(player)
      local data = getElementData(player, "superman:flying")
      if not data or data == false then return false
      else return true end
    end
     
    local function setPlayerFlying(player, state)
      if state == true then state = true
      else state = false end
     
      setElementData(player, "superman:flying", state)
    end
     
    local function iterateFlyingPlayers()
      local current = 1
      local allPlayers = getElementsByType("player")
     
      return function()
        local player
       
        repeat
          player = allPlayers[current]
          current = current + 1
        until not player or (isPlayerFlying(player) and isElementStreamedIn(player))
     
        return player
      end
    end
     
    function Superman:restorePlayer(player)
      setPlayerFlying(player, false)
      setPedAnimation(player, false)
      setElementVelocity(player, 0, 0, 0)
      setElementRotation(player, 0, 0, 0)
      --setPedRotation(player, getPedRotation(player))
      setElementCollisionsEnabled(player, true)
      self:destroySmokeGenerators(player)
      self.rotations[player] = nil
      self.previousVelocity[player] = nil
    end
     
    function Superman:createSmokeGenerator(player)
      local generator = createObject(2780, getElementPosition(player))
      setElementCollisionsEnabled(generator, false)
      setObjectScale(generator, 0)
      return generator
    end
     
    function Superman:createSmokeGenerators(player)
      if not self.smokeGenerators[player] then
        local smokeGenerators = {}
     
        smokeGenerators[1] = self:createSmokeGenerator(player)
        attachElementToElement(smokeGenerators[1], player, 0.75, -0.2, -0.4, -40, 0, 60)
        smokeGenerators[2] = self:createSmokeGenerator(player)
        attachElementToElement(smokeGenerators[2], player, -0.75, -0.2, -0.4, -40, 0, -60)
     
        self.smokeGenerators[player] = smokeGenerators
      end
    end
     
    function Superman:destroySmokeGenerators(player)
      if self.smokeGenerators[player] then
        for k, v in ipairs(self.smokeGenerators[player]) do
          destroyElement(v)
        end
        self.smokeGenerators[player] = nil
      end
    end
     
    function angleDiff(angle1, angle2)
      angle1, angle2 = angle1 % 360, angle2 % 360
      local diff = (angle1 - angle2) % 360
      if diff <= 180 then
        return diff
      else
        return -(360 - diff)
      end
    end
     
    local function isPedInWater(ped)
      local pedPosition = Vector3D:new(getElementPosition(ped))
      if pedPosition.z <= 0 then return true end
     
      local waterLevel = getWaterLevel(pedPosition.x, pedPosition.y, pedPosition.z)
      if not isElementStreamedIn(ped) or not waterLevel or waterLevel < pedPosition.z then
        return false
      else
        return true
      end
    end
     
    local function isnan(x)
        math.inf = 1/0
        if x == math.inf or x == -math.inf or x ~= x then
            return true
        end
        return false
    end
     
    local function getVector2DAngle(vec)
      if vec.x == 0 and vec.y == 0 then return 0 end
      local angle = math.deg(math.atan(vec.x / vec.y)) + 90
      if vec.y < 0 then
        angle = angle + 180
      end
      return angle
    end
     
    --
    -- Initialization and shutdown functions
    --
    function Superman.Start()
      local self = Superman
     
      -- Register events
      addEventHandler("onClientResourceStop", getResourceRootElement(thisResource), Superman.Stop, false)
      addEventHandler("onPlayerJoin", rootElement, Superman.onJoin)
      addEventHandler("onPlayerQuit", rootElement, Superman.onQuit)
      addEventHandler("onClientRender", rootElement, Superman.processControls)
      addEventHandler("onClientRender", rootElement, Superman.processFlight)
      addEventHandler("onClientPlayerDamage", localPlayer, Superman.onDamage, false)
      addEventHandler("onClientElementDataChange", rootElement, Superman.onDataChange)
      addEventHandler("onClientElementStreamIn", rootElement, Superman.onStreamIn)
      addEventHandler("onClientElementStreamOut", rootElement, Superman.onStreamOut)
     
      -- Bind keys
      bindKey("jump", "down", Superman.onJump)
     
      -- Register commands
      addCommandHandler("superman", Superman.cmdSuperman)
     
      -- Initializate attributes
      self.smokeGenerators = {}
      self.rotations = {}
      self.previousVelocity = {}
    end
    addEventHandler("onClientResourceStart", getResourceRootElement(thisResource), Superman.Start, false)
     
    function Superman.Stop()
      local self = Superman
     
      setGravity(serverGravity)
     
      -- Restore all players animations, collisions, etc
      for player in iterateFlyingPlayers() do
        self:restorePlayer(player)
      end
    end
     
     
     
    --
    -- Join/Quit
    --
    function Superman.onJoin(player)
      local self = Superman
      local player = player or source
     
      setPlayerFlying(player, false)
    end
     
    function Superman.onQuit(reason, player)
      local self = Superman
      local player = player or source
     
      if isPlayerFlying(player) then
        self:restorePlayer(player)
      end
    end
     
     
    --
    -- onDamage: superman is invulnerable
    --
    function Superman.onDamage()
      local self = Superman
     
      if isPlayerFlying(localPlayer) then
        cancelEvent()
      end
    end
     
     
    --
    -- onStreamIn: Reset rotation attribute for player
    --
    function Superman.onStreamIn()
     
  4.   
    function crosshair() 
    local texture = dxCreateTexture ("YOURCROSSHAIR.png") 
    local shader = dxCreateShader ( "sh.fx" ) 
    dxSetShaderValue ( shader, "gTexture", texture ) 
    engineApplyShaderToWorldTexture ( shader, "sitem16") 
    end 
    addEventHandler( "onClientResourceStart", resourceRoot,crosshair) 
      
    

    This is sh.fx, just create a .fx and copy these lines. The file must be included in meta.xml.

      
    texture gTexture; 
    technique TexReplace 
    { 
        pass P0 
        { 
            Texture[0] = gTexture;  
        } 
    } 
      
    

  5. There's no way to get the account's password, you have to store the password manually.

    How to store it? what's the ways to do that, i have no idea about storing password and how to get the password after storing it

    im sure it's possible because in other servers if someone lost his account pass he tell you ,your password

    You can store it when the client creates a new account using XML or SQL or setAccountData.

    If they are using /register to register an account, you can't store it. You need a custom login/register system.

  6. There's still some luck but, not really efficient as you wish.

    You can increase or decrease the client's gamespeed when firing a certain weapon, then you reset it to default when he stops firing. I know that doesn't change a weapon property, but it does it.

      
    speed = false 
      
    function changeSpeed(weapon, _, _, _, _, _, _) 
    if speed == false then 
    setGameSpeed(4) 
    speed = true 
    addEventHandler("onClientRender",root,checkFiring) 
    end 
    end 
    addEventHandler("onClientPlayerWeaponFire", root, changeSpeed) 
      
      
    function checkFiring() 
    if getPedTask ( localPlayer, "secondary", "TASK_SECONDARY_ATTACK" ) ~= "TASK_SIMPLE_USE_GUN" then 
    removeEventHandler("onClientRender",root,checkFiring) 
    speed = false 
    setGameSpeed(1) 
    end 
    end 
      
    

  7. You need to add these lines;

      
    vehicleFuelTable = { 
    -- {MODEL ID, MAX. FUEL}, 
    {422,80}, 
    {470,100}, 
    {468,30}, 
    {433,140}, 
    {437,140}, 
    {509,0}, 
    {487,60}, 
    {497,60}, 
    {453,60}, 
    } 
      
    function getVehicleMaxFuel(loot) 
        local modelID = getElementModel(getElementData(loot,"parent")) 
        for i,vehicle in ipairs(vehicleFuelTable) do 
            if modelID == vehicle[1] then 
                 return vehicle[2] 
            end 
        end 
        return false 
    end 
      
    

  8. function resetWantedLevel ( attacker, weapon, bodypart, loss )  
        if attacker and getElementType(attacker) == "player" then 
        local x,y,z = getElementPosition(attacker) 
            local zone = getZoneName(x,y,z,true) 
               if zone ~= "Las Venturas" then return end 
               setPlayerWantedLevel(attacker,0) 
        end 
    end 
    addEventHandler ( "onPlayerDamage", getRootElement (), resetWantedLevel ) 
    

  9. I guess you're in the wrong place but, run this little script anywhere and you'll get rid of everything.

      
    function remove() 
    for i=550,20000 do 
        removeWorldModel(i,10000,0,0,0) 
    end 
    setOcclusionsEnabled(false)   
    setWaterLevel(-5000) 
    end 
    remove() 
      
    

    -- This example is from the wiki.

  10.   
    local mywords = {["my ping"]=true,["What's my ping?"]=true,["What is my ping?"]=true} 
      
    function myping (msg,t) 
        if mywords[msg] then 
        cancelEvent() 
        outputChatBox(getPlayerName(source).."'s #FF4923ping is : "..getPlayerPing(source),root,255 ,0, 0, true ) 
        end 
    end 
    addEventHandler("onPlayerChat", root,myping) 
    

  11. function myping (msg,t) 
    if msg == "my ping" then 
    cancelEvent() 
    outputChatBox(getPlayerName(source).."'s ping is : "..getPlayerPing(source),root,255,0,0) 
    end 
    end 
    addEventHandler("onPlayerChat", root,myping) 
    

  12. function myping (msg,t) 
         if msg == "my ping" then 
         cancelEvent() 
         outputChatBox("Your ping is : "..getPlayerPing(source),source,255,0,0) 
         end 
    end 
    addEventHandler("onPlayerChat", root,myping) 
    

  13. if hasObjectPermissionTo(thePlayer, "user.guitarist5150", true) then --Specify who can enter the zone 
      
    if getTeamName(thePlayer, "Psycho Mans Gang") then 
    

    Replace that line with the one above and that will work if the team is on the scoreboard

    Dude, those lines you wrote won't work.

      
    local team = getPlayerTeam(source) 
    if team and getTeamName(team) == "Random Gang" then 
    -- your crap  
    end 
      
    

  14. Does this file exist:

    /PATH_TO_MTA_SERVER/mods/deathmatch/resource-cache/http-client-files/admin/client/admin_ACL.lua

    The problem is fixed, it was root /root missing in the path but I had to add # to index index.html index.htm in default file; so it could work fine.

×
×
  • Create New...