SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 23/08/2011, 02:01 PM   #1
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 2
Default IsPlayerXAdmin(playerid)) Problem

I am using Xtreme Admin and I have this function in XtremeAdmin.inc:
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:
Code:
#include "xadmin/XtremeAdmin.inc"

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...
Tigerbeast11 is offline  
Old 23/08/2011, 02:06 PM   #2
Kingunit
High-roller
 
Kingunit's Avatar
 
Join Date: Dec 2010
Location: The Netherlands
Posts: 1,507
Reputation: 120
Default Re: IsPlayerXAdmin(playerid)) Problem

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.
__________________
Kingunit is offline  
Old 23/08/2011, 02:33 PM   #3
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 2
Default Re: IsPlayerXAdmin(playerid)) Problem

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.

Last edited by Tigerbeast11; 23/08/2011 at 03:22 PM.
Tigerbeast11 is offline  
Old 24/08/2011, 07:26 AM   #4
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: IsPlayerXAdmin(playerid)) Problem

Use this.
http://wiki.sa-mp.com/wiki/Per-player_variable_system
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 08:49 AM   #5
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 2
Default Re: IsPlayerXAdmin(playerid)) Problem

Where would I set the pVar?
Tigerbeast11 is offline  
Old 24/08/2011, 09:00 AM   #6
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: IsPlayerXAdmin(playerid)) Problem

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;
}
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 09:04 AM   #7
Tigerbeast11
Gangsta
 
Join Date: Aug 2009
Posts: 771
Reputation: 2
Default Re: IsPlayerXAdmin(playerid)) Problem

Thanks mate! +Rep!
Tigerbeast11 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem playerid RatHack Help Archive 4 16/07/2011 03:04 PM
playerid problem ajwar Help Archive 1 14/07/2011 09:30 AM
problem playerid=0 jasonnw666 Help Archive 10 09/06/2010 08:12 AM
problem with playerid David_Omid Help Archive 4 13/04/2009 01:08 AM


All times are GMT. The time now is 04:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.