sbpp / sourcebans-pp

Admin, ban, and comms management system for the Source engine
https://sbpp.github.io/
Creative Commons Attribution Share Alike 4.0 International
336 stars 174 forks source link

Natives for Admin Management #538

Open DJPlaya opened 5 years ago

DJPlaya commented 5 years ago

Is your feature request related to a problem? Please describe.

Can we have Admin Management with Natives again? For Example it could be used in a VIP/Donator System.

These Natives are from SB 2.0

/**

  • Get SourceBans admin id from client
  • @param client The index of the client
  • @return The admin id of the client */ native int SB_GetAdminId(int client);

/**

  • Adds an admin to the SourceBans database
  • @param client The index of the client (person adding admin)
  • @param name The name of the admin to add
  • @param authtype The authentication type (AUTHMETHOD_STEAM, AUTHMETHOD_IP, AUTHMETHOD_NAME)
  • @param identity The Steam ID, IP address or name of the admin based on authtype
  • @param password The password for the admin (optional)
  • @param groups The groups to assign to the admin (optional)
  • @error Invalid authtype */ native void SB_AddAdmin(int client, const char[] name, const char[] authtype, const char[] identity, const char[] password = "", const char[] groups = "");

/**

  • Deletes an admin from the SourceBans database
  • @param client The index of the client (person deleting admin)
  • @param authtype The authentication type (AUTHMETHOD_STEAM, AUTHMETHOD_IP, AUTHMETHOD_NAME)
  • @param identity The steamid, ip, or name of admin based on authtype
  • @error Invalid authtype */ native void SB_DeleteAdmin(int client, const char[] authtype, const char[] identity);

/**

  • Adds a group to the SourceBans database
  • @param client The index of the client (person adding group)
  • @param name The name of the new group
  • @param flags The flags to assign to the group
  • @param immunity The immunity to assign to the group (optional) */ native void SB_AddGroup(int client, const char[] name, const char[] flags, int immunity = 0);

/**

  • Deletes a group from the SourceBans database
  • @param client The index of the client (person deleting group)
  • @param name The name of the group to delete */ native void SB_DeleteGroup(int client, const char[] name);

/**

  • Sets an admin's groups in the SourceBans database
  • @param client The index of the client (person setting groups)
  • @param authtype The authentication type of the admin (AUTHMETHOD_STEAM, AUTHMETHOD_IP, AUTHMETHOD_NAME)
  • @param identity The steamid, ip, or name of admin based on authtype
  • @param groups The groups to set the admin to; blank, or default is to reset groups
  • @error Invalid authtype */ native void SB_SetAdminGroups(int client, const char[] authtype, const char[] identity, const char[] groups = "");

Describe the solution you'd like

Adding thees Natives

Describe alternatives you've considered

Alternative Solutions? I can access the Database manually, but thats Bullshit.

Additional context

rumblefrog commented 5 years ago

Is there a reason why you can't query the database in the plugin would otherwise be using the native?

I'm not entirely sure if this feature feasible or have enough use cases.

DJPlaya commented 5 years ago

Well, of course querying the Database in every Plugin would be possible, still this isent as Efficient as using only 1 DB Handle. Also it is more easy to use Natives instead of doing it manually which is often difficult for unexperienced Coders.