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

Help Me!!

Discussion in 'General discussion' started by Monky, Feb 8, 2018.

  1. Monky

    Monky Creeper

    Messages:
    1
    GitHub:
    MonkyCortu
    I need help for a plugin, that when you have 3 warnings you will be banned for 2 hours this is the help code please

    if($cmd->getName() == "wa"){
    if($player->hasPermission("spe.staff")){
    $sv = "§8[§bSP§eE§8]§r ";
    if (isset($args[0])) {
    $jug = $player->getServer()->getPlayer($args[0]);
    if($jug!=null){
    if(isset($args[1])){
    $motivo = implode(" ", $args);
    $worte = explode(" ", $motivo);
    unset($worte[0]);
    $motivo = implode(" ", $worte);

    $warn = new Config($this->getDataFolder()."/warn.yml",Config::YAML);
    $w = $warn->get($jug->getName());
    $warn->set($jug->getName(), $w + 1);
    $warn->save();
    $wa = $warn->get($jug->getName());

    $jug->sendMessage("§l§o§eYou Have ".$wa." §ewarnings");
    $jug->sendMessage("§l§o§eYou have been warning for§c ".$motivo."§e, be careful");
    $player->sendMessage("§l§o§eThe player§c ".$jug->getName()."§e was warned by§c ". $motivo);
    $jug->addTitle("§c§o§lWarning", "§e§l§oWarning for ".$player->getName(),20, 40, 20);
    $jug->getInventory()->clearAll();
    $jug->teleport($this->getServer()->getDefaultLevel()->getSafeSpawn());
    $jug->setGamemode(0);
    $jug->setFood(20);
    $jug->setHealth(20);
    }}}
     
  2. Flavius12

    Flavius12 Spider Jockey

    Messages:
    32
    GitHub:
    flavius12
    Please put your code into PHP tag like this
    PHP:
    echo "Your code here!";
     
    ReimarPB likes this.
  3. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    What is your querie?
     
  4. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    Exactly.
    What is your querie anyway? This is a non-informative thread description, you are not explaining the problem in question, unless someone (even) bothers in looking at your code without knowing what is wrong with it, or what do you want to do with it.
     
  5. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Please help them too if you want to comment on this just gonna add some some unhelpful "USE PHP" comment
    Instated of supporting him, why not help OP out? if you really want the php format just do a post and boom there u go

    See it's easy:
    PHP:
    if($cmd->getName() == "wa"){
    if(
    $player->hasPermission("spe.staff")){
    $sv "§8[§bSP§eE§8]§r ";
    if (isset(
    $args[0])) {
    $jug $player->getServer()->getPlayer($args[0]);
    if(
    $jug!=null){
    if(isset(
    $args[1])){
    $motivo implode(" "$args);
    $worte explode(" "$motivo);
    unset(
    $worte[0]);
    $motivo implode(" "$worte);

    $warn = new Config($this->getDataFolder()."/warn.yml",Config::YAML);
    $w $warn->get($jug->getName());
    $warn->set($jug->getName(), $w 1);
    $warn->save();
    $wa $warn->get($jug->getName());

    $jug->sendMessage("§l§o§eYou Have ".$wa." §ewarnings");
    $jug->sendMessage("§l§o§eYou have been warning for§c ".$motivo."§e, be careful");
    $player->sendMessage("§l§o§eThe player§c ".$jug->getName()."§e was warned by§c "$motivo);
    $jug->addTitle("§c§o§lWarning""§e§l§oWarning for ".$player->getName(),204020);
    $jug->getInventory()->clearAll();
    $jug->teleport($this->getServer()->getDefaultLevel()->getSafeSpawn());
    $jug->setGamemode(0);
    $jug->setFood(20);
    $jug->setHealth(20);
    }}}
     
  6. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
     
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    ask the OP about that, not me
     
  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.