Killer... Posted February 22, 2015 Share Posted February 22, 2015 Hello everybody. I was working on a system for plant and take maria. But there's problems that i don't know how to resolve, because that i'm doing this post. Here's the error: [2015-02-22 16:45:52] SCRIPT ERROR: drogas\s.lua:385: syntax error near 'setElementData' [2015-02-22 16:45:52] ERROR: Loading script failed: drogas\s.lua:385: syntax error near 'setElementData' And here's the system for plant. function plantarr( thePlayer, command) local semillas = getElementData(thePlayer, "semillas") local pjid = exports.players:getCharacterID( source ) local x,y,z = getElementPosition ( thePlayer ) if tonumber(semillas) <= semillas then if tonumber(semilla) <= semillas then if semillas >= 2 then exports.chat:me (thePlayer, "termina de plantar una planta de marihuana.") local plantaObject = createObject (3409, x, y, z -3.25) --Crear Objeto local aquitar = getElementData (player, "semillas" ) - 2(semillas) setElementData ( source, "semillas", aquitar ) setElementData ( source, "semillas", semillas ) setElementData ( source, "planta", plantaObject) exports.sql:query_free('UPDATE characters SET semillas = '.. aquitar ..' WHERE characterID = '..pjid) end else outputChatBox("((No tienes suficientes semillas))", source, 255, 0, 43) end end end addCommandHandler ( "plantar", plantarr ) And there's the system for take it, i don't know if it have any error but i put it here, if you can revise it and say me if it's good i will thank you, if you don't know, i will thank you too function cosecharr( thePlayer, command ) local semillas = getElementData(thePlayer, "semillas") local planta = getElementData ( source, "planta") local pjid = exports.players:getCharacterID( source ) x1, y1, z1 = getElementPosition ( thePlayer ) x2, y2, z2 = getElementPosition ( planta ) distance = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) if ( distance < 2) then setPedAnimation (thePlayer, "BOMBER", "BOM_Plant", 4000) exports.chat:me (thePlayer, "arranca la planta y la mete en una bolsa.") exports.chat:ame (thePlayer, "Cosechó 5 gramos de marihuana.") exports.chat:ame (thePlayer, "Ya no queda rastro de la planta.") destroyElement ( planta ) setElementData ( source, "maria", maria ) local adar = getElementData ( player, "maria" ) + 5(maria) exports.sql:query_free('UPDATE characters SET maria = '.. adar ..' WHERE characterID = '..pjid) else outputChatBox("((Tienes que estar cerca de una planta para cosecharla))", source, 255, 0, 43) end end addCommandHandler ("cosechar", cosecharr) Thanks for watch my post, and try to help. Thanks to everybody, have a good Sunday. Link to comment
Enargy, Posted February 22, 2015 Share Posted February 22, 2015 Change source to thePlayer. Link to comment
Killer... Posted February 22, 2015 Author Share Posted February 22, 2015 The error is the same. Link to comment
Enargy, Posted February 22, 2015 Share Posted February 22, 2015 change second code; line #14 and #15: local adar = getElementData ( player, "maria" ) setElementData ( thePlayer, "maria", adar + 5 ) 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