VoteParty

Abdu77

Tree Puncher
#1
------------------------------------------------------
VoteParty by ClashwithAb#8884
------------------------------------------------------


Plugins Required:
- Madcommands
- PocketVote

Available Features/Commands:
1. /voteparty
2. /voteparty forcestart
3. /voteparty api <api from minecraftpocket-servers.com>
4. /voteparty info

Code:

Code:
cmd create voteparty §eVP Main CMD §7: §dby ClashwithAb#8884

cmd add voteparty if %args%[1] = \"info\" then goto 51

cmd add voteparty let %status% = playerstatus(%p%)

cmd add voteparty if %status%[\"op\"] = %false% then message %p% §cYou do not have the permission to run this command.

cmd add voteparty if %status%[\"op\"] = %false% then exit

cmd add voteparty if %args%[1] = \"forcestart\" then goto 28

cmd add voteparty if %args%[1] = \"api\" then goto 46

cmd add voteparty load %api%

cmd add voteparty if varset(%api%) = %false% then message %p% §l§6Vote§eParty §7> §r§cAPI is not registered! Use /voteparty api <api>

cmd add voteparty if varset(%api%) = %false% then exit

cmd add voteparty %raw% = geturl(\"https://minecraftpocket-servers.com/api/?object=servers&element=voters&key=\" + %api% + \"&month=current&format=json\")

cmd add voteparty if varset(%raw%) = %false% then message %p% §l§6Vote§eParty §7> §r§cServer does not EXIST or the given API is wrong§e!

cmd add voteparty if varset(%raw%) = %false% then exit

cmd add voteparty %dat% = dejson(%raw%)

cmd add voteparty %voters% = %dat%[\"voters\"]

cmd add voteparty %size% = size(%voters%)

cmd add voteparty %num% = 0

cmd add voteparty %vt% = int(0)

cmd add voteparty async

cmd add voteparty if (%num% = %size%) or (%num% > %size%) then goto 25

cmd add voteparty %voter% = %voters%[%num%]

cmd add voteparty %v% = %voter%[\"votes\"]

cmd add voteparty %vt% = int(%vt%) + int(%v%)

cmd add voteparty %num% = %num% + 1

cmd add voteparty goto 19

cmd add voteparty sync

cmd add voteparty if %vt% notin array(50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000) then message onlineplayers() §l§6Vote§eParty §7> §r§bA player has just voted for our server§e! §bVoteParty occurs at every 50 votes§e. §cCurrent Votes§e: §d%vt%

cmd add voteparty if %vt% notin array(50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000) then exit

cmd add voteparty message onlineplayers() §l§6Vote§eParty §7> §r§bA player has just voted. VP will commence in §d60 secs §bas the total votes have reached a multiple of §a50§e!

cmd add voteparty sleep 30

cmd add voteparty message onlineplayers() §l§6Vote§eParty §7> §bCommencing in §d30 secs§e! §bPlease make space in your inventory.

cmd add voteparty sleep 20

cmd add voteparty message onlineplayers() §l§6Vote§eParty §7> §bCommencing in §d10 secs§e! §bPlease make space in your inventory.

cmd add voteparty sleep 10

cmd add voteparty message onlineplayers() §l§6Vote§eParty §7> §aStarted... Enjoy the Rewards§e!

cmd add voteparty sleep 5

cmd add voteparty %online% = onlineplayers()

cmd add voteparty %n% = 0

cmd add voteparty if %n% >= size(%online%) then sleep 5

cmd add voteparty if %n% >= size(%online%) then message onlineplayers() §l§6Vote§eParty §7> §r§cEnded§e. §bThe next Party will occur after §a50 §bvotes§e!

cmd add voteparty if %n% >= size(%online%) then exit

cmd add voteparty %player% = %online%[%n%]

cmd add voteparty #items here. Must be %player% not %p%

cmd add voteparty ascon /give %player% diamond 64

cmd add voteparty %n% = %n% + 1

cmd add voteparty goto 38

cmd add voteparty #api

cmd add voteparty let %args%[2] = %api%

cmd add voteparty save %api%

cmd add voteparty message %p% §l§6Vote§eParty §7> §aAPI Saved§e!

cmd add voteparty exit

cmd add voteparty #info

cmd add voteparty message %p% §e-------[§l§bCMD Info.§r§e]-------

cmd add voteparty message %p% §aPlugin by§e: §dAb774394

cmd add voteparty message %p% §aCreated on§e: §d26th July 2020

cmd add voteparty message %p% §e-------------------------

cmd add voteparty exit
Setting Up:

First and foremost you will have to setup the API which can be obtained from https://minecraftpocket-servers.com/dashboard -> Manage Servers -> API
Copy the API given and use
/voteparty api <paste api>

Eg: /voteparty api ae083ffj3a83aleih350ae

Then do /voteparty to load the api and get the list of votes.
Remember: Only votes with a registered playername will be counted - anonymous votes will not be counted.

Adding Rewards: (Only add rewards after finishing the whole cmd)
The default reward is 64 diamonds which can be edited on line 43
Add rewards with:
cmd edit voteparty 43 (command, Use %player% instead of %p%)
Eg: cmd edit voteparty 43 ascon /give %player% 42 1


Finally set it up with Pocketvote by:
/pocketvote cmd add voteparty

Now the VP cmd is fully set up and functional. Vote yourself and check it out! The VP will automatically start when your server votes reaches a multiple of 50.
 

Abdu77

Tree Puncher
#2
What is VoteParty?

VoteParty allows you to reward all the players present on the server after reaching a certain amount of votes or a multiple of that number. (i.e. 25 / 50)
This encourages players to vote for your server.
VoteParty and VoteRewards are different as the latter only rewards that player who votes for the server at that time.