HomeSet [Deleted]

Status
Not open for further replies.
I hope Jakkee won't kill me, but something like this should work:

Python:
__title__ = 'Homes'
__author__ = 'JAKKEE'
__version__ = '1.0'

import clr
from System import *
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
from UnityEngine import *
import Pluton


class Homes:
    def On_PluginInit(self):
        Util.ConsoleLog(__title__ + " by " + __author__ + " Version: " + __version__ + " loaded.", False)
        if not Plugin.IniExists("Homes"):
            Plugin.CreateIni("Homes")
            ini = Plugin.GetIni("Homes")
            ini.AddSetting("(STEAMID)", "(LOCATION NAME)", "(LOCATION)")
            ini.AddSetting("(STEAMID)", "(LOCATION)", "(LOCATION NAME)")
            ini.Save()

    def On_Command(self, command):
        if command.cmd == "home":
            if len(command.args) == 0:
                command.User.Message("--------------SETHOME BY " + __author__ + "-------------")
                command.User.Message("usage: /home - Shows the help")
                command.User.Message("usage: /home [name] - Teleports you home")
                command.User.Message("usage: /sethome [name] - Sets a home")
                command.User.Message("usage: /delhome [name] - Deletes home")
                command.User.Message("*REPORT ANY BUGS TO: " + __author__ + "*")
                command.User.Message("--------------------------------------------")
            elif len(command.args) == 1:
                name = command.quotedArgs[0]
                ini = Plugin.GetIni("Homes")
                pyid = command.User.SteamID
                coords = ini.GetSetting(pyid, name)
                if coords is None:
                    command.User.Message("Can not find: " + name)
                    return
                else:
                    split = self.HomeOf(pyid, name)
                    loc = self.CreateVector3(split[0], split[1], split[2])
                    command.User.Message("You arrived at: " + name)
                    command.User.TeleportTo(loc)
        elif command.cmd == "sethome":
            if len(command.args) == 0:
                command.User.Message("usage: /sethome [name]")
            elif len(command.args) == 1:
                name = command.quotedArgs[0]
                pyid = command.User.SteamID
                ini = Plugin.GetIni("Homes")
                ini.AddSetting(command.User.SteamID, name, command.User.Location)
                ini.AddSetting(command.User.SteamID, "location", name)
                ini.Save()
                command.User.Message("Location: " + name + " saved!")
            elif len(command.args) > 1:
                command.User.Message("You are not allowed to use spaces!")
        elif command.cmd == "delhome":
            if len(command.args) == 0:
                command.User.Message("usage: /delhome [name]")
            elif len(command.args) == 1:
                name = command.quotedArgs[0]
                pyid = command.User.SteamID
                ini = Plugin.GetIni("Homes")
                current = ini.GetSetting(pyid, name)
                if current is not None:
                    ini.DeleteSetting(command.User.SteamID, name)
                    ini.DeleteSetting(command.User.SteamID, "location")
                    ini.Save()
                    command.User.Message("You deleted: " + name)
                    return
                else:
                    command.User.Message("Location " + name + " does not exist")
            elif len(command.args) > 1:
                command.User.Message("You can not use spaces")
    def CreateVector3(self, x, y, z):
        return Vector3(float(x), float(y), float(z))
      
    def HomeOf(self, id, Home):
        ini = Plugin.GetIni("Homes")
        check = ini.GetSetting(id, Home)
        if check is not None:
            c = check.replace("(", "")
            c = c.replace(")", "")
            return c.split(",")
        return None

:DPraise @DreTaX !!
 
  • Funny
Reactions: DreTaX
Last edited:
Status
Not open for further replies.