kikos500 Posted September 20, 2015 Share Posted September 20, 2015 well i have asked this question before but i started now so i finished the kills script but i made the kills to detect any player who kills the other so the problem is i tried a lot of times to make it detect the guy who has bounty on but i failed there is the kills / bounty code ---- server.lua function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end end return false end function bounty(source, command, stat, amount) local player, playerName = findPlayer(stat) if player then local test = tonumber(amount) local cash = getElementData(source,"cash") if cash > test then if test >= 10000 then setElementData (source,"cash",cash - test,true) outputChatBox(getPla[size=85][/size]yerName(source).." Put Bounty On "..getPlayerName(player).."("..test.."$)",getRootElement(),255,255,0,true) end end end end addCommandHandler("bounty", bounty) -- kills_s addEvent("onPlayerFinishDD") addEventHandler("onPlayerFinishDD", root, function(pRank) triggerClientEvent(source, "getPlayerKiller", resourceRoot) end) addEvent("onClientPostKiller", true) addEventHandler("onClientPostKiller", resourceRoot, function(pKiller) if (source ~= resourceRoot) then return end local clientName = getPlayerName(client) if ((pKiller) and (getElementType(pKiller) == "player")) then local killerName = getPlayerName(pKiller) outputChatBox(killerName.." has rekt "..clientName) else outputChatBox(clientName.." has died by his own! NOOB!") end end) --- kills_c local pKiller = nil addEventHandler("onClientVehicleCollision", root, function(hitElement) if (source == getPedOccupiedVehicle(localPlayer)) then if (getElementType(hitElement) == "vehicle") then local hitPlayer = getVehicleOccupant(hitElement) if ((hitPlayer) and (getElementType(hitPlayer) == "player")) then pKiller = hitPlayer setTimer(function() pKiller = nil end, 5000,1) end end end end) addEvent("getPlayerKiller", true) addEventHandler("getPlayerKiller", resourceRoot, function() if (source ~= resourceRoot) then return end triggerServerEvent("onClientPostKiller", resourceRoot, pKiller) end) I want the killer of the guy which has bounty on him to get the money Link to comment
KariiiM Posted September 20, 2015 Share Posted September 20, 2015 You want it like Kill reward system? each kill get the money for it Link to comment
kikos500 Posted September 20, 2015 Author Share Posted September 20, 2015 You want it like Kill reward system? each kill get the money for it Naah I wantt a command when you write it like /bounty AirFighter. Cash when AirFighter dies the killer of him gets the cash Link to comment
kikos500 Posted September 21, 2015 Author Share Posted September 21, 2015 I thought about storing pkiller aandthe player killed in a element data and comparing it with the bounty killer so im wondering if it will work Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now