Jump to content

onClientPedWasted


Drakath

Recommended Posts

What this script supose to do?

function makeitgoup(killer,weapon,bodypart) 
if killer then 
local statx=getPedStat(killer,63) 
 if (statx > 2)then 
triggerClientEvent("statsup22",killer) 
setPedStat(killer,63,0) 
else 
setPedStat(killer,63,statx  +1) 
end 
end 
end 
addEvent("stats",true) 
addEventHandler("stats",getRootElement, makeItGoUp) 

Edited by Guest
Link to comment

Try my script :|

Server side:

Stats = { 
    [22] = { 69 }; 
    [23] = { 70 }; 
    [24] = { 71 }; 
    [25] = { 72 }; 
    [26] = { 73 }; 
    [27] = { 74 }; 
    [28] = { 75 }; 
    [29] = { 76 }; 
    [30] = { 77 }; 
    [31] = { 78 }; 
    [34] = { 79 }; 
}; 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ammo, killer, weapon, bodypart ) 
        if killer then 
            if getElementType ( killer ) == "player" then 
                if killer ~= source then 
                    if Stats[tonumber(weapon)] then 
                        setPedStat ( killer, Stats[tonumber(weapon)][1], getPedStat ( killer, Stats[tonumber(weapon)][1] ) + 1 ) 
                    end 
                end 
            end 
        end 
    end 
) 

Link to comment
Stats = { 
    [22] = { 69 }; 
    [23] = { 70 }; 
    [24] = { 71 }; 
    [25] = { 72 }; 
    [26] = { 73 }; 
    [27] = { 74 }; 
    [28] = { 75 }; 
    [29] = { 76 }; 
    [30] = { 77 }; 
    [31] = { 78 }; 
    [34] = { 79 }; 
}; 
  
addEventHandler ( "onZombieWasted", root, 
    function ( killer, weapon, bodypart ) 
        if killer then 
            if getElementType ( killer ) == "player" then 
                if killer ~= source then 
                    if Stats[tonumber(weapon)] then 
                        setPedStat ( killer, Stats[tonumber(weapon)][1], getPedStat ( killer, Stats[tonumber(weapon)][1] ) + 1 ) 
                    end 
                end 
            end 
        end 
    end 
) 

Link to comment
function statsup(killer) 
    if killer and killer == localPlayer and getElementData(source, "filmbot") then 
        triggerServerEvent("stats", killer) 
   end 
end 
addEventHandler("onClientPedWasted", root, statsup) 

function makeitgoup() 
    local statx = getPedStat(source, 63) 
    if (statx > 2)then 
        triggerEvent("statsup22", source) 
        setPedStat(source, 63, 0) 
    else 
        setPedStat(source, 63, statx + 1) 
    end 
end 
addEvent("stats", true) 
addEventHandler("stats", root, makeitgoup) 

If it doesn't work, post the function that attached to the event "statsup22" and explain what is doesn't work.

Link to comment

Huh? this is the same, i only change p to killer and added a check.

Let me know what this code output.

Client Side:

function statsup(killer) 
    outputChatBox("Client Test: 1") 
    if killer and killer == localPlayer and getElementData(source, "filmbot") then 
        outputChatBox("Client Test: 2") 
        triggerServerEvent("stats", killer) 
   end 
end 
addEventHandler("onClientPedWasted", root, statsup) 

Server Side:

function makeitgoup() 
    outputChatBox("Server Test: 1") 
    local statx = getPedStat(source, 63) 
    if (statx > 2)then 
        outputChatBox("Server Test: 2") 
        triggerEvent("statsup22", source) 
        setPedStat(source, 63, 0) 
        outputChatBox("Server Test: 3") 
    else 
        outputChatBox("Server Test: 4") 
        setPedStat(source, 63, statx + 1) 
    end 
    outputChatBox("Server Test: 5") 
end 
addEvent("stats", true) 
addEventHandler("stats", root, makeitgoup) 

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