Bully-Board

Bully Modding Section => Modding Questions/Help => Modding Questions/Help Archives => Topic started by: Mick3Mouse on December 26, 2013, 05:48:21 PM

Title: Would this work?
Post by: Mick3Mouse on December 26, 2013, 05:48:21 PM
Deleteped = function()
local LockOnPed = PedGetTargetPed()
if IsButtonPressed(10,0) and IsButtonPressed(12,0) and LockOnPed > -1 and LockOnPed is not (PEDNAME) then
PedDelete(LockOnPed)
end
end

So if i lockon a my spawned ped, and press (12,0) he will not delete. But if i lock on normal ped. it will delete that ped.
Title: Re: Would this work?
Post by: MadmaN on December 26, 2013, 08:22:38 PM
Try this:

Code: [Select]
Deleteped = function()
local LockOnPed = PedGetTargetPed()
if IsButtonPressed(10,0) and IsButtonPressed(12,0) then
PedDelete(LockOnPed)
end
end

I eliminated some of your extra code for the button pressed line and this should pretty much do the trick. If it doesn't then you will need to add some extra code that checks for the targeted ped with the targeted ped defined using other code....maybe using math.random probably.
Title: Re: Would this work?
Post by: Mick3Mouse on December 27, 2013, 05:03:04 AM
Try this:

Code: [Select]
Deleteped = function()
local LockOnPed = PedGetTargetPed()
if IsButtonPressed(10,0) and IsButtonPressed(12,0) then
PedDelete(LockOnPed)
end
end

I eliminated some of your extra code for the button pressed line and this should pretty much do the trick. If it doesn't then you will need to add some extra code that checks for the targeted ped with the targeted ped defined using other code....maybe using math.random probably.



My first code will work. But i need a code that checks if LockOnPed is not a spefific ped, So if lockon is Ped1 and i press (12,9) he will not be deleted
Title: Re: Would this work?
Post by: c00ld0c26 on December 27, 2013, 05:48:57 AM
Try PedGetModel()
Title: Re: Would this work?
Post by: MadmaN on December 27, 2013, 03:51:29 PM
You could try something along thse lines:

Code: [Select]
Deleteped = function()
local LockOnPed = PedGetTargetPed()
if IsButtonPressed(10,0) and IsButtonPressed(12,0) and PedGetModel() -= nil then
PedDelete(LockOnPed)
end
end

This is just a example and not exactly full working code....just something real quick to maybe give you a couple ideas.  :biggrin:
Title: Re: Would this work?
Post by: MadmaN on December 27, 2013, 03:53:57 PM
A more complicated way to use that code would be to use it this way which relies VERY heavily upon locals.....but this does more or less what you want.

 
Code: [Select]
  local l_47_15 = l_0_21
    l_0_39 = PedFindInAreaXYZ(l_47_8, l_47_9, l_47_10, 1.5)
    l_47_11[1], l_47_12[2], l_47_13[3], l_47_14[4], l_47_15[5] =
    l_47_11 = l_0_39
    if l_47_11 then
      l_47_11 = l_0_21
      l_47_12 = nil
      l_47_13 = nil
      l_47_14 = nil
      for l_47_14 = l_47_11, l_47_12, l_47_13 do
      end
    end
    l_47_15 = PedIsValid
    l_47_15 = l_47_15(l_47_14)
    if l_47_15 then
      l_47_15 = PedGetModel
      local l_47_16 = true
      for l_47_20 = l_0_27, nil, nil do
        if l_47_20 == l_47_14 then
          l_47_16 = false
        else
        end
      end