admin team? - 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)
+--- Thread: admin team? (
/showthread.php?tid=336788)
admin team? -
oscar7610 - 23.04.2012
How can I make a Team only for admins? When he selects the class it tell him "Class only for admins"
Re: admin team? -
Jows - 23.04.2012
you have some admin system in your gm?
Re: admin team? -
oscar7610 - 23.04.2012
luxadmin and rcon obviously
Re: admin team? -
Jows - 23.04.2012
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 1 && !IsPlayerAdmin(playerid)) // the class id
{
// code here
return 0;
}
return 1;
}
Re: admin team? -
oscar7610 - 23.04.2012
Quote:
Originally Posted by Jows
pawn Code:
public OnPlayerRequestClass(playerid, classid) { if(classid == 1 && !IsPlayerAdmin(playerid)) // the class id { // code here return 0; } return 1; }
|
wont work
Re: admin team? -
zSuYaNw - 23.04.2012
You can use GetPlayerSkin
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 100/* admin skin */ && !IsPlayerAdmin(playerid)) // the skin id
{
// code here
return 0;
}
return 1;
}
Re: admin team? -
Elysian` - 23.04.2012
Try this.
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerAdmin(playerid)
{
SetPlayerPos();
// Other stuff here
}
else SendClientMessage(playerid,-1, "You have to be an administrator to use this class!");
return 1;
}
Re: admin team? -
Burridge - 23.04.2012
Windows32:
Your code won't work properly because you aren't checking skin IDs. Therefore anyone who isn't an admin will not be able to spawn.
oscar7610:
Why won't Jows' code work? What are the errors you are getting from it? Also take a look at the wiki page for the
OnPlayerRequestClass callback. As it gives an example of restricting certain classids to RCON admins.
Re: admin team? -
ViruZz - 23.04.2012
Here is a easier way.
Forward
pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);
On Gamemode init add this
pawn Code:
AddPlayerClassEx(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
If not this
pawn Code:
AddPlayerClass(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
On the PlayerRequestSpawn put this
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
Easier and simple to make more class's
Then on the setupplayerteamclass put thispublic
pawn Code:
public SetPlayerTeamFromClass(playerid, classid)
{
{
if (classid == 100))
{
gTeam[playerid] = Admin;
GameTextForPlayer(playerid, "Admin", 500, 5);
SendClientMessage(playerid, /*Your color here example*/COLOR_RED, "This class is only for administrators");
return 1;
}
return 1;
}
Re: admin team? -
Elysian` - 24.04.2012
Quote:
Originally Posted by Burridge
Windows32:
Your code won't work properly because you aren't checking skin IDs. Therefore anyone who isn't an admin will not be able to spawn.
|
Yeah sorry I know what you mean!