Wie kriege ich eine modulare hitbox hin?#
Kurze frage wie soll ich das umwandel sodass ich die ganzen funktionen von spielzeit etc. wegkriege
apro pro oben rechts ganz unten steht was mit gw anzeige wie stelle ich die auf permament? ich habs versucht aber es wurde zur eine entloschleife
Die drei datein sind vorhanden verlinkt inkl.
[spoiler=nonDLview]
Lua: gun_c.lua
damageImage = guiCreateStaticImage(0,0,1,1,"BLUTSCREEN.png",true)
guiSetAlpha ( damageImage, 0 )
guiSetEnabled ( damageImage, false )
FireingEnabled = false
function smokeAmmoHit ()
local x, y, z = getElementPosition ( source )
for a = -2, 2 do
for b = -2, 2 do
for c = -2, 2 do
fxAddTyreBurst ( x + a * 0.15, y + b * 0.15, z + c * 0.15, 0, 0, 0 )
end
end
end
end
addEvent ( "smokeAmmoHit", true )
addEventHandler ( "smokeAmmoHit", getRootElement(), smokeAmmoHit )
weaponDamages = {}
weaponDamages[8] = 35
weaponDamages[22] = 10
weaponDamages[23] = 10
weaponDamages[24] = 25
weaponDamages[25] = 20
weaponDamages[28] = 5
weaponDamages[29] = 8
weaponDamages[32] = 5
weaponDamages[30] = 6
weaponDamages[31] = 8
weaponDamages[33] = 15
weaponDamages[34] = 50
weaponDamages[51] = 10
semiAutomatic = {}
semiAutomatic[22] = true
semiAutomatic[23] = true
semiAutomatic[24] = true
semiAutomatic[33] = true
semiAutomatic[34] = true
function cancelAllDamage ( attacker, weapon, bodypart, loss )
if weapon == 42 then
cancelEvent()
return
end
if attacker == lp then
if not ( weapon == 17 and getElementModel ( source ) == 285 ) then
if attacker and weapon and bodypart and loss then
if weaponDamages[weapon] and weaponsWithSpeacialAmmo[weapon] then
triggerServerEvent ( "damageCalcServer", lp, attacker, weapon, bodypart, loss, source )
end
end
end
elseif lp == source then
showBloodFlash ()
if attacker and weapon and bodypart and loss then
if weaponDamages[weapon] then
cancelEvent ()
end
end
end
end
addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelAllDamage )
function chokecheck ( weapon, player )
if source == lp then
if getElementModel ( source ) == 285 then
cancelEvent()
end
end
end
addEventHandler ( "onClientPlayerChoke", getRootElement(), chokecheck )
function onPlayerDamage ( attacker, weapon, bodypart, loss )
if source == lp then
if not getElementData ( source, "isInHighNoon" ) and not isPedDead ( source ) then
end
if attacker then
local x, y, z = getElementPosition ( source )
if getDistanceBetweenPoints3D ( x, y, z, -2458.288085, 774.354492, 35.171875 ) <= 20 then
cancelEvent()
else
if weapon == 39 then
setElementHealth ( source, getElementHealth ( source ) - loss * 2 )
end
end
end
end
end
addEventHandler ( "onClientPlayerDamage", getRootElement(), onPlayerDamage )
function showBloodFlash ()
guiSetEnabled ( damageImage, true )
if isTimer ( bloodTimer ) then
killTimer ( bloodTimer )
end
bloodTimer = setTimer ( bloodFlash, 50, -1 )
guiSetAlpha ( damageImage, 1 )
end
function bloodFlash()
alpha = guiGetAlpha ( damageImage )
if alpha == 0 then
killTimer ( bloodTimer )
guiSetEnabled ( damageImage, false )
else
guiSetAlpha ( damageImage, alpha - 0.1 )
end
end
---REDDOT---
function reddot_func ()
if not reddotEnabled then
reddotEnabled = true
addEventHandler ( "onClientRender", getRootElement(), reddot_render )
outputChatBox ( "Du hast das Rotpunktvisier aktiviert!")
else
reddotEnabled = false
removeEventHandler ( "onClientRender", getRootElement(), reddot_render )
outputChatBox ( "Du hast das Rotpunktvisier deaktiviert!")
end
end
addCommandHandler ( "reddot", reddot_func )
fireWeaponSlots = {
[2]=true,
[3]=true,
[4]=true,
[5]=true,
[6]=true,
[7]=true
}
function reddot_render ()
if fireWeaponSlots[getPedWeaponSlot ( lp )] then
if getPedControlState ( lp, "aim_weapon" ) then
local x1, y1, z1 = getPedWeaponMuzzlePosition ( lp )
x1 = x1 + 0.01
y1 = y1 + 0.01
z1 = z1 + 0.01
local x2, y2, z2 = getPedTargetEnd ( lp )
local x3,y3,z3 = getPedTargetCollision ( lp )
if x3 then
dxDrawLine3D ( x1, y1, z1, x3, y3, z3, tocolor ( 200, 0, 0, 200 ), 4, false )
else
dxDrawLine3D ( x1, y1, z1, x2, y2, z2, tocolor ( 200, 0, 0, 200 ), 4, false )
end
end
end
end
----------GW DAMAGE ANZEIGE----------
local width, height = guiGetScreenSize ( )
local target
local targetname
local weapon
local bodypart
local loss
local bodypartname
function DamageText_GW ()
if bodypart == 3 then
bodypartname = "Oberkoerper"
elseif bodypart == 4 then
bodypartname = "Hintern"
elseif bodypart == 5 then
bodypartname = "Linker Arm"
elseif bodypart == 6 then
bodypartname = "Rechter Arm"
elseif bodypart == 7 then
bodypartname = "Linkes Bein"
elseif bodypart == 8 then
bodypartname = "Rechtes Bein"
elseif bodypart == 9 then
bodypartname = "Kopf"
else
bodypartname = ""
end
local text = ""..targetname..", "..loss.." Schaden, "..bodypartname.." "
-- Schatten
dxDrawText ( text, width/2, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "default-bold" )
-- Text
dxDrawText ( text, width/2, height - 43, width, height, tocolor ( 255, 255, 255, 255 ), 1, "default-bold" )
end
function DamageText_GW_Rendering_func ( targetS, weaponS, bodypartS, lossS )
if getElementData (lp, "DamageText") == true then
stop_DamageText_func()
killTimer(DamageText_Timer)
end
addEventHandler ( "onClientRender", getRootElement(), DamageText_GW ) -- Sichtbarkeit ausführen
target = source
targetname = targetS
weapon = weaponS
bodypart = bodypartS
loss = math.round(lossS, 1)
DamageText_Timer = setTimer ( stop_DamageText_func, 5000, 1 )
setElementData (lp, "DamageText", true)
playSoundFrontEnd ( 32 )
end
addEvent ("DamageText_GW_Rendering", true )
addEventHandler ("DamageText_GW_Rendering", getRootElement(), DamageText_GW_Rendering_func )
function stop_DamageText_func ()
removeEventHandler ( "onClientRender", getRootElement(), DamageText_GW )
setElementData (lp, "DamageText", false)
end
Alles anzeigen
Lua: dmgsysserver.lua
local weaponDamages = {}
weaponDamages[8] = 35
weaponDamages[22] = 10
weaponDamages[23] = 10
weaponDamages[24] = 25
weaponDamages[25] = 20
weaponDamages[28] = 5
weaponDamages[29] = 8
weaponDamages[32] = 5
weaponDamages[30] = 6
weaponDamages[31] = 8
weaponDamages[33] = 15
weaponDamages[34] = 50
weaponDamages[51] = 40
local semiAutomatic = {}
semiAutomatic[22] = true
semiAutomatic[23] = true
semiAutomatic[24] = true
semiAutomatic[33] = true
semiAutomatic[34] = true
function damageCalcServer_func ( attacker, weapon, bodypart, loss, player )
if attacker and weapon and bodypart and loss then
---SPAWNSCHUTZ---
if not getElementData ( attacker, "spawnProtection" ) and not getElementData (player, "spawnProtection" ) and getElementType ( player ) == "player" then
---SPIELZEIT---
if getElementData ( attacker, "playingtime" ) > 180 and getElementData (player, "playingtime" ) > 180 then
if getElementData (player, "jailtime" ) == 0 then
local ammoTyp = westsideGetElementData ( attacker, "curAmmoTyp" )
if weapon == 34 and bodypart == 9 and ammoTyp ~= 5 then
setPedHeadless ( player, true )
killPed ( player, attacker, weapon, bodypart )
else
local basicDMG = weaponDamages[weapon]
local dontDealDamage = false
if rangedWeapons[getPedWeapon ( attacker )] then
if ammoTyp and ammoTyp > 0 then
if ammoTyp == 1 and westsideGetElementData ( attacker, "ammoTyp1" ) then
if not getPedOccupiedVehicle (player ) then
setPedOnFire (player, true )
setTimer ( setPedOnFire, 350, 1,player, false )
end
elseif ammoTyp == 2 and westsideGetElementData ( attacker, "ammoTyp2" ) then
if getPedArmor ( player ) == 0 then
basicDMG = basicDMG * 1.3
end
elseif ammoTyp == 3 and westsideGetElementData ( attacker, "ammoTyp3" ) then
if getPedArmor ( player ) > 0 then
basicDMG = basicDMG * 1.3
end
elseif ammoTyp == 4 and semiAutomatic[weapon] and westsideGetElementData ( attacker, "ammoTyp4" ) then
dontDealDamage = true
elseif ammoTyp == 5 and westsideGetElementData ( attacker, "ammoTyp5" ) then
if westsideGetElementData ( player, "hitByChokeAmmo" ) then
killTimer ( westsideGetElementData ( player, "stopChokeTimer" ) )
end
setPedChoking ( player, true )
westsideSetElementData ( player, "hitByChokeAmmo", true )
triggerClientEvent ( player, "smokeAmmoHit", player )
triggerClientEvent ( attacker, "smokeAmmoHit", player )
local stopChokeTimer = setTimer (
function ( player )
if westsideGetElementData ( player, "hitByChokeAmmo" ) then
westsideSetElementData ( player, "hitByChokeAmmo", false )
setPedChoking ( player, false )
end
end,
1000, 1, player )
westsideSetElementData ( player, "stopChokeTimer", stopChokeTimer )
dontDealDamage = true
elseif ammoTyp == 6 and westsideGetElementData ( attacker, "ammoTyp6" ) then
setPedHeadless ( player, true )
dontDealDamage = true
setTimer (
function ( playerid )
setPedHeadless ( playerid, false )
end,
600000, 1, player )
end
end
end
if not dontDealDamage then
if weapon == 0 then
if getPedFightingStyle ( attacker ) == 7 or getPedFightingStyle ( attacker ) == 15 or getPedFightingStyle ( attacker ) == 16 then
loss = loss / 2
end
end
local multiply = 1
if bodypart == 3 or bodypart == 4 then
multiply = 1.5
elseif bodypart == 5 or bodypart == 6 then
multiply = 0.8
elseif bodypart == 7 or bodypart == 8 then
multiply = 1.2
elseif bodypart == 9 then
multiply = 2
end
if ( weaponDamages[weapon] ) then
damagePlayer ( player, basicDMG * multiply, attacker, weapon )
local aval = basicDMG * multiply
else
damagePlayer ( player, loss, attacker, weapon )
end
if bodypart == 2 then
headlessPed ( player )
end
if attacker then
westsideSetElementData ( attacker, "lastcrime", "violance" )
end
end
if not westsideGetElementData ( attacker, "curAmmoTyp" ) then
else
if westsideGetElementData ( attacker, "curAmmoTyp" ) ~= 0 then
if gangAreaUnderAttack and gangAreaAttackers and gangAreaDefenders then
local facu = getPlayerFaction ( attacker )
if facu == gangAreaAttackers or gangAreaDefenders == facu then
outputChatBox ("Kick: "..getPlayerName ( attacker ).." wurde von Konsole gekickt! (Grund: Spezialmunition beim GW)", getRootElement(), 255, 0, 0 )
kickPlayer ( attacker, "Von: Konsole, Grund: Spezialmunition beim Gangwar" )
end
end
end
end
end
end
end
end
end
end
addEvent ( "damageCalcServer", true )
addEventHandler ( "damageCalcServer", getRootElement(), damageCalcServer_func )
function specialBulletWeaponFire ( weapon, ammo, ammoInClip, x, y, z, hit )
local player = client
local ammoTyp = getElementData ( player, "curAmmoTyp" )
if ammoTyp > 0 then
local amount = getElementData ( player, "ammoTyp"..ammoTyp )
if amount > 0 then
giveWeapon ( player, weapon, 1 )
if ammoTyp == 4 then
createExplosion ( x, y, z, 12, player )
end
getElementData ( player, "ammoTyp"..ammoTyp, amount - 1 )
if getElementData ( player, "ammoTyp"..ammoTyp ) == 0 then
getElementData ( player, "ammoTyp", 0 )
end
end
end
end
addEvent ( "specialBulletWeaponFire", true )
addEventHandler ( "specialBulletWeaponFire", getRootElement(), specialBulletWeaponFire )
function headlessPed ( player )
if isPedDead ( player ) then
setPedHeadless ( player, true )
end
end
addEventHandler ( "onPlayerSpawn", getRootElement(),
function ()
getElementData ( source, "spawnProtection", true )
setTimer ( getElementData, 10000, 1, source, "spawnProtection", false )
end
)
--if playerData[client] and playerData[client]["imGW"] and getElementData ( player, "fraktion" ) ~= getElementData ( client, "fraktion" ) and getElementType ( player ) == "player" then
-- playerData[client]["damage"] = playerData[client]["damage"] + basicDMG
-- playerData[player]["hatDMGbekommen"] = client
-- triggerClientEvent ( client, "rechneDMGAn", client, basicDMG )
-- getElementData ( player, "lasthp", fulllife-basicDMG )
-- end
Alles anzeigen
Need help wtf?