1. hi Oxide developers! i m really new to these plugnis things. i have 2 questions

    1. I want a timer that send broadcast message with current player name + player coordinates in 1 min timer. in c# lang

    ex: <playername>'s location is : x-y-z.

    2. whenever i try i put any c# codes in my plugins i get error like : the "xxx" doesnt exist current context.. how can i solve these errors.
     
  2. Try pasting your code, that way we can see what may be causing the issues you were describing. I'll post a snippet that should do what you want in a little bit. (if I remember)
     
  3. Sorry

    i solved half of codes here is codes i used: when i use it , returns error

    Code:
              bool CountTick = true;
    int CountedTicks = 52;  
    void OnTick(BasePlayer player)
    {    if(CountTick)
       {
         CountedTicks--;
         if(CountedTicks <= 0)
         {
         
              rust.BroadcastChat(player.userID+"  producing");
           CountTick = true;
           CountedTicks = 51;
         }
       }
    }

    error:

    Code:
    [Oxide] 03:53 [Error] Failed to call hook 'OnTick' on plugin 'PoliticalSurvival
    v0.2.0' (NullReferenceException: Object reference not set to an instance of an o
    bject)
    [Oxide] 03:53 [Debug]   at Oxide.Plugins.PoliticalSurvival.OnTick (.BasePlayer p
    layer) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PoliticalSurvival.DirectCallHook (System.String name, System.
    Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[]
    args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[]
    args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] arg
    r

    and another question,:

    i cant use timer

    timer.Repeat(5f, 0, () =>
    {
    Puts("Hello world!")
    });

    it errors that i cant use > symbol. in case of solution this error, how can i use Baseplayer player in timer?
     
  4. Wulf

    Wulf Community Admin

    OnTick does not have BasePlayer or any arguments for that matter. Check the Timer information in the Docs link at the top of the page.
     
  5. unexpected symbol '<' in class ..... i use this code:

    Code:
    timer.Repeat(5f, 0, () =>
    {
      rust.BroadcastChat("producing"));
    });
     
  6. Wulf

    Wulf Community Admin

    The error isn't with that code, I'd need to see your log and full code.
     
  7. Wulf

    Wulf Community Admin

  8. so i want to broadcast chat every 20 seconds with current player name and position. How i can i do that?
     
  9. Wulf

    Wulf Community Admin

    You'd need to place it somewhere where BasePlayer is available and needs to be.
     
  10. i want broadcast chat on everytime , i tried init, timer worked but Baseplayer not.
     
  11. Wulf

    Wulf Community Admin

    If you want it to start when the server is started, you'd need to loop all players using foreach and BasePlayer.activePlayerList, broadcasting the message in that loop for each player.
     
  12. if you know that plugin, President.cs is presidents sytem that president can tax everyplayer by taking commision their gathers. I wanted to add a small code that if current player is president, System will automatically sends the current presidents coordinats so everyone can see where is he and find/kill him. Can you help me?
     
  13. Wulf

    Wulf Community Admin

    I'd add the timer and the broadcast under void SetPresident(ulong SteamId), but you'd need to get get the player using BasePlayer.FindPlayer(SteamId) and then send the message using the player you get from that. Experiment a bit, it won't bite you. ;)
     
  14. i solved with smt different, instead of timered info, i added a small code into command "info"
    Code:
                SendReply(Player, "President Cords" + ": " + BasePresident.transform.position);
    so everyplayer can write /info in chat to see president cords