Jump to content

IIYAMA

Moderators
  • Posts

    5,976
  • Joined

  • Last visited

  • Days Won

    192

IIYAMA last won the day on May 18

IIYAMA had the most liked content!

About IIYAMA

  • Birthday 01/01/2016

Member Title

  • Global Moderator

Details

  • Gang
    [HB]
  • Location
    Netherlands
  • Occupation
    I have never been to the streets of SA... so who knows?
  • Interests
    Design, scripting, UX/UI

Recent Profile Visitors

32,817 profile views

IIYAMA's Achievements

Gangsta

Gangsta (45/54)

1.5k

Reputation

Single Status Update

See all updates by IIYAMA

  1. Using one addEventHandler on a group of elements?

     

    Answer:

    local group = createElement("groupMyCutePeds") -- Create a custom element and save it in to the variable <group>.
    
    
    -- Create 3 peds.
    local ped1 = createPed(120, 5540.6654, 1020.55122, 1240.545)
    local ped2 = createPed(120, 5541.6654, 1021.55122, 1240.545)
    local ped3 = createPed(120, 5542.6654, 1022.55122, 1240.545)
    
    -- Set the parent of the 3 peds.
    setElementParent(ped1, group)
    setElementParent(ped2, group)
    setElementParent(ped3, group)
    
    
    -- Add an addEventHandler and use the <group> as <attachedTo> element.
    addEventHandler("onPedWasted", group, -- "onPedWasted" = serverside. "onClientPedWasted" = clientside.
    function ()
        outputChatBox("One of my cute peds just died. ;'( No exceptions!")
    end)

    (untested muhahaha :D)

×
×
  • Create New...