Jump to content

Create Object Near Player and After Remove Object


Crab

Recommended Posts

Someone Please Help Me.
I am wrote a script about this topic. This definetly working but i want after the create object write into the chat /cam and remove this objects. Please help me.

 

function consoleCreateObject ( thePlayer, commandName )
   if ( thePlayer ) then
      local x, y, z = getElementPosition ( thePlayer ) -- get the player's position
      -- create a Object next to the player:
      local theObject1 = createObject ( 980, x + 2, y + 2, z, 0, 0, 0 )
      local theObject2 = createObject ( 980, x + 3, y + 3, z, 0, 0, 0 )
      local theObject3 = createObject ( 980, x + 4, y + 4, z, 0, 0, 0 )
      local theObject4 = createObject ( 980, x + 5, y + 5, z, 0, 0, 0 )
      end
   end
end
addCommandHandler ( "cab", consoleCreateObject )

 

Edited by jhxp
  • Thanks 1
Link to comment

 

function onChat(message, messageType)
    if string.find(message, 'cam') then  -- Searches for the string 'cam' in the message sent
    destroyElement(local theObject1) -- destroy element object 1
    destroyElement(local theObject2) -- destroy element object 2
    destroyElement(local theObject3) -- destroy element object 3
    destroyElement(local theObject4) -- destroy element object 3
    end
end --End of the function
addEventHandler("onPlayerChat", getRootElement(), onChat)
Link to comment
4 hours ago, MrKAREEM said:

 


function onChat(message, messageType)
    if string.find(message, 'cam') then  -- Searches for the string 'cam' in the message sent
    destroyElement(local theObject1) -- destroy element object 1
    destroyElement(local theObject2) -- destroy element object 2
    destroyElement(local theObject3) -- destroy element object 3
    destroyElement(local theObject4) -- destroy element object 3
    end
end --End of the function
addEventHandler("onPlayerChat", getRootElement(), onChat)

This is not working :/

Link to comment

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