First commit
This commit is contained in:
parent
82793c3d4a
commit
cd280f0deb
Binary file not shown.
|
@ -0,0 +1,37 @@
|
||||||
|
local disableAnims = {
|
||||||
|
{"ped","CLIMB_Stand_finish"},
|
||||||
|
{"ped","FALL_land"},
|
||||||
|
{"ped","Fight2Idle"},
|
||||||
|
{"ped","JUMP_land"},
|
||||||
|
{"ped","Player_Sneak_walkstart"},
|
||||||
|
{"ped","Run_stop"},
|
||||||
|
{"ped","Run_stopR"},
|
||||||
|
{"ped","WALK_start"},
|
||||||
|
{"ped","WALK_start_armed"},
|
||||||
|
{"ped","WALK_start_csaw"},
|
||||||
|
{"ped","WALK_start_rocket"},
|
||||||
|
{"ped","JUMP_launch"},
|
||||||
|
{"ped","JUMP_launch_R"}
|
||||||
|
}
|
||||||
|
|
||||||
|
local ifp = engineLoadIFP("CAR_dead_RHS.ifp","insanity.animdisabler")
|
||||||
|
|
||||||
|
function applyAnims(ped)
|
||||||
|
for _,anim in pairs(disableAnims) do
|
||||||
|
engineReplaceAnimation(ped,anim[1],anim[2],"insanity.animdisabler","CAR_dead_RHS")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onClientPlayerSpawn",root,function()
|
||||||
|
applyAnims(source)
|
||||||
|
end)
|
||||||
|
|
||||||
|
for _,player in pairs(getElementsByType("player")) do
|
||||||
|
applyAnims(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onClientPreRender",root,function()
|
||||||
|
for _,player in pairs(getElementsByType("player")) do
|
||||||
|
setPedAnimationSpeed(player,"CAR_dead_RHS",10)
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,4 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
<file src="CAR_dead_RHS.ifp"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,14 @@
|
||||||
|
local animSpeeds = {
|
||||||
|
{"CLIMB_jump",1.5},
|
||||||
|
{"CLIMB_jump_B",1.5},
|
||||||
|
{"CLIMB_Pull",1.5},
|
||||||
|
{"CLIMB_Stand",1.5}
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventHandler("onClientPreRender",root,function()
|
||||||
|
for _,player in pairs(getElementsByType("player")) do
|
||||||
|
for _,anim in pairs(animSpeeds) do
|
||||||
|
setPedAnimationSpeed(player,anim[1],anim[2])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="server.lua" type="server"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,46 @@
|
||||||
|
local weaponSlots = {0,1,2,3,4,5,6,7,8,9,10,11,12}
|
||||||
|
local skillMap = {}
|
||||||
|
skillMap[22] = 69
|
||||||
|
skillMap[23] = 70
|
||||||
|
skillMap[24] = 71
|
||||||
|
skillMap[25] = 72
|
||||||
|
skillMap[26] = 73
|
||||||
|
skillMap[27] = 74
|
||||||
|
skillMap[28] = 75
|
||||||
|
skillMap[29] = 76
|
||||||
|
skillMap[32] = 75
|
||||||
|
skillMap[30] = 77
|
||||||
|
skillMap[31] = 78
|
||||||
|
skillMap[33] = 79
|
||||||
|
skillMap[34] = 79
|
||||||
|
|
||||||
|
function setBaseSkill(player)
|
||||||
|
for _,sID in pairs(skillMap) do
|
||||||
|
setPedStat(player,sID,998)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onPlayerSpawn",root,function()
|
||||||
|
setBaseSkill(source)
|
||||||
|
end)
|
||||||
|
|
||||||
|
addEventHandler("onPickupUse",root,function(player)
|
||||||
|
local wep = getPickupWeapon(source)
|
||||||
|
if wep == false then return end
|
||||||
|
for _,slot in ipairs(weaponSlots) do
|
||||||
|
if getPedWeapon(player,slot) == wep then
|
||||||
|
if skillMap[wep] ~= nil then
|
||||||
|
setPedStat(player,skillMap[wep],1000)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if skillMap[wep] ~= nil then
|
||||||
|
setPedStat(player,skillMap[wep],998)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
for _,player in ipairs(getElementsByType("player")) do
|
||||||
|
setBaseSkill(player)
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
addEventHandler("onClientPlayerDamage",root,function(attacker,cause,bodypart,damage)
|
||||||
|
if source ~= localPlayer then return end
|
||||||
|
if cause ~= 54 then return end
|
||||||
|
if damage > 15 then return end
|
||||||
|
cancelEvent()
|
||||||
|
end)
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="server.lua" type="server"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,7 @@
|
||||||
|
local glitches = {"quickreload", "fastmove", "fastfire", "crouchbug", "highcloserangedamage", "fastsprint", "quickstand"}
|
||||||
|
|
||||||
|
addEventHandler("onResourceStart", resourceRoot, function()
|
||||||
|
for _, glitch in ipairs(glitches) do
|
||||||
|
setGlitchEnabled(glitch, true)
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,4 @@
|
||||||
|
<meta>
|
||||||
|
<script src="server.lua" type="server"/>
|
||||||
|
<script src="server.lua" type="client"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,8 @@
|
||||||
|
local grav = 0.006
|
||||||
|
function enforceGravity()
|
||||||
|
if getGravity() ~= grav then
|
||||||
|
setGravity(grav)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
setTimer(enforceGravity,1000,0)
|
Binary file not shown.
|
@ -0,0 +1,179 @@
|
||||||
|
local ifp = engineLoadIFP("GunMove_BWD.ifp","insanity.movement")
|
||||||
|
local rotSpeed = 0 -- 0 is instant - early and broken, do not use
|
||||||
|
local frametime = 33.3333
|
||||||
|
local aimOnly = false
|
||||||
|
|
||||||
|
function setResourceElementData(element,key,value,share)
|
||||||
|
if share == nil then share = true end
|
||||||
|
return setElementData(element,getResourceName(resource).. "." ..key,value,share)
|
||||||
|
end
|
||||||
|
|
||||||
|
function getResourceElementData(element,key)
|
||||||
|
return getElementData(element,getResourceName(resource).. "." ..key)
|
||||||
|
end
|
||||||
|
|
||||||
|
local weaponToSkillMap = {}
|
||||||
|
weaponToSkillMap[22] = 69
|
||||||
|
weaponToSkillMap[23] = 70
|
||||||
|
weaponToSkillMap[24] = 71
|
||||||
|
weaponToSkillMap[25] = 72
|
||||||
|
weaponToSkillMap[26] = 73
|
||||||
|
weaponToSkillMap[27] = 74
|
||||||
|
weaponToSkillMap[28] = 75
|
||||||
|
weaponToSkillMap[29] = 76
|
||||||
|
weaponToSkillMap[32] = 75
|
||||||
|
weaponToSkillMap[30] = 77
|
||||||
|
weaponToSkillMap[31] = 78
|
||||||
|
weaponToSkillMap[33] = 79
|
||||||
|
weaponToSkillMap[34] = 79
|
||||||
|
|
||||||
|
local weaponGangsterSkillLevels = {}
|
||||||
|
weaponGangsterSkillLevels[69] = 40
|
||||||
|
weaponGangsterSkillLevels[70] = 500
|
||||||
|
weaponGangsterSkillLevels[75] = 50
|
||||||
|
weaponGangsterSkillLevels[76] = 250
|
||||||
|
weaponGangsterSkillLevels[79] = 300
|
||||||
|
|
||||||
|
function getPedSkillLevel(ped,weapon)
|
||||||
|
local sID = weaponToSkillMap[weapon]
|
||||||
|
if sID == nil then return "pro" end
|
||||||
|
local skill = getPedStat(ped,sID)
|
||||||
|
if skill >= 999 then return "pro" end
|
||||||
|
local gangsterSkill = weaponGangsterSkillLevels[sID] or 200
|
||||||
|
if skill < gangsterSkill then return "poor" end
|
||||||
|
return "std"
|
||||||
|
end
|
||||||
|
|
||||||
|
function getPedDesiredRotation(ped,alwaysForward)
|
||||||
|
local crz = 360 - getPedCameraRotation(ped)
|
||||||
|
local right = getPedAnalogControlState(ped,"right") - getPedAnalogControlState(ped,"left")
|
||||||
|
local forward = getPedAnalogControlState(ped,"forwards") - getPedAnalogControlState(ped,"backwards")
|
||||||
|
local posRight = right
|
||||||
|
if posRight < 0 then posRight = 0 - posRight end
|
||||||
|
local posForward = forward
|
||||||
|
if posForward < 0 then posForward = 0 - posForward end
|
||||||
|
local div = posRight + posForward
|
||||||
|
if div == 0 then div = 1 end
|
||||||
|
|
||||||
|
if forward < 0 then
|
||||||
|
right = 0 - right
|
||||||
|
if not alwaysForward then
|
||||||
|
crz = crz + 180
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if crz > 360 then
|
||||||
|
crz = crz - 360
|
||||||
|
end
|
||||||
|
|
||||||
|
return crz + ((right * -90) / div)
|
||||||
|
end
|
||||||
|
|
||||||
|
function updateWeaponBackward(ped,st)
|
||||||
|
if st == getResourceElementData(ped,"weapon_backward") then return false end
|
||||||
|
if st then
|
||||||
|
engineReplaceAnimation(ped,"ped","run_player","insanity.movement","GunMove_BWD")
|
||||||
|
setResourceElementData(ped,"weapon_backward",true,false)
|
||||||
|
else
|
||||||
|
setPedAnimationSpeed(ped,"GunMove_BWD",1.0)
|
||||||
|
engineRestoreAnimation(ped,"ped","run_player")
|
||||||
|
setResourceElementData(ped,"weapon_backward",false,false)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function handlePed(ped)
|
||||||
|
local moveState = getPedMoveState(ped)
|
||||||
|
setPedAnimationSpeed(ped,"GunMove_BWD",2.0)
|
||||||
|
setPedAnimationSpeed(ped,"GunMove_FWD",2.0)
|
||||||
|
setPedAnimationSpeed(ped,"GunMove_L",2.0)
|
||||||
|
setPedAnimationSpeed(ped,"GunMove_R",2.0)
|
||||||
|
|
||||||
|
local task = getPedTask(ped,"primary",3)
|
||||||
|
if task == "TASK_COMPLEX_ENTER_CAR_AS_DRIVER" or task == "TASK_COMPLEX_ENTER_CAR_AS_PASSENGER" then return end
|
||||||
|
|
||||||
|
if
|
||||||
|
isPedDead(ped) or
|
||||||
|
moveState == "climb" or
|
||||||
|
isPedWearingJetpack(ped) or
|
||||||
|
getPedOccupiedVehicle(ped) or
|
||||||
|
(getPedControlState(ped,"aim_weapon") and ((
|
||||||
|
moveState == "crouch" or
|
||||||
|
moveState == "crawl"
|
||||||
|
) or (
|
||||||
|
(not getWeaponProperty(getPedWeapon(ped),getPedSkillLevel(ped,getPedWeapon(ped)),"flag_aim_arm")) or
|
||||||
|
getWeaponProperty(getPedWeapon(ped),getPedSkillLevel(ped,getPedWeapon(ped)),"flag_type_heavy")
|
||||||
|
))) or
|
||||||
|
getElementData(ped,"parachuting") or
|
||||||
|
getElementData(ped,"entering_vehicle")
|
||||||
|
then
|
||||||
|
updateWeaponBackward(ped,false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local forward = getPedAnalogControlState(ped,"forwards") - getPedAnalogControlState(ped,"backwards")
|
||||||
|
local turnInstantly = false
|
||||||
|
|
||||||
|
local rot = 0
|
||||||
|
local weaponBackward = false
|
||||||
|
local aiming = false
|
||||||
|
if getPedControlState(ped,"aim_weapon") and (
|
||||||
|
moveState == "stand" or
|
||||||
|
moveState == "walk" or
|
||||||
|
moveState == "powerwalk" or
|
||||||
|
moveState == "jog" or
|
||||||
|
moveState == "fall"
|
||||||
|
) then
|
||||||
|
aiming = true
|
||||||
|
if forward < 0 then
|
||||||
|
weaponBackward = true
|
||||||
|
turnInstantly = true
|
||||||
|
else
|
||||||
|
weaponBackward = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
weaponBackward = false
|
||||||
|
end
|
||||||
|
rot = getPedDesiredRotation(ped,weaponBackward)
|
||||||
|
local updated = updateWeaponBackward(ped,weaponBackward)
|
||||||
|
|
||||||
|
if aimOnly == true and aiming == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local prx,pry,prz = getElementRotation(ped)
|
||||||
|
if turnInstantly or rotSpeed == 0 then
|
||||||
|
prz = rot
|
||||||
|
else
|
||||||
|
local direction = 1
|
||||||
|
local diff = prz - rot
|
||||||
|
if diff < -1 then diff = 0 - diff end
|
||||||
|
if prz > rot then
|
||||||
|
direction = -1
|
||||||
|
end
|
||||||
|
if diff > 180 then
|
||||||
|
direction = direction * -1
|
||||||
|
end
|
||||||
|
|
||||||
|
prz = prz + ((rotSpeed * direction) * frametime)
|
||||||
|
--if prz < 0 then prz = prz + 360 end
|
||||||
|
--if prz > 360 then prz = prz - 360 end
|
||||||
|
if direction < 0 then
|
||||||
|
if prz < rot then
|
||||||
|
prz = rot
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if prz > rot then
|
||||||
|
prz = rot
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
setElementRotation(ped,prx,pry,prz,"default",true)
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onClientPreRender",root,function(slice)
|
||||||
|
frametime = slice
|
||||||
|
for _,ped in ipairs(getElementsByType("player")) do
|
||||||
|
handlePed(ped)
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,4 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
<file src="GunMove_BWD.ifp"/>
|
||||||
|
</meta>
|
Binary file not shown.
|
@ -0,0 +1,88 @@
|
||||||
|
local alwaysRoll = true
|
||||||
|
local ifp = engineLoadIFP("VRolling.ifp","insanity.roll")
|
||||||
|
local falling = 0
|
||||||
|
local fallingThreshold = 2000
|
||||||
|
|
||||||
|
function replaceAnims(ped)
|
||||||
|
engineReplaceAnimation(ped,"ped","FALL_collapse","insanity.roll","VRolling_Front")
|
||||||
|
end
|
||||||
|
|
||||||
|
function restoreAnims(ped)
|
||||||
|
engineRestoreAnimation(ped,"ped","FALL_collapse")
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onClientPlayerJoin",root,function()
|
||||||
|
replaceAnims(source)
|
||||||
|
end)
|
||||||
|
|
||||||
|
addEventHandler("onClientPlayerSpawn",root,function()
|
||||||
|
replaceAnims(source)
|
||||||
|
end)
|
||||||
|
|
||||||
|
addEventHandler("onClientElementStreamIn",root,function()
|
||||||
|
if getElementType(source) == "ped" then
|
||||||
|
replaceAnims(source)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
addEventHandler("onClientResourceStart",resourceRoot,function()
|
||||||
|
for _,ped in ipairs(getElementsByType("ped")) do
|
||||||
|
replaceAnims(ped)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,ped in ipairs(getElementsByType("player")) do
|
||||||
|
replaceAnims(ped)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
addEventHandler("onClientResourceStop",resourceRoot,function()
|
||||||
|
for _,ped in ipairs(getElementsByType("ped")) do
|
||||||
|
restoreAnims(ped)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,ped in ipairs(getElementsByType("player")) do
|
||||||
|
restoreAnims(ped)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if alwaysRoll then
|
||||||
|
addEventHandler("onClientPlayerDamage",root,function(attacker,damageType)
|
||||||
|
if damageType ~= 54 then return end
|
||||||
|
setPedAnimation(source,"insanity.roll","VRolling_Front",-1,false,true,false,false,0,true)
|
||||||
|
falling = 0
|
||||||
|
end)
|
||||||
|
|
||||||
|
addEventHandler("onClientPreRender",root,function(slice)
|
||||||
|
for _,ped in ipairs(getElementsByType("player")) do
|
||||||
|
setPedAnimationSpeed(localPlayer,"VRolling_Front",1.4)
|
||||||
|
if isPedWearingJetpack(localPlayer) then
|
||||||
|
falling = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if isPedDead(localPlayer) then
|
||||||
|
falling = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if isElementInWater(localPlayer) then
|
||||||
|
falling = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if getPedMoveState(localPlayer) == "fall" then
|
||||||
|
falling = falling + slice
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if getPedMoveState(localPlayer) ~= "climb" then
|
||||||
|
if falling > fallingThreshold then
|
||||||
|
setPedAnimation(localPlayer,"insanity.roll","VRolling_Front",-1,false,true,false,false,0,true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
falling = 0
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
<file src="VRolling.ifp"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="server.lua" type="server"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,7 @@
|
||||||
|
for _,player in ipairs(getElementsByType("player")) do
|
||||||
|
setPedWalkingStyle(player,69)
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onPlayerJoin",root,function()
|
||||||
|
setPedWalkingStyle(source,69)
|
||||||
|
end)
|
|
@ -0,0 +1,4 @@
|
||||||
|
<meta>
|
||||||
|
<min_mta_version server="1.3.5-9.06139" client="1.3.0-9.04555" />
|
||||||
|
<script src="server.lua" type="server"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,71 @@
|
||||||
|
local weaponBlacklist = {"grenade","teargas","molotov","sniper","rocket launcher","rocket launcher hs","flamethrower","satchel","bomb","spraycan","fire extinguisher","camera"}
|
||||||
|
local weaponBlacklistDualWield = {"minigun","rifle"}
|
||||||
|
|
||||||
|
local weapons = {"grenade","teargas","molotov","colt 45","silenced","deagle","shotgun","sawed-off","combat shotgun","uzi","mp5","ak-47","m4","tec-9","rifle","sniper","rocket launcher","rocket launcher hs","flamethrower","minigun","satchel","bomb","spraycan","fire extinguisher","camera"}
|
||||||
|
local weaponDefaultDualWield = {"colt 45","sawed-off","uzi","tec-9"}
|
||||||
|
local weaponSkills = {"poor","std","pro"}
|
||||||
|
local weaponProperties = {"weapon_range","target_range","accuracy","damage","maximum_clip_ammo","move_speed","anim_loop_start","anim_loop_stop","anim_loop_bullet_fire","anim2_loop_start","anim2_loop_stop","anim2_loop_bullet_fire","anim_breakout_time","flag_aim_no_auto","flag_aim_arm","flag_aim_1st_person","flag_aim_free","flag_move_and_aim","flag_move_and_shoot","flag_type_throw","flag_type_heavy","flag_type_constant","flag_type_dual","flag_anim_reload","flag_anim_crouch","flag_anim_reload_loop","flag_anim_reload_long","flag_shot_slows","flag_shot_rand_speed","flag_shot_anim_abrupt","flag_shot_expands"}
|
||||||
|
|
||||||
|
function isInList(haystack,needle)
|
||||||
|
for _,i in ipairs(haystack) do
|
||||||
|
if i == needle then return true end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,weapon in ipairs(weapons) do
|
||||||
|
if not isInList(weaponBlacklist,weapon) then
|
||||||
|
setJetpackWeaponEnabled(weapon,true)
|
||||||
|
for _,property in ipairs(weaponProperties) do
|
||||||
|
for _,skill in ipairs(weaponSkills) do
|
||||||
|
setWeaponProperty(weapon,skill,property,getOriginalWeaponProperty(weapon,"pro",property))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,skill in ipairs(weaponSkills) do
|
||||||
|
setWeaponProperty(weapon,skill,"flag_aim_arm",true)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not isInList(weaponBlacklistDualWield,weapon) then
|
||||||
|
setWeaponProperty(weapon,"pro","flag_type_dual",true)
|
||||||
|
setWeaponProperty(weapon,"pro","accuracy",getOriginalWeaponProperty(
|
||||||
|
weapon,"pro","accuracy") * 1.5)
|
||||||
|
setWeaponProperty(weapon,"pro","maximum_clip_ammo",getOriginalWeaponProperty(
|
||||||
|
weapon,"pro","maximum_clip_ammo") * 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _,skill in ipairs(weaponSkills) do
|
||||||
|
setWeaponProperty(weapon,skill,"flag_move_and_aim",true)
|
||||||
|
setWeaponProperty(weapon,skill,"flag_move_and_shoot",true)
|
||||||
|
setWeaponProperty(weapon,skill,"flag_type_heavy",false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,skill in ipairs(weaponSkills) do
|
||||||
|
setWeaponProperty("sniper",skill,"flag_type_heavy",true)
|
||||||
|
setWeaponProperty("rocket launcher",skill,"flag_type_heavy",true)
|
||||||
|
setWeaponProperty("rocket launcher hs",skill,"flag_type_heavy",true)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,weapon in ipairs(weaponDefaultDualWield) do
|
||||||
|
setWeaponProperty(weapon,"poor","flag_type_dual",false)
|
||||||
|
setWeaponProperty(weapon,"std","flag_type_dual",false)
|
||||||
|
setWeaponProperty(weapon,"poor","maximum_clip_ammo",getOriginalWeaponProperty(
|
||||||
|
weapon,"std","maximum_clip_ammo"))
|
||||||
|
setWeaponProperty(weapon,"std","maximum_clip_ammo",getOriginalWeaponProperty(
|
||||||
|
weapon,"std","maximum_clip_ammo"))
|
||||||
|
setWeaponProperty(weapon,"pro","maximum_clip_ammo",getOriginalWeaponProperty(
|
||||||
|
weapon,"pro","maximum_clip_ammo"))
|
||||||
|
end
|
||||||
|
|
||||||
|
addEventHandler("onResourceStop",resourceRoot,function()
|
||||||
|
for _,weapon in ipairs(weapons) do
|
||||||
|
if not isInList(weaponBlacklist,weapon) then
|
||||||
|
for _,property in ipairs(weaponProperties) do
|
||||||
|
for _,skill in ipairs(weaponSkills) do
|
||||||
|
setWeaponProperty(weapon,skill,property,getOriginalWeaponProperty(weapon,skill,property))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,95 @@
|
||||||
|
local responses = {}
|
||||||
|
responses[0] = {
|
||||||
|
0.5,0.5,0.8,
|
||||||
|
-0.2,-0.2,0.8
|
||||||
|
}
|
||||||
|
|
||||||
|
responses[80] = {
|
||||||
|
0.5,0.8,0.6,
|
||||||
|
0.0,0.0,0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
responses[120] = {
|
||||||
|
0.5,0.9,0.5,
|
||||||
|
0.0,0.0,0.6
|
||||||
|
}
|
||||||
|
|
||||||
|
--[[responses[200] = {
|
||||||
|
0.2,0.2,0.5,
|
||||||
|
0.2,0.2,0.5
|
||||||
|
}]]--
|
||||||
|
|
||||||
|
function getRatioWithin(v,st,ed)
|
||||||
|
if ed - st == 0 then return 1.0 end
|
||||||
|
return (v - st) / (ed - st)
|
||||||
|
end
|
||||||
|
|
||||||
|
function handleVehicle(veh)
|
||||||
|
local rvx,rvy,rvz = getVehicleTurnVelocity(veh)
|
||||||
|
if not getElementData(veh,"lastRvx") then
|
||||||
|
setElementData(veh,"lastRvx",rvx,false)
|
||||||
|
setElementData(veh,"lastRvy",rvy,false)
|
||||||
|
setElementData(veh,"lastRvz",rvz,false)
|
||||||
|
end
|
||||||
|
local lrvx = getElementData(veh,"lastRvx")
|
||||||
|
local lrvy = getElementData(veh,"lastRvy")
|
||||||
|
local lrvz = getElementData(veh,"lastRvz")
|
||||||
|
local offsetIndexX = 0
|
||||||
|
local offsetIndexY = 0
|
||||||
|
local offsetIndexZ = 0
|
||||||
|
if lrvx < 0 and rvx > lrvx then offsetIndexX = 3 end
|
||||||
|
if lrvx > 0 and rvx < lrvx then offsetIndexX = 3 end
|
||||||
|
if lrvy < 0 and rvy > lrvy then offsetIndexY = 3 end
|
||||||
|
if lrvy > 0 and rvy < lrvy then offsetIndexY = 3 end
|
||||||
|
if lrvz < 0 and rvz > lrvz then offsetIndexZ = 3 end
|
||||||
|
if lrvz > 0 and rvz < lrvz then offsetIndexZ = 3 end
|
||||||
|
|
||||||
|
local startProfile = false
|
||||||
|
local endProfile = false
|
||||||
|
local speed = getElementSpeed(veh,"km/h")
|
||||||
|
for targetSpeed,_ in pairs(responses) do
|
||||||
|
if startProfile == false then
|
||||||
|
if speed >= targetSpeed then startProfile = targetSpeed end
|
||||||
|
else
|
||||||
|
endProfile = targetSpeed
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if startProfile == false then startProfile = 0 end
|
||||||
|
if endProfile == false then endProfile = startProfile end
|
||||||
|
|
||||||
|
local ratio = getRatioWithin(speed,startProfile,endProfile)
|
||||||
|
if ratio > 1 then ratio = 1 end
|
||||||
|
local mvx = responses[startProfile][1 + offsetIndexX] + ((responses[endProfile][1 + offsetIndexX] - responses[startProfile][1 + offsetIndexX])*ratio)
|
||||||
|
local mvy = responses[startProfile][2 + offsetIndexY] + ((responses[endProfile][2 + offsetIndexY] - responses[startProfile][2 + offsetIndexY])*ratio)
|
||||||
|
local mvz = responses[startProfile][3 + offsetIndexZ] + ((responses[endProfile][3 + offsetIndexZ] - responses[startProfile][3 + offsetIndexZ])*ratio)
|
||||||
|
|
||||||
|
rvx = rvx + ((lrvx - rvx) * mvx)
|
||||||
|
rvy = rvy + ((lrvy - rvy) * mvy)
|
||||||
|
rvz = rvz + ((lrvz - rvz) * mvz)
|
||||||
|
setVehicleTurnVelocity(veh,rvx,rvy,rvz)
|
||||||
|
setElementData(veh,"lastRvx",rvx,false)
|
||||||
|
setElementData(veh,"lastRvy",rvy,false)
|
||||||
|
setElementData(veh,"lastRvz",rvz,false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function loop(ts)
|
||||||
|
for _,veh in ipairs(getElementsByType("vehicle")) do
|
||||||
|
handleVehicle(veh)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
addEventHandler("onClientPreRender",root,loop)
|
||||||
|
|
||||||
|
function getElementSpeed(theElement, unit)
|
||||||
|
-- Check arguments for errors
|
||||||
|
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
|
||||||
|
local elementType = getElementType(theElement)
|
||||||
|
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
|
||||||
|
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
|
||||||
|
-- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
|
||||||
|
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
|
||||||
|
-- Setup our multiplier to convert the velocity to the specified unit
|
||||||
|
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
|
||||||
|
-- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
|
||||||
|
return (Vector3(getElementVelocity(theElement)) * mult).length
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
</meta>
|
|
@ -0,0 +1,34 @@
|
||||||
|
local sx,sy = guiGetScreenSize()
|
||||||
|
local ss = dxCreateScreenSource(sx,sy)
|
||||||
|
function loop(ts)
|
||||||
|
if getPedOccupiedVehicle(localPlayer) then
|
||||||
|
dxUpdateScreenSource(ss)
|
||||||
|
local veh = getPedOccupiedVehicle(localPlayer)
|
||||||
|
local speed = getElementSpeed(veh)
|
||||||
|
local offsetX = math.round((math.random() - 1.5) * ((speed / 80) * (sx/1280)))
|
||||||
|
local offsetY = math.round((math.random() - 1.5) * ((speed / 80) * (sx/1280)))
|
||||||
|
dxDrawImage(offsetX,offsetY,sx,sy,ss)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
addEventHandler("onClientPreRender",root,loop)
|
||||||
|
|
||||||
|
function getElementSpeed(theElement, unit)
|
||||||
|
-- Check arguments for errors
|
||||||
|
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")")
|
||||||
|
local elementType = getElementType(theElement)
|
||||||
|
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
|
||||||
|
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
|
||||||
|
-- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number
|
||||||
|
unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit))
|
||||||
|
-- Setup our multiplier to convert the velocity to the specified unit
|
||||||
|
local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456)
|
||||||
|
-- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit
|
||||||
|
return (Vector3(getElementVelocity(theElement)) * mult).length
|
||||||
|
end
|
||||||
|
|
||||||
|
function math.round(num, decimals)
|
||||||
|
decimals = math.pow(10, decimals or 0)
|
||||||
|
num = num * decimals
|
||||||
|
if num >= 0 then num = math.floor(num + 0.5) else num = math.ceil(num - 0.5) end
|
||||||
|
return num / decimals
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
<meta>
|
||||||
|
<script src="client.lua" type="client"/>
|
||||||
|
</meta>
|
Loading…
Reference in New Issue