Jump to content

[Solved]Problem.


TheMaysTRo

Recommended Posts

function plant2 (player) 
 if getElementData( player,"tempdata.farmer", true ) then  
 addCommandHandler ( "plant", plant ) 
   outputChatBox ("you Entred the farm use /plant .",player,0,255,50,false) 
  
 end 
 end 
  
addEventHandler ("onColShapeHit", Cls, plant2) 
  
  
 function dontplant (player) 
  if getElementData( player,"tempdata.farmer", true ) then  
 removeCommandHandler ( "plant") 
    outputChatBox ("you left the farm you can't /plant anymore .",player,0,255,50,false) 
 end 
 end 
  
addEventHandler ("onColShapeLeave", Cls, dontplant) 

when someone enter the colshape he can use plant normaly. and when he left he can't . but if 2 players entred the colshape and one of them left the command handler will be removed for both of them so the one who is in the colshape can't use plant anymore cause the other guy left . any soloution ?

Edited by Guest
Link to comment

i tried all your ideas , ican't do it right ._.

TAPL idea

function plant2 (player) 
 if getElementData( player,"tempdata.farmer", true ) then  
  outputChatBox ("you Entred the farm use /plant .",player,0,255,50,false) 
    if  isElementWithinColShape (player,Cls) then 
 addCommandHandler ( "plant", plant ) 
 end 
 end 
 end 
  
addEventHandler ("onColShapeHit", Cls, plant2) 
  
  
 function dontplant (player) 
  if getElementData( player,"tempdata.farmer", true ) then  
      outputChatBox ("you left the farm you can't /plant anymore .",player,0,255,50,false) 
 end 
 end 
  
addEventHandler ("onColShapeLeave", Cls, dontplant) 

what's wrong ?

(i can /plant when i leave the colshape =

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