SA-MP Forums Archive
IsPlayerXAdmin(playerid)) Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: IsPlayerXAdmin(playerid)) Problem (/showthread.php?tid=278688)



IsPlayerXAdmin(playerid)) Problem - Tigerbeast11 - 23.08.2011

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...


Re: IsPlayerXAdmin(playerid)) Problem - Kingunit - 23.08.2011

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.


Re: IsPlayerXAdmin(playerid)) Problem - Tigerbeast11 - 23.08.2011

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.


Re: IsPlayerXAdmin(playerid)) Problem - =WoR=Varth - 24.08.2011

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


Re: IsPlayerXAdmin(playerid)) Problem - Tigerbeast11 - 24.08.2011

Where would I set the pVar?


Re: IsPlayerXAdmin(playerid)) Problem - =WoR=Varth - 24.08.2011

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;
}



Re: IsPlayerXAdmin(playerid)) Problem - Tigerbeast11 - 24.08.2011

Thanks mate! +Rep!