1. Can someone give me an example of this function. If a certain player logs in it gives them a message and then it teleports them 30seconds later to a specified location. Also I need a command function that sets this location which only admins can.
     
  2. Lets see how is my lua xD

    so
    Permission for the /changepos => "canchangepos"
    commands /changepos

    Sorry if i made a mistake :p

    Also try to write it alone. Take a look at mine the only thing that u need to remember is
    local playerpos = player.transform.position the other things are just simple lua.
    We wont write u the code every time becaues u wont learn like that. I just gave u an example.
    Code:
    function PLUGIN:Init()
    self:LoadDefaultConfig()
    command.AddChatCommand("changepos",  self.Plugin, "cmdChangePos")
    permission.RegisterPermission("canchangepos", self.Plugin)
    endfunction PLUGIN:LoadDefaultConfig()self.Config.Position = self.Config.Position or {}
    self.Config.Position.X = self.Config.Position.X or 31
    self.Config.Position.Y = self.Config.Position.Y or 32
    self.Config.Position.Z = self.Config.Position.Z or 33self:SaveConfig()
    endfunction PLUGIN:cmdChangePos(player, cmd, args)
    local steamId = rust.UserIDFromPlayer(player)
    if permission.UserHasPermission(steamId, "canchangepos") then
    local playerpos = player.transform.position
    self.Config.Position.X = playerpos.x
    self.Config.Position.Y = playerpos.y
    self.Config.Position.Z = playerpos.z
    self:SaveConfig()
    end
    endfunction PLUGIN:OnPlayerInit(player)
    rust.SendChatMessage(player, "Welcome to ........ In 30seconds you will get teleported somewhere")
    timer.Once(30, function()
    rust.ForcePlayerPosition(player, self.Config.Position.X, self.Config.Position.Y, self.Config.Position.Z)
    end, self.Plugin)
    
     
    Last edited by a moderator: Jul 27, 2015
  3. Ye I totally understand. I'm definitely getting better but stuggling atm.
     
  4. Man you should read the oxide api, as well as some lua documentation off-site

    This whole section is just threads from you
     
  5. you forgot an "end" at the end
    :p

    A little cleaned up:

    Code:
    function PLUGIN:Init()
        self:LoadDefaultConfig()
        command.AddChatCommand("changepos",  self.Plugin, "cmdChangePos")
        if not permission.PermissionExists("canchangepos") then permission.RegisterPermission("canchangepos", self.Plugin)
    endfunction PLUGIN:LoadDefaultConfig()    self.Config.Position = self.Config.Position or {}
        self.Config.Position.X = self.Config.Position.X or 31
        self.Config.Position.Y = self.Config.Position.Y or 32
        self.Config.Position.Z = self.Config.Position.Z or 33    self:SaveConfig()
    endfunction PLUGIN:cmdChangePos(player, cmd, args)
        local steamId = rust.UserIDFromPlayer(player)
        if permission.UserHasPermission(steamId, "canchangepos") then
            self.Config.Position.X = player.transform.position.x
            self.Config.Position.Y = player.transform.position.y
            self.Config.Position.Z = player.transform.position.z
            self:SaveConfig()
        end
    endfunction PLUGIN:OnPlayerInit(player)
        rust.SendChatMessage(player, "Welcome to ........ In 30seconds you will get teleported somewhere")
       
        timer.Once(30, function()
            rust.ForcePlayerPosition(player, self.Config.Position.X, self.Config.Position.Y, self.Config.Position.Z)
        end, self.Plugin)
       
    end
     
  6. Yeah.. because i wrote it in this text editor xD
     
  7. also you forgot the "self:SaveConfig()" in the command, and setting the playerpos variable is totally uneeded