Jump to content

createObject in player intruor


HoLsTeN

Recommended Posts

thanks see this

addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local i = getElementInterior ( source) 
        trolley = createObject (i ,2780, x, y, z, 0, 0, 0 ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end      
  end 
) 

but it is not work

Link to comment
thanks see this
addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local i = getElementInterior ( source) 
        trolley = createObject (i ,2780, x, y, z, 0, 0, 0 ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end      
  end 
) 

but it is not work

may be this

  
addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local trolley1 = getElementInterior ( trolley ) 
        trolley = createObject (2780, x, y, z, 0, 0, 0 ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end      
  end 
) 
  

Link to comment
  • Moderators
@volk-rus: no coment...

not understand ?

He want to set the same interior that the player so where is your setElementInterior ??

@AZOZE:

The full code with the setElementInterior:

addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local i = getElementInterior ( source) 
        trolley = createObject (2780, x, y, z, 0, 0, 0 ) 
        setElementInterior( trolley, i ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end     
  end 
) 

Link to comment
thanks see this
addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local i = getElementInterior ( source) 
        trolley = createObject (i ,2780, x, y, z, 0, 0, 0 ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end      
  end 
) 

but it is not work

may be this

  
addEvent("buy2", true) 
addEventHandler("buy2", getRootElement(), 
  function() 
      if ( getPlayerMoney (source) >= 2000 ) then 
        takePlayerMoney(source, 2000) 
        local x,y,z = getElementPosition ( source ) 
        local trolley1 = getElementInterior ( trolley ) 
        trolley = createObject (2780, x, y, z, 0, 0, 0 ) 
        outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) 
      else 
        outputChatBox(" No Money !", source, 255, 0, 0, true) 
      end      
  end 
) 
  

This makes totally no sense... i suposed you learned more :roll:

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