1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

PlayerInteractEvent

Discussion in 'Development' started by BloodyJohnRus, Feb 18, 2022.

  1. BloodyJohnRus

    BloodyJohnRus Silverfish

    Messages:
    19
    GitHub:
    GDSHNIK
    Hello.
    When i placing or interacting with block - code works. When i break block - it's not work. Why?
    Block position >>4
    $cx
    $cz
    $owner - from cfg owner of chunk
    $this->config->exists("$owner") - if owner equals the town he check the leader and if leader of town == our name then he allow to break
    $n - name
    $p - player
    $e - Event
    $town - player town
    PHP:
            if($this->config->exists("$cx $cz"))
            {
                
    $owner=$this->config->get("$cx $cz");

                if(
    $owner==$n)
                {

                }
                else
                {
                    if(
    $this->config->exists("$owner"))
                    {
                        
    $town=$this->config->get("town$n");
                        if(
    $this->config->get("$owner")==$n && $owner==$town)
                        {
                       
                        }
                        else
                        {
                            
    $e->cancel();
                        
    $p->sendMessage("§l§cError");
                        }
                    }
                    else
                        {
                            
    $e->cancel();
                        
    $p->sendMessage("§l§cError");
                        }
                }
            }
            else
            {

            }
     
  2. bruno99

    bruno99 Spider

    Messages:
    12
    GitHub:
    udachin26
    Try use yet BlockBreakEvent
     
  3. BloodyJohnRus

    BloodyJohnRus Silverfish

    Messages:
    19
    GitHub:
    GDSHNIK
    Tried, interactevent calls firstly
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.