Jump to content

id for killed


Recommended Posts

Could someone help me I am not able to specify the PED ID that should be killed?

zombiesKilled = 0

function ZedMissionWin ()
	zombiesKilled = 0
	outputChatBox("Good job, mission completed!")
	givePlayerMoney ( 50000 )
	removeEventHandler("onClientPedWasted",root,ZedMissionCheckKill)
end

function ZedMissionCheckKill (killer,weapon)
	
	local zed = getElementModel ( ped )
    if id == 105 or id == 107 then
	
		if zed == true and killer == localPlayer then 
			zombiesKilled = zombiesKilled+1 
			outputDebugString("A zed was killed, "..(0+zombiesKilled).." zeds left.")
		end
	end
		if zombiesKilled >= 5 then 
			ZedMissionWin() 
		end
end

function startZedMission()
	outputChatBox("Your Get Mission")
	addEventHandler("onClientPedWasted",root,ZedMissionCheckKill)
end

addCommandHandler("mission", startZedMission)

 

Edited by kevincouto6
Link to comment
local zed = getElementModel ( ped )
if id == 105 or id == 107 then

Don't you mean

local id = getElementModel( source ) -- source is the ped that was killed, killer is the ped/client that killed it
if id == 105 or id == 107 then

Also, afterwards you're checking whether zed == true but you don't define zed (well, you did, now I changed it, but you nevertheless loaded an integer into it [the model id] (or false if the function failed). It would never be equal to true)

Edited by MrTasty
Link to comment
51 minutes ago, MrTasty said:

local zed = getElementModel ( ped )
if id == 105 or id == 107 then

Don't you mean


local id = getElementModel( source ) -- source is the ped that was killed, killer is the ped/client that killed it
if id == 105 or id == 107 then

Also, afterwards you're checking whether zed == true but you don't define zed (well, you did, now I changed it, but you nevertheless loaded an integer into it [the model id] (or false if the function failed). It would never be equal to true)

But it is still not possible to complete the mission! META must be client or server

Edited by kevincouto6
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...