News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Would this work?  (Read 2595 times)

0 Members and 1 Guest are viewing this topic.

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Would this work?
« 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.

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: Would this work?
« Reply #1 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.

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: Would this work?
« Reply #2 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

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: Would this work?
« Reply #3 on: December 27, 2013, 05:48:57 AM »
Try PedGetModel()

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: Would this work?
« Reply #4 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:

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: Would this work?
« Reply #5 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