Jump to content

Taser again -.-


Best-Killer

Recommended Posts

--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Taser' - resource for MTA: San Andreas                     ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
local player = getElementsByType ( "player" ) 
local cFunc = {} 
local cSetting = {} 
  
cSetting["shots"] = {} 
cSetting["shot_calcs"] = {} 
local last_shot = 1 
local a = cop 
-- FUNCTIONS -- 
  
cFunc["render_shots"] = function() 
    for index, tbl in pairs(cSetting["shots"]) do 
        HitCoord(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0)) 
    end 
end 
  
cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) 
    table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) 
    -- SHOT CALCULATING 
  
    local lastx, lasty, lastz = x1, y1, z1 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    cSetting["shot_calcs"][last_shot] = {} 
    
    for i = 1, dis, 0.5 do 
    --  cSetting["shot_calcs"][i] = nx, ny, nz 
    --  cSetting["shot_calcs"][last_shot][i] = 
    end 
    last_shot = last_shot+1 
end 
  
cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z) 
    if ( exports.SAEGPlayerFunctions:isTeamLaw (getPlayerTeam(getLocalPlayer()))) then 
    playSound3D("data/Fire.wav", x, y, z) 
    local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ) 
    setSoundMaxDistance(s, 50) 
    for i = 1, 5, 1 do 
        fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0) 
        fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1) 
    end 
    cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ) 
    fxAddPunchImpact(x, y, z, 0, 0, -3) 
end 
end 
  
cFunc["wait_shot"] = function() 
    toggleControl("fire", false) 
    setTimer(function() 
        toggleControl("fire", true) 
    end, 350, 1) 
end 
  
cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) 
    if(wp == 23) and ( exports.SAEGPlayerFunctions:isTeamLaw (getPlayerTeam(getLocalPlayer()))) then 
        cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) 
        if(source == localPlayer) then 
            cFunc["wait_shot"]() 
        end 
    end 
    end 
  
HitCoord = function(x1, y1, z1, x2, y2, z2, color) 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    local lastx, lasty, lastz = x1, y1, z1 
    --for i = 1, dis, 3 do 
    --  dxDrawLine3D(x1, y1, z1, x2, y2, z2) 
    --end 
end 
  
cFunc["anim_check"] = function(_, wep, bodypart) 
local t = getPlayerTeam () 
if ( exports.SAEGPlayerFunctions:isTeamLaw (getPlayerTeam(getLocalPlayer()))) then 
    if(wep == 23)  and (bodypart == 9) then 
        setPedAnimation(source, "ped", "KO_shot_face", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 7) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 4) then 
        setPedAnimation(source, "CRACK", "crckdeth3", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 3) then 
        setPedAnimation(source, "ped", "KO_shot_stom", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 2) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 1) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
 end 
end 
end 
  
-- EVENT HANDLER -- 
  
addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) 
addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"]) 
addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) 
addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) 

80/62 call : failed to call SAEGPlayerFunctions:isTeamLaw' STRING "?"

Link to comment
--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Taser' - resource for MTA: San Andreas                     ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
local player = getElementsByType ( "player" ) 
local cFunc = {} 
local cSetting = {} 
  
cSetting["shots"] = {} 
cSetting["shot_calcs"] = {} 
local last_shot = 1 
local a = cop 
-- FUNCTIONS -- 
  
cFunc["render_shots"] = function() 
    for index, tbl in pairs(cSetting["shots"]) do 
        HitCoord(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0)) 
    end 
end 
  
cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) 
    table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) 
    -- SHOT CALCULATING 
  
    local lastx, lasty, lastz = x1, y1, z1 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    cSetting["shot_calcs"][last_shot] = {} 
    
    for i = 1, dis, 0.5 do 
    --  cSetting["shot_calcs"][i] = nx, ny, nz 
    --  cSetting["shot_calcs"][last_shot][i] = 
    end 
    last_shot = last_shot+1 
end 
  
  
cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z) 
 local t = getPlayerTeam(getLocalPlayer()) 
    if ( exports.SAEGPlayerFunctions:isTeamLaw (getTeamName (t))) then 
    playSound3D("data/Fire.wav", x, y, z) 
    local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ) 
    setSoundMaxDistance(s, 50) 
    for i = 1, 5, 1 do 
        fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0) 
        fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1) 
    end 
    cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ) 
    fxAddPunchImpact(x, y, z, 0, 0, -3) 
end 
end 
  
cFunc["wait_shot"] = function() 
    toggleControl("fire", false) 
    setTimer(function() 
        toggleControl("fire", true) 
    end, 350, 1) 
end 
  
cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) 
    if(wp == 23) and ( exports.SAEGPlayerFunctions:isTeamLaw (getPlayerTeam(getLocalPlayer()))) then 
        cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) 
        if(source == localPlayer) then 
            cFunc["wait_shot"]() 
        end 
    end 
    end 
  
HitCoord = function(x1, y1, z1, x2, y2, z2, color) 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    local lastx, lasty, lastz = x1, y1, z1 
    --for i = 1, dis, 3 do 
    --  dxDrawLine3D(x1, y1, z1, x2, y2, z2) 
    --end 
end 
  
cFunc["anim_check"] = function(_, wep, bodypart) 
local t = getPlayerTeam(getLocalPlayer()) 
if ( exports.SAEGPlayerFunctions:isTeamLaw (getTeamName (t))) then 
    if(wep == 23)  and (bodypart == 9) then 
        setPedAnimation(source, "ped", "KO_shot_face", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 7) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 4) then 
        setPedAnimation(source, "CRACK", "crckdeth3", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 3) then 
        setPedAnimation(source, "ped", "KO_shot_stom", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 2) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 1) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
 end 
end 
end 
  
-- EVENT HANDLER -- 
  
addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) 
addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"]) 
addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) 
addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) 

Link to comment

New Code :

--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Taser' - resource for MTA: San Andreas                     ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
  
local cFunc = {} 
local cSetting = {} 
  
cSetting["shots"] = {} 
cSetting["shot_calcs"] = {} 
local last_shot = 1 
-- FUNCTIONS -- 
PoliceTeam = {["Law Enforcement"] = true} 
  
cFunc["render_shots"] = function() 
    for index, tbl in pairs(cSetting["shots"]) do 
        HitCoord(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0)) 
    end 
end 
  
cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) 
    table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) 
    -- SHOT CALCULATING 
  
    local lastx, lasty, lastz = x1, y1, z1 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    cSetting["shot_calcs"][last_shot] = {} 
    
    for i = 1, dis, 0.5 do 
    --  cSetting["shot_calcs"][i] = nx, ny, nz 
    --  cSetting["shot_calcs"][last_shot][i] = 
    end 
    last_shot = last_shot+1 
end 
  
cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z) 
if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
if PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
    playSound3D("data/Fire.wav", x, y, z) 
    local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ) 
    setSoundMaxDistance(s, 50) 
    for i = 1, 5, 1 do 
        fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0) 
        fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1) 
    end 
    cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ) 
    fxAddPunchImpact(x, y, z, 0, 0, -3) 
end 
end 
  
cFunc["wait_shot"] = function() 
    toggleControl("fire", false) 
    setTimer(function() 
        toggleControl("fire", true) 
    end, 350, 1) 
end 
  
cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) 
    if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
    if(wp == 23) and PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
        cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) 
        if(source == localPlayer) then 
            cFunc["wait_shot"]() 
        end 
    end 
end 
  
HitCoord = function(x1, y1, z1, x2, y2, z2, color) 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    local lastx, lasty, lastz = x1, y1, z1 
    --for i = 1, dis, 3 do 
    --  dxDrawLine3D(x1, y1, z1, x2, y2, z2) 
    --end 
end 
  
cFunc["anim_check"] = function(_, wep, bodypart) 
if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
if PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
    if(wep == 23)  and (bodypart == 9) then 
        setPedAnimation(source, "ped", "KO_shot_face", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 7) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 4) then 
        setPedAnimation(source, "CRACK", "crckdeth3", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 3) then 
        setPedAnimation(source, "ped", "KO_shot_stom", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 2) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 1) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
 end 
end 
end 
  
-- EVENT HANDLER -- 
  
addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) 
addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"]) 
addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) 
addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) 

but other players can use taser too pls help

Link to comment

With that code :

--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Taser' - resource for MTA: San Andreas                     ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
  
local cFunc = {} 
local cSetting = {} 
  
cSetting["shots"] = {} 
cSetting["shot_calcs"] = {} 
local last_shot = 1 
-- FUNCTIONS -- 
PoliceTeam = {["Law Enforcement"] = true} 
  
cFunc["render_shots"] = function() 
    for index, tbl in pairs(cSetting["shots"]) do 
        HitCoord(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0)) 
    end 
end 
  
cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) 
    table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) 
    -- SHOT CALCULATING 
  
    local lastx, lasty, lastz = x1, y1, z1 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    cSetting["shot_calcs"][last_shot] = {} 
    
    for i = 1, dis, 0.5 do 
    --  cSetting["shot_calcs"][i] = nx, ny, nz 
    --  cSetting["shot_calcs"][last_shot][i] = 
    end 
    last_shot = last_shot+1 
end 
  
cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z) 
if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
if PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
    playSound3D("data/Fire.wav", x, y, z) 
    local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ) 
    setSoundMaxDistance(s, 50) 
    for i = 1, 5, 1 do 
        fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0) 
        fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1) 
    end 
    cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ) 
    fxAddPunchImpact(x, y, z, 0, 0, -3) 
end 
end 
  
cFunc["wait_shot"] = function() 
    toggleControl("fire", false) 
    setTimer(function() 
        toggleControl("fire", true) 
    end, 350, 1) 
end 
  
cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) 
    if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
    if(wp == 23) and PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
        cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) 
        if(source == localPlayer) then 
            cFunc["wait_shot"]() 
        end 
    end 
end 
  
HitCoord = function(x1, y1, z1, x2, y2, z2, color) 
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) 
    local lastx, lasty, lastz = x1, y1, z1 
    --for i = 1, dis, 3 do 
    --  dxDrawLine3D(x1, y1, z1, x2, y2, z2) 
    --end 
end 
  
cFunc["anim_check"] = function(_, wep, bodypart) 
if not PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then return end 
if PoliceTeam[getTeamName(getPlayerTeam(getLocalPlayer( )))] then 
    if(wep == 23)  and (bodypart == 9) then 
        setPedAnimation(source, "ped", "KO_shot_face", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 7) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 4) then 
        setPedAnimation(source, "CRACK", "crckdeth3", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 3) then 
        setPedAnimation(source, "ped", "KO_shot_stom", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 2) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
    elseif(wep == 23)  and (bodypart == 1) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) 
 end 
end 
end 
  
-- EVENT HANDLER -- 
  
addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) 
addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"]) 
addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) 
addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"]) 

if i'm in police team and you're criminal i can tass you (work fine)

if i'm in police team and you're criminal you can tass me (On)

I want :

if i'm in police team and you're criminal you can tass me (Off)

Link to comment

if i'm in police team and you're criminal i can tass you (work fine)

if i'm in police team and you're criminal you can tass me (On)

I want :

if i'm in police team and you're criminal you can tass me (Off)

From the end, Do you want this code works only for A law team?

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