EasyAirdrops (beta, only 1 issue left)
I originally checked out the other airdrop plugins but they were buggy or flat out didnt work. I didn't need many features. However, I am stuck on a DataStore part and need some help. Considering this is my second week at making plugins, and I have tried many different API options to get the desired result, none have solved my issue and I am now out of idea's of what should be modified.
Problem location is:
Seems it doesn't want to get the value and check against it. I'm sure its a simple fix...
I originally checked out the other airdrop plugins but they were buggy or flat out didnt work. I didn't need many features. However, I am stuck on a DataStore part and need some help. Considering this is my second week at making plugins, and I have tried many different API options to get the desired result, none have solved my issue and I am now out of idea's of what should be modified.
Code:
//Plugin:EasyAirdrops
//Author:CorrosionX
//Version:1.0
function On_PluginInit(){
if (!Plugin.IniExists("EasyAirdrops")){
var setini = Plugin.CreateIni("EasyAirdrops");
setini.AddSetting("Settings", "PlayersRequired", 3); //Default
setini.AddSetting("Settings", "DropFrequency", 600); //In Seconds!
setini.Save();
}else{
var ini = EasyAirdropsIni();
}
var Drop_Time = ini.GetSetting("Settings", "DropFrequency")*1000;
DataStore.Add("airdrop", "call", 0);
Plugin.CreateTimer("AirDropTimer", Drop_Time).Start();
}
function On_PlayerConnected(Player){
var ini = EasyAirdropsIni();
var Req_Players = ini.GetSetting("Settings", "PlayersRequired");
if(Req_Players == Server.Players.Count || Req_Players < Server.Players.Count){
DataStore.Remove("airdrop", "call");
DataStore.Add("airdrop", "call", 1);
Server.Broadcast("AirDrops are now being called for!"); //debug
}
Player.Message("Required Players=" + Req_Players); //debug
}
function On_PlayerDisconnected(Player){
var ini = EasyAirdropsIni();
var Req_Players = ini.GetSetting("Settings", "PlayersRequired");
if(Req_Players > Server.Players.Count ){
DataStore.Remove("airdrop", "call");
DataStore.Add("airdrop", "call", null);
//Server.Broadcast("Not enough people online to call airdrops!"); //debug
}
}
function AirDropTimerCallback(){
var ini = EasyAirdropsIni();
var Drop_Time = ini.GetSetting("Settings", "DropFrequency")*1000;
Server.Broadcast("Timer Completed. Drop Frequency =" + Drop_Time); //debug
if(DataStore.Get("airdrop", "call") == 1){
World.Airdrop();
Server.Broadcast("AirDrop on its way!"); //debug
}
Plugin.CreateTimer("AirDropTimer", Drop_Time).Start();
}
function EasyAirdropsIni(){
return Plugin.GetIni("EasyAirdrops");
}
Code:
if(DataStore.Get("airdrop", "call") == 1){
World.Airdrop();
Server.Broadcast("AirDrop on its way!"); //debug
}