Jump to content

Need help with an arrest script


adamb

Recommended Posts

Posted

Alright, so i made an 'arrest' script, which basically stops an NPC and applys the animation 'handsup' on it.

Tho it doesn't work / work on slothbots neither NPC-HLC bots.

heres the code:

for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget ( playerSource, keyPresser, key, keyStatetargetElem, targetElem ) 
    setPedAnimation( targetElem, "ped", "handsup") 
end 
addCommandHandler("arrest", onPlayerTarget) 

Can anyone help me out? :o

Posted

It doesn't work on slothbots and NPC HLC peds because it doesn't work at all. targetElem is either undefined or a string.

Posted

for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget (ped) 
if getElementType(ped) == 'ped' then 
    setPedAnimation( ped, "ped", "handsup") 
          end 
end 
addCommandHandler("arrest", onPlayerTarget) 

Try it.

If it wrong use for k,v in ipiras...

Posted

for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget (ped) 
for k,v in ipairs(getElementType("ped")) do 
    setPedAnimation( v, "ped", "handsup") 
          end 
end 
addCommandHandler("arrest", onPlayerTarget) 

Try it.

Posted
for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget (ped) 
for k,v in ipairs(getElementType("ped")) do 
    setPedAnimation( v, "ped", "handsup") 
          end 
end 
addCommandHandler("arrest", onPlayerTarget) 

Try it.

No this will find any ped in the server and set the anim .

Posted
for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget (ped) 
for k,v in ipairs(getElementType("ped")) do 
    setPedAnimation( v, "ped", "handsup") 
          end 
end 
addCommandHandler("arrest", onPlayerTarget) 

Try it.

No this will find any ped in the server and set the anim .

so how to do it?

if you try this :

for i,v in ipairs(getElementsByType("player")) do 
 bindKey(v, "e", "down", "arrest") 
end 
  
function onPlayerTarget (player) 
    setPedAnimation( player, "ped", "handsup") 
          end 
end 
addCommandHandler("arrest", onPlayerTarget) 

this for player only. :shock:

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