IsPlayerXAdmin(playerid)) Problem
#1

I am using Xtreme Admin and I have this function in XtremeAdmin.inc:
pawn Code:
stock IsPlayerXAdmin(playerid) return (Variables[playerid][LoggedIn] && Variables[playerid][Level]) ? true:false;
This function works fine in the FilterScript. But I want to use it in my GameMode:
pawn Code:
#include "xadmin/XtremeAdmin.inc"
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        if(IsPlayerXAdmin(playerid))
        {
            SendClientMessage(playerid,orange,"You are an admin");
        }
        else
        {
            SendClientMessage(playerid,orange,"You are not an admin");
        }
        return 1;
    }
    return 0;
}
But the problem is, the game mode script doesn't recognise me as an admin. The filterscript works fine, but I wanna use this function in my Gamemode...
Reply
#2

Maybe this sounds not usefull for you, but why you don't start your own system in your gamemode.
That's much much much better.
Reply
#3

Quote:
Originally Posted by Kingunit
View Post
Maybe this sounds not usefull for you, but why you don't start your own system in your gamemode.
That's much much much better.
Xtreme Admin comes with commands that I wouldn't normally be able to construct. Plus, I'm making a multi-gamemode server, so for me, it would be easier to just use a fs with admin commands.
Reply
#4

Use this.
https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#5

Where would I set the pVar?
Reply
#6

pawn Code:
//Where you have the include
public OnPlayerConnect(playerid)
{
    if(IsPlayerXAdmin(playerid)) SetPVarInt(playerid,"Admin",1)
    else  SetPVarInt(playerid,"Admin",0)
    return 1;
}

//On your GM
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        if(GetPVarInt(playerid,"Admin") == 1)
        {
            SendClientMessage(playerid,orange,"You are an admin");
        }
        else
        {
            SendClientMessage(playerid,orange,"You are not an admin");
        }
        return 1;
    }
    return 0;
}
Reply
#7

Thanks mate! +Rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)