Jump to content

Search the Community

Showing results for tags 'headshot_s.lua:2: bad argument @ getelementtype [expected element at argument 1 got nil]'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 2 results

  1. Hello guys, I would like some help with this script below. My idea is to make two arenas (PvP), one of them is to kill any player with just one shot. The other arena is just killing with headshots! I was indicted to put elementData, but I don't know how to do that. Can someone help me? Sorry for bad English. Script Arena Oneshot function playerDamage_text ( attacker, weapon, bodypart, loss ) if ( bodypart == 3 and attacker and attacker ~= source ) then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) --------------------------_---------------------------------- Script Headshot function playerDamage_text ( attacker, weapon, bodypart, loss ) if ( bodypart == 9 and attacker and attacker ~= source ) then killPed ( source, attacker, weapon, bodypart ) end end addEventHandler ( "onPlayerDamage", root, playerDamage_text )
  2. function MakePlayerHeadshot( attacker, weapon, bodypart, loss ) if getElementType ( attacker ) == "ped" then if bodypart == 9 then triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) setPedHeadless ( source, true ) killPed( source, attacker, weapon, bodypart ) setTimer( BackUp, 900, 1, source ) end end end function MakeHeadshot( source, attacker, weapon, loss ) triggerEvent( "onPlayerHeadshot", source, attacker, weapon, loss ) killPed( source, attacker, weapon, 9 ) setPedHeadless ( source, true ) setTimer( BackUp, 900, 1, source ) end function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end function outputHeadshotIcon (killer, weapon, bodypart) if bodypart == 9 then cancelEvent() exports.killmessages:outputMessage ( {getPlayerName(killer),{"padding",width=3},{"icon",id=weapon},{"padding",width=3},{"icon",id=256},{"padding",width=3},{"color",r=r1,g=g1,b=b1},getPlayerName(source) }, getRootElement(),r2,g2,b2) end end addEvent ( "onServerHeadshot", true ) addEventHandler( "onPlayerDamage", getRootElement(), MakePlayerHeadshot ) addEventHandler( "onPlayerKillMessage", getRootElement(), outputHeadshotIcon ) addEventHandler( "onServerHeadshot", getRootElement(), MakeHeadshot )
×
×
  • Create New...