Jump to content

weed planting ^^


Estevam2d

Recommended Posts

Posted

I have a big problem.

When I use / plant, all my friends Also plant.

How do I get only the plantation Appear for me?

I do not want to Appear to weed for all

Just who use the command will plant and not all

side - Client

weeddID = 3409 
weeddGrowTime = 5000 
pacot = 1578 
upe = 128.2 
esx = 4.2 
  
  
  
  
  
  
  
addEvent("Chamarseeds",true) 
function teste() 
if getElementData ( localPlayer, "WeedBag" ) == 1 then 
 local x,y,z = getElementPosition(localPlayer) 
            Feno1 = createObject(weeddID,x,y,z-esx)                  
            moveObject(Feno1,weeddGrowTime,x,y,upe,0,0,0,"InOutQuad")    
             
            setTimer(function()  
            destroyElement (Feno1) 
            pacotin1 = createObject(pacot,x,y,z-1.0) 
            end,weeddGrowTime,1) 
end 
end 
addEventHandler("Chamarseeds", getRootElement(), teste) 

side - Server

  
function Bandidobymanawydan (source) 
triggerClientEvent ( "Chamarseeds", source)  
outputChatBox("Seeds "..getElementData(source,"WeedBag").." " ,source,255,0,0) 
end 
addCommandHandler("plant",  Bandidobymanawydan) 
  
  
  
  
--Cigarettes 
addEventHandler ( 'onPlayerQuit', root, 
    function ( ) 
        local account = getPlayerAccount ( source ) 
        local getScore = getElementData ( source, 'WeedBag' ) or 0 
        if ( account ) and not ( isGuestAccount ( account ) ) then 
            setAccountData ( account, 'WeedBag', getScore ) 
        end 
    end 
) 
addEventHandler ( 'onPlayerLogin', root, 
    function ( _, account ) 
        if ( account ) then 
            local scoreLoad = getAccountData ( account, 'WeedBag' ) 
            if ( scoreLoad ) then 
                setElementData ( source, 'WeedBag', scoreLoad ) 
            end 
        end 
    end 
) 

Posted

thank you for the tip triggerEvent.

I have a problem that when I enter the cylinder window appears for all, there is something that can evitalo appear for all and also appear just for me?

Posted
thank you for the tip triggerEvent.

I have a problem that when I enter the cylinder window appears for all, there is something that can evitalo appear for all and also appear just for me?

You need to put an if statement in the code, to check if the player who hit the marker is the localPlayer. onClientMarkerHit triggers whenever any player hits the marker.

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