Jump to content

createObject in player intruor


HoLsTeN

Recommended Posts

Posted

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

I Am HoLsTeN !

Posted
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 
) 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted (edited)

@volk-rus: no comment...

@AZOZE:

trolley = createObject (i ,2780, x, y, z, 0, 0, 0 ) 

function createObject expect obiect id as 1 parameter, not interior id...

you set interior with this:

https://wiki.multitheftauto.com/wiki/SetElementInterior

Edited by Guest
  • Moderators
Posted
@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 
) 

The rEvolution is coming ...

Posted
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:

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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