Jump to content

[HELP] Marihuana Plantation [Syntax Error]


Killer...

Recommended Posts

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

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

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