Jump to content

Question


xeon17

Recommended Posts

setWeaponProperty 

For example, to set the weapon accuracy property of an M4 to "poor" you code it like this

function setDamage() 
    setWeaponProperty(31, "poor", "damage", 200) 
end 
addCommandHandler("damage", setDamage) 

"poor" means that all the players who have that effect will get increased damage on their M4.

It can be changed to "std" and "pro" also.

Link to comment

I tried now but , i still can kill a player with one sawed off shot , so the damage is still verry good.

full script , please help ._.

----CODE REMOVED--

PROBLEM SOLVED

Can a moderator close the topic please , thanks :)

Edited by Guest
Link to comment

I tried now but , i still can kill a player with one sawed off shot , so the damage is still verry good.

full script , please help ._.

local stats = {73, 75, 71, 77, 78} 
local weapons = {[24] = 100, [26] = 100, [32] = 100, [31] = 150, [46] = 200} 
local pBlips = {} 
  
addEventHandler("onPlayerSpawn", root, 
function() 
    takeAllWeapons(source) 
    setPlayerMoney(source, 5000) 
    --givePlayerMoney(source, 5000) 
    for _, stat in ipairs(stats) do 
        setPedStat(source, stat, 1000) 
    end 
    for weapon, ammo in pairs(weapons) do 
        giveWeapon(source, weapon, ammo) 
    end 
    if not pBlips[source] then 
        pBlips[source] = createBlipAttachedTo(source, 0, 2) 
    end 
end) 
  
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for _, player in ipairs(getElementsByType("player")) do 
        if not (isPedDead(player)) then 
            pBlips[player] = createBlipAttachedTo(player, 0, 2) 
        end 
    end 
end) 
  
-- Blip system 
setTimer(function() 
    for player, blip in pairs(pBlips) do 
        if (isElement(player)) then 
            local playerTeam = getPlayerTeam(player) 
            if (playerTeam) then 
                local r, g, b = getTeamColor(playerTeam) 
                setBlipColor(blip, r, g, b, 255) 
            else 
                setBlipColor(blip, 255, 255, 255, 255) 
            end 
        else 
            destroyElement(blip) 
            pBlips[player] = nil 
        end 
    end 
end, 5000, 0) 
  
  
addEventHandler("onPlayerSpawn", root, 
function () 
setWeaponProperty(31, "poor", "damage", 300) 
setWeaponProperty(24, "poor", "damage", 300) 
setWeaponProperty(26, "poor", "damage", 10) 
setWeaponProperty(32, "poor", "damage", 300) 
setWeaponProperty(31, "poor", "damage", 300) 
setWeaponProperty(46, "poor", "damage", 300) 
end) 
  
  

Edited by Guest
Link to comment

try this :P

on player damage, gets player health, if weapon id is 31 (m4 i guess) or 30 or 26 (sawed i guess) then

set its health to its current health - 10 Hp.

  
function setLowerDamage(attacker,wep,bd,loss) 
local health = getElementHealth(source) 
     if (wep == 31) or (wep == 30) or (wep == 26)  then 
       setElementHealth(source,tonumber(health - 10)) -- you may use another number. ( or a math.random(10,15) maybe ) 
       end 
end 
addEventHandler("onPlayerDamage",root,setLowerDamage) 
  

Link to comment
local stats = {73, 75, 71, 77, 78} 

for _, stat in ipairs(stats) do 
    setPedStat(source, stat, 1000) 
end 

This is why, stat ID 73 is "73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL"

You are setting player's skill to "pro" by, but in the code below you are only changing weapon property at "poor".

Simple fix is to include the following line in the code:

setWeaponProperty(26, "pro", "damage", 30) 

Also, weapon properties don't need to be set again on every spawn.

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...