HoLsTeN Posted March 15, 2011 Share Posted March 15, 2011 hi can any one help me i want to createObject in same player intruor ? Link to comment
proracer Posted March 15, 2011 Share Posted March 15, 2011 https://wiki.multitheftauto.com/wiki/GetElementInterior https://wiki.multitheftauto.com/wiki/CreateObject Link to comment
HoLsTeN Posted March 15, 2011 Author Share Posted March 15, 2011 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
Kenix Posted March 15, 2011 Share Posted March 15, 2011 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
Wojak Posted March 15, 2011 Share Posted March 15, 2011 (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 March 15, 2011 by Guest Link to comment
Kenix Posted March 15, 2011 Share Posted March 15, 2011 @volk-rus: no coment... not understand ? Link to comment
Moderators Citizen Posted March 15, 2011 Moderators Share Posted March 15, 2011 @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
Castillo Posted March 16, 2011 Share Posted March 16, 2011 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now