2 in 1 Command List
#1

Anyone know how to make Vip and Admins in 1 command?

When a player type /admins

This should be printed in their screen using Dialog msgbox.

Код:
     Online Staff
            
            Admins Online:
            Level:5 - Sample (ID:0) | Moderator | Playing!

 
            Very Important Person Online:
            Level 1: Sample (ID:0) | Silver | Playing!
Here's the script for admin list:

Код:
dcmd_admins(playerid,params[])
{
    #pragma unused params
        new count = 0;
        new string[128], string2[128];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
             if (IsPlayerConnected(i))
             {
                if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
                 {
                    if(AccInfo[i][Level] > 5)
                    {
                        AdmRank = "Professional Admin";
                    }
                    if(IsPlayerAdmin(i))
                      {
                          AdmRank = "RCON Administrator";
                      }
                    else
                    {
                         switch(AccInfo[i][Level])
                        {
                            case 1: {
                            AdmRank = "Basic Moderator";
                            }
                            case 2: {
                            AdmRank = "Moderator";
                            }
                            case 3: {
                            AdmRank = "Master Moderator";
                            }
                            case 4: {
                            AdmRank = "Administrator";
                            }
                            case 5: {
                            AdmRank = "Master Administrator";
                            }
                        }
                    }
                    switch(AccInfo[i][OnDuty])
                    {
                        case 0: AdmDuty = "Playing!";
                        case 1: AdmDuty = "On Duty!";
                    }
                    format(string, 128, "{99CCFF}Level: %d - {FFD119}%s (ID:%i) {99CCFF}| %s | {99CCFF}%s\n",AccInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
                    strcat(string, string2, sizeof(string));
                    count++;
                }
            }
        }
        if (count == 0)
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"Admins Online" ,"{FFD119}No administrator online", "Close", "");
        else
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"Admins Online" ,string, "Close", "");
        return 1;
}
And this is for Vip list
Код:
dcmd_viplist(playerid,params[])
{
	#pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
		if(AccInfo[playerid][Level] >= 1)
		{
	 		new bool:First2 = false;
	 		new Count, i;
		    new string[128];
			new adminname[MAX_PLAYER_NAME];
		    for(i = 0; i < MAX_PLAYERS; i++)
			if(IsPlayerConnected(i) && AccInfo[i][pVip] > 0)
			Count++;
			
			if(Count == 0)
			return SendClientMessage(playerid,red, "No players have VIP Account!");
			
		    for(i = 0; i < MAX_PLAYERS; i++)
			if(IsPlayerConnected(i) && AccInfo[i][pVip] > 0)
			{
				if(AccInfo[i][pVip] > 0)
				{
					switch(AccInfo[i][pVip])
    				{
					case 1: AccType = "Silver";
					case 2: AccType = "Gold";
					case 3: AccType = "Premium";
					}
				}
 				GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2)
				{
					format(string, sizeof(string), "VIP Players: %d(%s)", i,AccType);
					First2 = true;
				}
   					else format(string,sizeof(string),"%s, %d(%s)",string,i,AccType);
	        }
		    return SendClientMessage(playerid,yellow,string);
		}
		else return ErrorMessages(playerid, 1);
	}
	else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Reply
#2

merge both of them under 1 command.
Reply
#3

Quote:
Originally Posted by Dare Devil.....
Посмотреть сообщение
merge both of them under 1 command.
How? that is also one of my questions..
Reply
#4

pawn Код:
dcmd_staffs(playerid,params[])
{
    #pragma unused params
    //if(AccInfo[playerid][LoggedIn] != 1) return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
    //if(AccInfo[playerid][Level] < 1) return ErrorMessages(playerid, 1);
    new count1 = 0, count2 = 0;
    new string[512]; //Because you use Dialog to show "Staff list", you can decrease or increase it.
    strcat(string, "Admins online:\n\n");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
        {
            if(AccInfo[i][Level] > 5)  AdmRank = "Professional Admin";
            if(IsPlayerAdmin(i)) AdmRank = "RCON Administrator";
            else
            {
                switch(AccInfo[i][Level])
                {
                    case 1: AdmRank = "Basic Moderator";
                    case 2: AdmRank = "Moderator";
                    case 3: AdmRank = "Master Moderator";
                    case 4: AdmRank = "Administrator";
                    case 5: AdmRank = "Master Administrator";
                }
            }
            switch(AccInfo[i][OnDuty])
            {
                case 0: AdmDuty = "Playing!";
                case 1: AdmDuty = "On Duty!";
            }
            format(string, sizeof(string), "%s{A9C4E4}Level: %d - {FFD119}%s (ID:%i) {A9C4E4}| %s | %s\n", string, AccInfo[i][Level], PlayerName2(i), i, AdmRank, AdmDuty);
            count1++;
        }
    }
    if(count1 == 0) strcat(string, "{FFD119}No administrators online{A9C4E4}\n");
    strcat(string, "\nVIP Players online:\n\n");
    for(new vips = 0; vips < MAX_PLAYERS; vips++)
    {
        if(IsPlayerConnected(vips) && AccInfo[vips][pVip] > 0)
        {
            switch(AccInfo[vips][pVip])
            {
                case 1: AccType = "Silver";
                case 2: AccType = "Gold";
                case 3: AccType = "Premium";
            }
            format(string, sizeof(string), "%s{FFD119}%s (ID: %d){A9C4E4} | VIP Type: %s\n", string, PlayerName2(vips), vips, AccType);
            count2++;
        }
    }
    if(count2 == 0) strcat(string, "{FFD119}No players have VIP Account!{A9C4E4}\n");
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Staffs Online" ,string, "Close", "");
    return 1;
}
Result:
Reply
#5

Quote:
Originally Posted by Andi_Evandy
Посмотреть сообщение
pawn Код:
dcmd_staffs(playerid,params[])
{
    #pragma unused params
    //if(AccInfo[playerid][LoggedIn] != 1) return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
    //if(AccInfo[playerid][Level] < 1) return ErrorMessages(playerid, 1);
    new count1 = 0, count2 = 0;
    new string[512]; //Because you use Dialog to show "Staff list", you can decrease or increase it.
    strcat(string, "Admins online:\n\n");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
        {
            if(AccInfo[i][Level] > 5)  AdmRank = "Professional Admin";
            if(IsPlayerAdmin(i)) AdmRank = "RCON Administrator";
            else
            {
                switch(AccInfo[i][Level])
                {
                    case 1: AdmRank = "Basic Moderator";
                    case 2: AdmRank = "Moderator";
                    case 3: AdmRank = "Master Moderator";
                    case 4: AdmRank = "Administrator";
                    case 5: AdmRank = "Master Administrator";
                }
            }
            switch(AccInfo[i][OnDuty])
            {
                case 0: AdmDuty = "Playing!";
                case 1: AdmDuty = "On Duty!";
            }
            format(string, sizeof(string), "%s{A9C4E4}Level: %d - {FFD119}%s (ID:%i) {A9C4E4}| %s | %s\n", string, AccInfo[i][Level], PlayerName2(i), i, AdmRank, AdmDuty);
            count1++;
        }
    }
    if(count1 == 0) strcat(string, "{FFD119}No administrators online{A9C4E4}\n");
    strcat(string, "\nVIP Players online:\n\n");
    for(new vips = 0; vips < MAX_PLAYERS; vips++)
    {
        if(IsPlayerConnected(vips) && AccInfo[vips][pVip] > 0)
        {
            switch(AccInfo[vips][pVip])
            {
                case 1: AccType = "Silver";
                case 2: AccType = "Gold";
                case 3: AccType = "Premium";
            }
            format(string, sizeof(string), "%s{FFD119}%s (ID: %d){A9C4E4} | VIP Type: %s\n", string, PlayerName2(vips), vips, AccType);
            count2++;
        }
    }
    if(count2 == 0) strcat(string, "{FFD119}No players have VIP Account!{A9C4E4}\n");
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Staffs Online" ,string, "Close", "");
    return 1;
}
Result:
So thats why you're busy huh? XD
Thanks man! you killed it! nice! + REP
Reply
#6

Andi how can a Vip player use this command? It is set only by admins. i want vip and admins to use this command.

Код:
dcmd_lspec(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
	{
		if(AccInfo[playerid][pGps] != -1)
		return SendClientMessage(playerid, red, "ERROR: First Disable the Gps System! (/gps off)");
		
	    if(!strlen(params) || !IsNumeric(params)) return
		SendClientMessage(playerid, LIGHTBLUE2, "Usage: /lspec [PlayerID]") &&
		SendClientMessage(playerid, orange, "Function: Will spec a specified Player");
		
		new specplayerid = ReturnUser(params);
		if(AccInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
		return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
		
        if(IsPlayerConnected(specplayerid) && specplayerid != INVALID_PLAYER_ID)
		{
			if(specplayerid == playerid)
			return SendClientMessage(playerid, red, "ERROR: You cannot spectate Yourself");
			
			if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && AccInfo[specplayerid][SpecID] != INVALID_PLAYER_ID)
			return SendClientMessage(playerid, red, "ERROR: Player spectating someone else");
			
			if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3)
			return SendClientMessage(playerid, red, "ERROR: Player not Spawned");
			
			if((AccInfo[specplayerid][Level] != ServerInfo[MaxAdminLevel]) || (AccInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] == ServerInfo[MaxAdminLevel]))
			{
				GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
				GetPlayerFacingAngle(playerid,Pos[playerid][3]);
				SendCommandToAdmins(playerid,"LSpec");
				SendClientMessage(playerid,blue,"|- Spectating On -|");
			 	return StartSpectate(playerid, specplayerid);
			}
			else return SendClientMessage(playerid,red,"ERROR: You cannot spectate the highest level admin");
		}
		else return ErrorMessages(playerid, 2);
	}
	else return ErrorMessages(playerid, 7);
}
Reply
#7

change this:
pawn Код:
if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
to this:
pawn Код:
if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid) || AccInfo[playerid][pVip] >= 1) //If (is Player an Admin Level 2 or more) or (is player a RCON Admin) or (is Player a VIP Player type 1 or more)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)