Spoiler: Code.php [.PHP]<?php namespace PEMapModder\LocalVote; use pocketmine\command\CommandSender; use pocketmine\command\Command; use pocketmine\event\Listener; use pocketmine\plugin\PluginBase; class Main extends PluginBase{ public $currentSessions = []; public function onEnable(){ $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new CheckTask($this), 10, 10); } public function onCommand(CommandSender $issuer, Command $cmd, $label, array $params){ $yes = false; switch($cmd->getName()){ case "votestart": $src = $issuer->getName(); if(!isset($params[0])){ $duration = 60; }else{ $duration = (int) (((float) array_shift($params)) * 60); if(count($params) === 0){ $q = "Do you like this server?"; }else{ $q = implode(" ", $params); } $ses = new VoteSession($src, $q, $duration); $this->currentSessions[$ses->id] = $ses; $this->getServer()->broadcastMessage("$src started a vote: " . $q . "\nType /yes $ses->id for yes, /no $ses->id for no"); break; case "yes": $yes = true; case "no": if(!isset($params[0])){ return false; } $id = (int) array_shift($params); if(!isset($this->currentSessions[$id])){ $issuer->sendMessage("Vote #$id does not exist!"); return true; } $this->currentSession[$id]->results[strtolower($issuer->getName())] = $yes; $issuer->sendMessage("You have voted " . ($yes ? "yes":"no") . "."); break; } return false; } }[/.PHP] Spoiler: error Code: Error: syntax error, unexpected 'case' (T_CASE) File: /VoteLOcal.phar/src/PEMapModder/LocalVote/Main Line: 31 Type: E_PARSE THIS CRASH WAS CAUSED BY A PLUGIN Code: [22] if(count($params) === 0){ [23] $q = "Do you like this server?"; [24] }else{ [25] $q = implode(" ", $params); [26] } [27] $ses = new VoteSession($src, $q, $duration); [28] $this->currentSessions[$ses->id] = $ses; [29] $this->getServer()->broadcastMessage("$src started a vote: " . $q . "\nType /yes $ses->id for yes, /no $ses->id for no"); [30] break; [31] case "yes": [32] $yes = true; [33] case "no": [34] if(!isset($params[0])){ [35] return false; [36] } [37] $id = (int) array_shift($params); [38] if(!isset($this->currentSessions[$id])){ [39] $issuer->sendMessage("Vote #$id does not exist!"); [40] return true; [41] } link: https://github.com/CaptainKenji17/LocalVote
thank you, now theres a bug i cnt type /yes /no cn u fix it and remove the set timing and make it default to 1min?
You can.. but you didn't do PHP: break; in the end of "Yes" case and the "No" case and PHP: return true; in the end of "Yes"
m8 this is not my plugin so idek, can you fix it? and changse some things like make a v0te and its 1 minute as default u dont need to type how many minute like just like this /vs Do you like taha? not /vs 1 adadawd thing, and make it not allow to create a vote while a vote is running
I saw your reply saying u dont understand what i wanted it to be, and I dont know how to reply you there so here I will tell you some clearly kenji's speech [The current LocalVote] /vs = start a vote /vs {time} {your vote text} and itll say $src has started a vote: your vote text type /yes 1 if yes, type /no 1 if no since it didnt worked I dont know what happened next [What I wanted it to be] /vs {your vote text} (Remove {time} and set it default in 1 minute) so itll be $src has started a vote : {Your vote text} type /yes if yes, type /no if no (remove the $id just make it directly /yes, /no) once a vote is running and someone started a vote ''cant vote right now, please wait until a vote is done" and on end Vote by $src: {your vote text} has ended /yes = {count of the humans did /yes} /no = {count of humands did /no} you can only vote once a vote and itll say voted yes if you did /yes