iFoReX Posted April 8, 2012 Share Posted April 8, 2012 why the setElementPosition is bad ? local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end addEvent( "qd2", true ) addEventHandler( "qd2", getRootElement(), qm2 ) local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. function qm4 ( ) local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition ( source, table[ math.random ( #table ) ] ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition ( source, table[ math.random ( #table ) ] ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end addEvent( "qd4", true ) addEventHandler( "qd4", getRootElement(), qm4 ) addEventHandler("onResourceStart",Vehiculocrear) function qm3 ( ) local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end addEvent( "qd3", true ) addEventHandler( "qd3", getRootElement(), qm3 ) Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 Sorry, What lua editor are you using? Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 the LuaEdit but u can say me what is bad ? please Link to comment
Guest Guest4401 Posted April 8, 2012 Share Posted April 8, 2012 (edited) Because in your case, the 2nd argument in setElementPosition is a table. It's not unpacking the x,y,z positions as you're trying to do. EDIT : There are a lot of other basic errors too, you must try to fix those first. (No offense) Edited April 8, 2012 by Guest4401 Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 ando how I can unpack ? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 You have addEventHandler("onResourceStart",Vehiculocrear) Which triggers nothing... EDIT: parameters = unpack(Table) in your case, you use: x,y,z = unpack(Table[math.random(#Table)]) try this: addEvent( "qd2", true ) addEventHandler( "qd2", root,function() local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, -1960.53528, 127.29656, 27.68750 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end) local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. addEvent( "qd4", true ) addEventHandler( "qd4", root,function() local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition ( source, table[ math.random ( #table ) ] ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) x,y,z = unpack(table[math.random(#table)]) setElementPosition ( source, x,y,z) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end) addEventHandler("onResourceStart",resourceRoot,Vehiculocrear) addEvent( "qd3", true ) addEventHandler( "qd3", root,function() local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, 1056.44568, -2724.47437, 8.48407 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end) Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 ?? local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. function qm4 ( ) local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota[Gold]~x" then setElementPosition ( source, unpack(table)table[ math.random ( #table ) ] ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition ( source, unpack(table)table[ math.random ( #table ) ] ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end addEvent( "qd4", true ) addEventHandler( "qd4", getRootElement(), qm4 ) Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 no, like this: local table = {{2851.87793, 1290.40491, 11.39063},{1433.50720, 2620.47266, 11.39261}} -- Una tabla con diferentes modelos de vehiculos. addEvent( "qd4", true ) addEventHandler( "qd4", root,function() local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) local x,y,z = unpack(table[math.random(#table)]) if name == "ElMota[Gold]~x" then setElementPosition ( source,x,y,z ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition ( source, x,y,z) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end) Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 thnx man now work to 100% and why u ask me what lua editor I used? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 thnx man now work to 100% and why u ask me what lua editor I used? I suggest using Notepad++, is that lua editor from MTA it self? Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 what is the better lua editor ? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 Notepad++, You can organize your script and you can get help for some of the functions. Link to comment
drk Posted April 8, 2012 Share Posted April 8, 2012 Use MTA Script Editor from 50p. It have some bugs, but it's better than Notepad++ Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 Use MTA Script Editor from 50p. It have some bugs, but it's better than Notepad++ Well, it needs to be updated right now. Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 @offtopic : what tool in MTA Script Editor is better than notepad ? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 Well, MTA Script Editor shows has everything you need to make a resource/script, but needs to be updated. Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 ok man , now How I can do a script for fugitives What functions I need ? Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 ok man , now How I can do a script for fugitives What functions I need ? like criminals? It depends on what you want? Link to comment
iFoReX Posted April 8, 2012 Author Share Posted April 8, 2012 I want when theKiller had 6 stars in wanted level appear a blip in he and appear in chatbox to all the manhunt and the player to kill and the money, and if he again kill to RandomPlayer he when stop the manhunt give more money, if a RandomPlayer kill to theKiller giveMoney 10000 Link to comment
Jaysds1 Posted April 8, 2012 Share Posted April 8, 2012 try these: setPlayerWantedLevel() getPlayerWantedLevel() outputChatBox() createBlipAttachedTo() Link to comment
Kenix Posted April 8, 2012 Share Posted April 8, 2012 addEventHandler("onResourceStart",Vehiculocrear) omg ... I did give you links for learning, but you not want learn. Ok 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