Jump to content

Double Weapons.


UnKnownGuy

Recommended Posts

Just now, ThatsMe said:

weird

//edit did you turn off your resource and turn on defaultstats?

Shot i didn't xD

nothing happend i restarted it and nothing happend

 

this is the script:

function pedSkills( ped, skill )
    setPedStat( ped, 69, skill )
    setPedStat( ped, 70, skill )
    setPedStat( ped, 71, skill )
    setPedStat( ped, 72, skill )
    setPedStat( ped, 73, skill )
    setPedStat( ped, 74, skill )
    setPedStat( ped, 75, skill )
    setPedStat( ped, 76, skill )
    setPedStat( ped, 77, skill )
    setPedStat( ped, 78, skill )
    setPedStat( ped, 79, skill )
end

function resourceStart( )
    local players = getElementsByType( "player" )
    
    for theKey, thePlayer in ipairs( players ) do
       pedSkills( thePlayer, 1000 )
    end
end

function resourceStop( )
    local players = getElementsByType( "player" )
    
    for theKey, thePlayer in ipairs( players ) do
       pedSkills( thePlayer, 0 )
    end
end

function playerJoin( )
    pedSkills( source, 999 )
end

addEventHandler( "onResourceStart", resourceRoot, resourceStart )
addEventHandler( "onResourceStop", resourceRoot, resourceStop )
addEventHandler( "onPlayerJoin", root, playerJoin )

Link to comment

^ is this defaultstats code or the script that you posted?

use this code

local stats = {
    [69] = 1000,  -- Pistol
    [70] = 1000,  -- Silenced pistol
    [71] = 1000,  -- Desert eagle
    [72] = 1000,  -- Shotgun
    [73] = 1000,  -- Sawnoff, 999 for duel wield
    [74] = 1000,  -- Spas-12
    [75] = 1000,  -- Micro-uzi & Tec-9, 999 for duel wield
    [76] = 1000,  -- MP5
    [77] = 1000,  -- AK-47
    [78] = 1000,  -- M4
    [79] = 1000,  -- Sniper rifle & country rifle
}

local function applyStatsForPlayer(player)
    for stat, value in pairs(stats) do
        player:setStat(stat, value)
    end
end

local function applyStatsForEveryone()
    for _, player in pairs(Element.getAllByType "player") do
        applyStatsForPlayer(player)
    end
end
addEventHandler("onResourceStart", resourceRoot, applyStatsForEveryone)
addEventHandler("onGamemodeMapStart", root, applyStatsForEveryone)

local function applyStatsForSource()
    applyStatsForPlayer(source)
end
addEventHandler("onPlayerJoin", root, applyStatsForSource)
addEventHandler("onPlayerSpawn", root, applyStatsForSource)

 

Link to comment
8 hours ago, ThatsMe said:

^ is this defaultstats code or the script that you posted?

use this code


local stats = {
    [69] = 1000,  -- Pistol
    [70] = 1000,  -- Silenced pistol
    [71] = 1000,  -- Desert eagle
    [72] = 1000,  -- Shotgun
    [73] = 1000,  -- Sawnoff, 999 for duel wield
    [74] = 1000,  -- Spas-12
    [75] = 1000,  -- Micro-uzi & Tec-9, 999 for duel wield
    [76] = 1000,  -- MP5
    [77] = 1000,  -- AK-47
    [78] = 1000,  -- M4
    [79] = 1000,  -- Sniper rifle & country rifle
}

local function applyStatsForPlayer(player)
    for stat, value in pairs(stats) do
        player:setStat(stat, value)
    end
end

local function applyStatsForEveryone()
    for _, player in pairs(Element.getAllByType "player") do
        applyStatsForPlayer(player)
    end
end
addEventHandler("onResourceStart", resourceRoot, applyStatsForEveryone)
addEventHandler("onGamemodeMapStart", root, applyStatsForEveryone)

local function applyStatsForSource()
    applyStatsForPlayer(source)
end
addEventHandler("onPlayerJoin", root, applyStatsForSource)
addEventHandler("onPlayerSpawn", root, applyStatsForSource)

 

its not working yet please fix it and give it to me again

i mean edit it and put it on community

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...