Tete omar Posted September 6, 2012 Share Posted September 6, 2012 ctrlNames = { "forwards","backwards","left","right","jump","sprint","walk","crouch","enter_exit" } local function followHim(player) for _, ctrl in ipairs(ctrlNames) do setControlState(player,(ctrl),true) end end setTimer(followHim, 10*500/100*10*5-2450, 0, player) -- the result : 50 addEventHandler("onPlayerDamage", root, function( attacker, attackerweapon, bodypart, loss ) for _,player in ipairs(getElementsByType("player")) do local policeTeam = getPlayerTeam( attacker ) if ( policeTeam == Police ) and ( attacker == Police ) then if ( wantedLevel > 0 ) then -- wantedLevel is predefined .. if ( attackerweapon == 3 ) and ( loss > 2 ) then followHim(player) showCursor( true ) end end end end end) Errors: bad argument @ 'setControlState' Link to comment
TAPL Posted September 6, 2012 Share Posted September 6, 2012 Maybe? ctrlNames = { "forwards","backwards","left","right","jump","sprint","walk","crouch","enter_exit" } local function followHim(player) for _, ctrl in ipairs(ctrlNames) do setControlState(player,(ctrl),true) end end addEventHandler("onPlayerDamage", root, function( attacker, attackerweapon, bodypart, loss ) for _,player in ipairs(getElementsByType("player")) do local policeTeam = getPlayerTeam( attacker ) if ( policeTeam == Police ) and ( attacker == Police ) then if ( wantedLevel > 0 ) then -- wantedLevel is predefined .. if ( attackerweapon == 3 ) and ( loss > 2 ) then setTimer(followHim, 10*500/100*10*5-2450, 0, player) -- the result : 50 showCursor( true ) end end end end end) Link to comment
Tete omar Posted September 6, 2012 Author Share Posted September 6, 2012 Maybe? ctrlNames = { "forwards","backwards","left","right","jump","sprint","walk","crouch","enter_exit" } local function followHim(player) for _, ctrl in ipairs(ctrlNames) do setControlState(player,(ctrl),true) end end addEventHandler("onPlayerDamage", root, function( attacker, attackerweapon, bodypart, loss ) for _,player in ipairs(getElementsByType("player")) do local policeTeam = getPlayerTeam( attacker ) if ( policeTeam == Police ) and ( attacker == Police ) then if ( wantedLevel > 0 ) then -- wantedLevel is predefined .. if ( attackerweapon == 3 ) and ( loss > 2 ) then setTimer(followHim, 10*500/100*10*5-2450, 0, player) -- the result : 50 showCursor( true ) end end end end end) No errors but i think it doesn't make sense. Link to comment
Castillo Posted September 6, 2012 Share Posted September 6, 2012 ctrlNames = { "forwards","backwards","left","right","jump","sprint","walk","crouch","enter_exit" } local function followHim ( player ) for _, ctrl in ipairs ( ctrlNames ) do setControlState ( player, ( ctrl ), true ) end end setTimer ( followHim, 10*500/100*10*5-2450, 0, player ) -- the result : 50 addEventHandler ( "onPlayerDamage", root, function ( attacker, attackerweapon, bodypart, loss ) if ( attacker ) then local policeTeam = getPlayerTeam ( attacker ) if ( policeTeam == Police ) and ( wantedLevel > 0 ) then if ( attackerweapon == 3 ) and ( loss > 2 ) then followHim ( source ) showCursor ( source, true ) end end end end ) That's what you mean? because your script would make every player with these controls, mine will make only the player that got hit. Link to comment
Tete omar Posted September 6, 2012 Author Share Posted September 6, 2012 I just discovered that i just wasting my time with 'setControlState' so i made a temporary test , and here you are addEventHandler("onPlayerDamage", root, function( attacker, attackerweapon, bodypart, loss ) local policeTeam = getPlayerTeam( attacker ) if ( isElement( policeTeam ) and policeTeam == Police ) then if ( ( wantedLevel or 0 ) >= 1 ) then if ( attackerweapon == 3 ) and ( loss > 2 ) then outputChatBox( getPlayerName( source ) .. " was Jailed by " .. getPlayerName( attacker ) ) end end end end) if i damaged a person with 1 or more stars , the message won't be appear why ?. Link to comment
Castillo Posted September 6, 2012 Share Posted September 6, 2012 "Police" variable is defined, right? Also, are you sure the health lost is higher than 2? 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