Hey! I need help even getting oxide players's group or creating a group system myself just to have diferenced players. Can I create 4 groups saved in a file nd assign that group to a player? Or pls help me with arrays D: Wulf help! xD
[DOUBLEPOST=1452528456][/DOUBLEPOST]I got this array that u told me:
[LibraryFunction("GetUserGroups")]
public string[] GetUserGroups(string userid)
{
// First, get the user data
var data = GetUserData(userid);
// Return the group
return data.Groups.ToArray();
}
But i dont know how to convert the array into a string or check if the group is the group i want![]()
Solved Getting player's group, creating new? (C#)
Discussion in 'Rust Development' started by TheMechanical97, Jan 9, 2016.
-
If(array.Contains("group1"))
-
Thanks

[DOUBLEPOST=1452613392][/DOUBLEPOST]Getting this error:
Type `System.Array' does not contain a definition for `contains' and no extension method `contains' of type `System.Array' could be found. Are you missing an assembly reference? -
C# is case-sensitive. It should be array.Contains and not array.contains
-
Array Owner = (BetterChat.Call("PlayerInGroup", player, group));
if (Owner.Contains("owner"))
{
PrintToChat(player, "You are not in Owners Group");
}
PrintToChat(player, "You are in Owner Group"); -
If you just want to check if he is in the owner group, use
Code:bool isOwner = BetterChat?.Call("PlayerInGroup", player, "owner"); if(isOwner) SendReply(player, "You are Owner!"); -
Gonna try it

[DOUBLEPOST=1452626865][/DOUBLEPOST]Cannot implicitly convert type `object' to `bool'. An explicit conversion exists (are you missing a cast?) :S -
You maybe wanna learn a bit more about C# basics.Code:
bool isOwner = (bool)BetterChat?.Call("PlayerInGroup", player, "owner") ?? false; if(isOwner) SendReply(player, "You are Owner!"); -
yeah :S
-
C# Tutorial <- may help you
-
Thankss
-
No problem

My advise: Experiment with the infos you read, that is a lot better than just reading and trying to understand. Use the info and build something, even though it may seem to be useless - it is not as you will learn from it -
I've larnt soo much here
Just looking other ppol plugins I made a few one and cuttently I have a jobs plugin working on my server coded by me
