Combreal icon

AntiVehicleCamp

Combreal | PRO | 01/28/14 12:44:38 PM UTC | 0 ⭐ | 1313 👁️ | Never ⏰ | []
Lua |

7.34 KB

|

None

|

0 👍

/

0 👎

-- Anti vehicles Camp - inspired from Eliteprime, Wizard, Shaft and Bugs's works --
                        -- Whith the great help of A§H»Wizard --
 
playerRunoverCounter = {}
playerGbCounter = {}
playerBbCounter = {}
playerTbCounter = {}
playerBfCounter = {}
playerTsCounter = {}
 
playerIsHit = {}
playerIsHita = {}
playerIsHitb = {}
playerIsHitc = {}
playerIsHitd = {}
playerIsHite = {}
 
survivesro = 3  -- The player will die twice before surviving by runovers
survivesgb = 5  -- The player will die four times before surviving by ghost bolts
survivesbb = 5  -- The player will die four times before surviving by banshee bolts
survivestb = 5  -- The player will die four times before surviving by tank bullets
survivesbf = 3  -- The player will die twice before surviving by banshee fuel rod
survivests = 3  -- The player will die twice before surviving by tank shell
 
function GetRequiredVersion()
    return 200
end
 
 
function OnScriptLoad(processid, game, persistent)end
 
function OnNewGame(map)
        -- Vehicles
    banshee_tag_id = gettagid("vehi", "vehicles\\banshee\\banshee_mp")
    turret_tag_id = gettagid("vehi", "vehicles\\c gun turret\\c gun turret_mp")
    ghost_tag_id = gettagid("vehi", "vehicles\\ghost\\ghost_mp")
    rwarthog_tag_id = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
    tank_tag_id = gettagid("vehi", "vehicles\\scorpion\\scorpion_mp")
    warthog_tag_id = gettagid("vehi", "vehicles\\warthog\\mp_warthog")
 
        -- Weapons
    assaultrifle_tag_id = gettagid("weap", "weapons\\assault rifle\\assault rifle")
    oddball_tag_id = gettagid("weap", "weapons\\ball\\ball")
    flag_tag_id = gettagid("flag", "weap", "weapons\\flag\\flag")
    flamethrower_tag_id = gettagid("weap", "weapons\\flamethrower\\flamethrower")
    needler_tag_id = gettagid("weap", "weapons\\needler\\mp_needler")
    pistol_tag_id = gettagid("weap", "weapons\\pistol\\pistol")
    plasmapistol_tag_id = gettagid("weap", "weapons\\plasma pistol\\plasma pistol")
    plasmarifle_tag_id = gettagid("weap", "weapons\\plasma rifle\\plasma rifle")
    plasmacannon_tag_id = gettagid("weap", "weapons\\plasma_cannon\\plasma_cannon")
    rocketlauncher_tag_id = gettagid("weap", "weapons\\rocket launcher\\rocket launcher")
    shotgun_tag_id = gettagid("weap", "weapons\\shotgun\\shotgun")
    sniper_tag_id = gettagid("weap", "weapons\\sniper rifle\\sniper rifle")
 
        -- Projectiles
    bansheebolt_tag_id = gettagid("proj", "vehicles\\banshee\\banshee bolt")
    bansheeblast_tag_id = gettagid("proj", "vehicles\\banshee\\mp_banshee fuel rod")
    turretfire_tag_id = gettagid("proj", "vehicles\\c gun turret\\mp gun turret")
    ghostbolt_tag_id = gettagid("proj", "vehicles\\ghost\\ghost bolt")
    tankshot_tag_id = gettagid("proj", "vehicles\\scorpion\\bullet")
    tankblast_tag_id = gettagid("proj", "vehicles\\scorpion\\shell shock wave")
    warthogshot_tag_id = gettagid("proj", "vehicles\\warthog\\bullet")
    rifleshot_tag_id = gettagid("proj", "weapons\\assault rifle\\bullet")
    flame_tag_id = gettagid("proj", "weapons\\flamethrower\\flame")
    needlerfire_tag_id = gettagid("proj", "weapons\\needler\\mp_needle")
    pistolshot_tag_id = gettagid("proj", "weapons\\pistol\\bullet")
    plasmapistolbolt_tag_id = gettagid("proj", "weapons\\plasma pistol\\bolt")
    plasmariflebolt_tag_id = gettagid("proj", "weapons\\plasma rifle\\bolt")
    plasmarifleblast_tag_id = gettagid("proj", "weapons\\plasma rifle\\charged bolt")
    rocket_tag_id = gettagid("proj", "weapons\\rocket launcher\\rocket")
    shotgunshot_tag_id = gettagid("proj", "weapons\\shotgun\\pellet")
    snipershot_tag_id = gettagid("proj", "weapons\\sniper rifle\\sniper bullet")
        -- Globals
    global_distanceId = gettagid("jpt!", "globals\\distance")
    global_fallingId = gettagid("jpt!", "globals\\falling")
    global_vehiCollId = gettagid("jpt!", "globals\\vehicle_collision")
end
 
function OnDamageLookup(receiving, causing, mapId, tagdata)
    if causing and receiving then
        local c_player = objectidtoplayer(causing)
        local r_player = objectidtoplayer(receiving)
        if c_player and r_player and isinvehicle(c_player) then
            if not isinvehicle(r_player) then
                local mapId == global_vehiCollId then
                    if not playerIsHit[r_player] then
                        if not playerRunoverCounter[r_player] then playerRunoverCounter[r_player] = 0 end
                        playerRunoverCounter[r_player] = playerRunoverCounter[r_player] + 1
                        if playerRunoverCounter[r_player] >= survivesro then
                            return false
                        else
                            playerIsHit[r_player] = true
                            registertimer(1000, "Alrdycrashed", r_player)
                        end
                    end
                elseif dmg == ghostbolt_tag_id then
                    if not playerIsHita[r_player] then
                        if not playerGbCounter[r_player] then playerGbCounter[r_player] = 0 end
                        playerGb[r_player] = playerGbCounter[r_player] + 1
                        if playerGb[r_player] >= survivesgb then
                            return false
                        else
                            playerIsHita[r_player] = true
                            registertimer(1000, "Alrdyghostbolted", r_player)
                        end
                    end
                elseif dmg == bansheebolt_tag_id then
                    if not playerIsHitb[r_player] then
                        if not playerBbCounter[r_player] then playerBbCounter[r_player] = 0 end
                        playerBbCounter[r_player] = playerBbCounter[r_player] + 1
                        if playerBbCounter[r_player] >= survivesbb then
                            return false
                        else
                            playerIsHitb[r_player] = true
                            registertimer(1000, "Alrdybansheebolted", r_player)
                        end
                    end
                elseif dmg == tankshot_tag_id then
                    if not playerIsHitc[r_player] then
                        if not playerTbCounter[r_player] then playerTbCounter[r_player] = 0 end
                        playerTbCounter[r_player] = playerTbCounter[r_player] + 1
                        if playerTbCounter[r_player] >= survivestb then
                            return false
                        else
                            playerIsHitc[r_player] = true
                            registertimer(1000, "Alrdytankbulleted", r_player)
                        end
                    end
                elseif dmg == bansheeblast_tag_id then
                    if not playerIsHitd[r_player] then
                        if not playerBfCounter[r_player] then playerBfCounter[r_player] = 0 end
                        playerBfCounter[r_player] = playerBfCounter[r_player] + 1
                        if playerBfCounter[r_player] >= survivesbf then
                            return false
                        else
                            playerIsHitd[r_player] = true
                            registertimer(1000, "Alrdybansheefueled", r_player)
                        end
                    end
                elseif dmg == bansheeblast_tag_idthen
                    if not playerIsHite[r_player] then
                        if not playerTsCounter[r_player] then playerTsCounter[r_player] = 0 end
                        playerTsCounter[r_player] = playerTsCounter[r_player] + 1
                        if playerTsCounter[r_player] >= survivests then
                            return false
                        else
                            playerIsHite[r_player] = true
                            registertimer(1000, "Alrdytankshelled", r_player)
                        end
                    end
                end
            end
        end
    end
    return true
end
 
function getplayervehicleid(player)
    local m_objectId = getplayerobjectid(player)
    if m_objectId then return readdword(getobject(m_objectId) + 0x11C) end
end
 
 
function Alrdycrashed(id, count, player)
    playerIsHit[player] = nil
    return false
end
 
function Alrdyghostbolted(id, count, player)
    playerIsHita[player] = nil
    return false
end
 
function Alrdybansheebolted(id, count, player)
    playerIsHitb[player] = nil
    return false
end
 
function Alrdytankbulleted(id, count, player)
    playerIsHitc[player] = nil
    return false
end
 
function Alrdybansheefueled(id, count, player)
    playerIsHitd[player] = nil
    return false
end
 
function Alrdytankshelled(id, count, player)
    playerIsHite[player] = nil
    return false
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎