1. So i want to make a new plugin like /sendadm "yourname" "message"
    .... how is this possible can someone give me an example ?
     
  2. - Loop all players
    - if player is an admin
    - send message
     
  3. I know i know but i want to have an example written
     
  4. - Loop through activePlayerList
    - Check if current player has admin flag
    - If so send the message, if not continue with next loop

    Jakkee already gave you perfect pseudo code, we wont code the plugin for you.
    Try converting each pseudo code line into actual code and if you're stuck post your code and we will help you figure out your mistakes but we wont write the plugin for you.
     
  5. I did it but
    error:
     
  6. Hard to say without seeing the coded, but the indexes start from 0, so player 1 is = 0 and for example 6th player is = 5. So you probably - 1 onlineplayer and loop then
     
  7. Here is the command
    Code:
    function PLUGIN:cmdTest(player, cmd, args)local message = args[1]if (message == nil) then
    rust.SendChatMessage(player, self.Config.Messages.NoMessage)
    return
    end
    if args[2] then
        rust.SendChatMessage(player, self.Config.Messages.NoQuotes)
        return
    end
    local onlinePlayerCount = global.BasePlayer.activePlayerList.Count
    local steamId = rust.UserIDFromPlayer(player)
    if permission.UserHasPermission(steamId, "cansee") then
    rust.SendChatMessage(player, self.Config.Settings.ChatName, self.Config.Messages.TestFrom .. " " .. rust.QuoteSafe(player.displayName) .. ": " .. message)
    else
    rust.SendChatMessage(player, "No Permission")
    end
    end
    
     
  8. Wulf

    Wulf Community Admin

    You are trying to use args that don't exist, start with args[0] and increment for each argument.
     
  9. You are trying to use args that don't exist, start with args[0]
    ..
    didnt get it
    so local must be "local message = args[0]"?
     
  10. Yeah, and you have args[2] there too, so you need to change it to args[1].

    But if player just does command /sendadm without anything else, you will probably get an error. So you need to check if there is any arguments or otherwise it will still throw error about Array index out of range


    Code:
    if(args.Length == 0) then
    -- Send message to player example ("Correct syntax is /sendadm name message")
        return
    end
     
  11. - Get message from Args
    - Save Arg or Args in a variable (e.g: x)
    - loop all active players
    - If active player is an admin
    - send message: (PlayerXYZ said Variable x)
    - Else
    - Continue loop
    Follow this pseudo code.
    Its simple, Just trial & error until its working. :)
     
  12. Got it thanks