Killer... Posted February 14, 2015 Posted February 14, 2015 Hi everyone i have been scripting an Marihuana system for MTA Paradise, and show's me some errors. These are the errors: [2015-02-14 15:21:05] WARNING: drogas\s.lua:363: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] [2015-02-14 15:21:05] ERROR: drogas\s.lua:364: call: failed to call 'players:takemaria' [string "?"] [2015-02-14 15:21:05] ERROR: drogas\s.lua:365: attempt to concatenate local 'pjid' (a boolean value) And this is the script for plant the marihuana: function plantar ( thePlayer, command) local maria = getElementData(thePlayer, "maria") local pjid = exports.players:getCharacterID( source ) local x,y,z = getElementPosition ( thePlayer ) planta = createObject (3409, x, y, z) if maria >= 2 then if ( planta ) then -- if it was created outputChatBox("((Has plantado una planta de marihuana))", source, 0, 0, 255 ) setElementData ( source, "maria", maria ) exports.players:takemaria( source, 2 ) exports.sql:query_free('UPDATE characters SET maria = 5 WHERE characterID = '..pjid) setTimer ( plantac, 1000, 1) setTimer ( planta1, 2000, 1) setTimer ( planta2, 4000, 1) setTimer ( planta3, 6000, 1) setTimer ( planta4, 10000, 1) end else outputChatBox("((No tienes suficiente marihuana para poder plantar una planta de marihuana))", source, 0, 0, 255) end end addCommandHandler ( "plantar", plantar ) And on the script for take the marihuana: [2015-02-14 15:28:46] WARNING: drogas\s.lua:380: Bad argument @ 'getObjectScale' [Expected object at argument 1, got nil] [2015-02-14 15:28:46] WARNING: drogas\s.lua:382: Bad argument @ 'getElementPosition' [Expected element at argument 1, got nil] [2015-02-14 15:28:46] WARNING: drogas\s.lua:383: Bad argument @ 'getElementPosition' [Expected element at argument 1, got boolean] [2015-02-14 15:28:46] WARNING: drogas\s.lua:384: Bad argument @ 'getDistanceBetweenPoints3D' [Expected vector3 at argument 1, got boolean] [2015-02-14 15:28:46] ERROR: drogas\s.lua:384: attempt to compare boolean with number And this is the script for take the marihuana: function cosechar ( ) local planta = getObjectScale ( planta ) local pjid = exports.players:getCharacterID( source ) local x,y,z = getElementPosition ( player ) local cx,cy,cz = getElementPosition ( planta ) if getDistanceBetweenPoints3D (x,y,z,cx,cy,cz) < 3 then if getObjectScale ( planta, 1) then destroyElement ( planta ) outputChatBox("((Has cosechado 6 g de maria))", source, 255, 255, 0) setElementData ( source, "maria", maria ) exports.players:giveMaria(source, 6) exports.sql:query_free('UPDATE characters SET maria = 5 WHERE characterID = '..pjid) else outputChatBox("((La planta es demasiado joven))", source, 255, 0, 0) end else outputChatBox("((Tienes que acercarte a una planta para cosecharla))", source, 255, 0, 0) end end addCommandHandler ("cosechar", cosechar) Please i need help, and thanks for your help.
Tomas Posted February 14, 2015 Posted February 14, 2015 Is the resource 'players' started? function plantar ( thePlayer, command) local maria = getElementData(thePlayer, "maria") local pjid = exports.players:getCharacterID( source ) local x,y,z = getElementPosition ( thePlayer ) planta = createObject (3409, x, y, z) if maria >= 2 then if ( planta ) then -- if it was created outputChatBox("((Has plantado una planta de marihuana))", source, 0, 0, 255 ) setElementData ( source, "maria", maria ) exports.players:takemaria( source, 2 ) exports.sql:query_free('UPDATE characters SET maria = 5 WHERE characterID = '..pjid) setTimer ( plantac, 1000, 1) setTimer ( planta1, 2000, 1) setTimer ( planta2, 4000, 1) setTimer ( planta3, 6000, 1) setTimer ( planta4, 10000, 1) end else outputChatBox("((No tienes suficiente marihuana para poder plantar una planta de marihuana))", source, 0, 0, 255) end end addCommandHandler ( "plantar", plantar ) Where is 'planta' defined here? function cosechar ( ) local planta = getObjectScale ( planta ) local pjid = exports.players:getCharacterID( source ) local x,y,z = getElementPosition ( player ) local cx,cy,cz = getElementPosition ( planta ) if getDistanceBetweenPoints3D (x,y,z,cx,cy,cz) < 3 then if getObjectScale ( planta, 1) then destroyElement ( planta ) outputChatBox("((Has cosechado 6 g de maria))", source, 255, 255, 0) setElementData ( source, "maria", maria ) exports.players:giveMaria(source, 6) exports.sql:query_free('UPDATE characters SET maria = 5 WHERE characterID = '..pjid) else outputChatBox("((La planta es demasiado joven))", source, 255, 0, 0) end else outputChatBox("((Tienes que acercarte a una planta para cosecharla))", source, 255, 0, 0) end end addCommandHandler ("cosechar", cosechar) Post the full code or it won't be easy. Currently developing for International Gaming Community - Join us!
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