Solved VIP++ + Home system for VIP players

paskal

New Member
Member
Aug 9, 2014
12
1
3
I tried to write it but no answers, people are waiting for home in VIP ...
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
And add one function is not criminal. Do not you think?
Well first off all remove this:
JavaScript:
        break;
        if(isVip(Player) == true || Player.Admin == true){
           
------>        switch(cmd){       <--------
    case "sethome":
    if(!Plugin.IniExists("data\\" + isVip(Player).SteamID + "-home")){
        var set = Plugin.CreateIni("data\\" + isVip(Player).SteamID + "-home");
        var zset = isVip(Player).Z;
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Then try it. So far, thank you for the advice
I'll work on a unofficial VIP++ sethome plugin as a addon.
So far I got;
/home [name] (Teleports you home)
/homelist (Lists all your homes)
/delhome [name] (Removes a home)
/sethome [name] (Sets home)
I just need to know to read a config file from another plugin folder (VIPsettings)
@DreTaX or @balu92 do you know how to read a config file from another folder?
 
  • Like
Reactions: paskal

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
  • Like
Reactions: paskal

balu92

Retired Staff
Retired Staff
Trusted Member
Jul 11, 2014
338
75
28
34
I'll work on a unofficial VIP++ sethome plugin as a addon.
So far I got;
/home [name] (Teleports you home)
/homelist (Lists all your homes)
/delhome [name] (Removes a home)
/sethome [name] (Sets home)
I just need to know to read a config file from another plugin folder (VIPsettings)
@DreTaX or @balu92 do you know how to read a config file from another folder?
that's what datastore is for
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
that's what datastore is for
I'll work on a unofficial VIP++ sethome plugin as a addon.
So far I got;
/home [name] (Teleports you home)
/homelist (Lists all your homes)
/delhome [name] (Removes a home)
/sethome [name] (Sets home)
I just need to know to read a config file from another plugin folder (VIPsettings)
@DreTaX or @balu92 do you know how to read a config file from another folder?
Cant you do:
JavaScript:
Data.GetConfigValue("pluginnamehere", "Settings", "sasas");

Edit: Its an ini cfg, okay nvm xD
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
I meant like
JavaScript:
var iniCfg = Plugin.GetIni("Settings");
    if (iniCfg.GetSetting("Config", "Enabled") == "False") {
Except the Config file is not at root/Fougerite/VIPaddon/VIPsettings
Its located at root/Fougerite/ VIP++/VIPsettings
You could try using
JavaScript:
var path = Util.GetRootFolder() + "\Fougerite\VIP++\VipSettings";
var ini = Plugin.GetIni(path);
Maybe that could work, i just peaked inside the plugin.cs

C#:
public IniParser GetIni(string path)
{
            path = ValidateRelativePath(path + ".ini");
            if (path == null)
                return null;
         
            if (File.Exists(path))
                return new IniParser(path);

            return null;
}
Give it a try
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Just gave it a go plugin doesn't load when it the checking for vip is there:
JavaScript:
if(isVip(Player) == true || Player.Admin == true){
and this the function:
JavaScript:
function isVip(Player)
{
    var path = Util.GetRootFolder() + "\Fougerite\VIP++\VipSettings";
    var ini = Plugin.GetIni(path);
    if (ini.GetSetting("VipList", Player.SteamID) != null)
    {
        return true;
    }else{
        return false;
    }
}
If I remove the isVip(Player) line the plugin will load.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Just gave it a go plugin doesn't load when it the checking for vip is there:
JavaScript:
if(isVip(Player) == true || Player.Admin == true){
and this the function:
JavaScript:
function isVip(Player)
{
    var path = Util.GetRootFolder() + "\Fougerite\VIP++\VipSettings";
    var ini = Plugin.GetIni(path);
    if (ini.GetSetting("VipList", Player.SteamID) != null)
    {
        return true;
    }else{
        return false;
    }
}
If I remove the isVip(Player) line the plugin will load.
Can you do printscreen the result of this: Player.Message("asd: " + Util.GetRootFolder());
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Can you do printscreen the result of this: Player.Message("asd: " + Util.GetRootFolder());
Nothing happens when I do /testbro
JavaScript:
function On_Command(Player, cmd, args) {
    if(cmd == "testbro") {
        Player.Message("asd: " + Util.GetRootFolder());
        }
    else {
    Player.message("Theres an error m8");
    }
}
Same with this

JavaScript:
function On_PluginInit() {
    Player.Message("asd: " + Util.GetRootFolder());
}