I'm trying to set flags for both admins/non-admins if they've donated to the gaming group I'm writing the plugin for. This allows them to open a VIP-only menu where they can access VIP-only commands.
However, it seems to be overwriting the flags that admins already have - meaning that while the admin-player can access the menu, they lose their admin privileges. Quote from the admin:
Quote:
As for the admin issue it seems to happen randomly. On occasion both will work and other times only the perks work and the admin wont.
|
Here's the relevant code:
Code:
SetFlags(client)
{
if (g_VipRank[client] == 2)
{
// check if user is admin already
new AdminId:id = GetUserAdmin(client);
if (id == INVALID_ADMIN_ID)
{
new AdminId:admin = CreateAdmin("VIP2");
SetAdminFlag(admin, Admin_Reservation, true);
SetUserAdmin(client, admin);
}
else
{
SetAdminFlag(id, Admin_Reservation, true);
}
}
else if (g_VipRank[client] == 1)
{
// check if user is admin already
new AdminId:id = GetUserAdmin(client);
if (id == INVALID_ADMIN_ID)
{
new AdminId:admin = CreateAdmin("VIP1");
SetAdminFlag(admin, Admin_Custom1, true);
SetUserAdmin(client, admin);
}
else
{
SetAdminFlag(id, Admin_Custom1, true);
}
}
}
Any ideas?