SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/07/2012, 02:01 PM   #1
kbalor
High-roller
 
kbalor's Avatar
 
Join Date: May 2012
Location: Philippines
Posts: 1,240
Reputation: 54
Default 2 in 1 Command List

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.

Code:
     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:

Code:
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
Code:
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");
}
__________________
kbalor is offline   Reply With Quote
Old 16/07/2012, 02:24 PM   #2
Dare Devil.....
Huge Clucker
 
Dare Devil.....'s Avatar
 
Join Date: Jan 2012
Location: Pakistan
Posts: 253
Reputation: 10
Default Re: 2 in 1 Command List

merge both of them under 1 command.
Dare Devil..... is offline   Reply With Quote
Old 16/07/2012, 02:30 PM   #3
kbalor
High-roller
 
kbalor's Avatar
 
Join Date: May 2012
Location: Philippines
Posts: 1,240
Reputation: 54
Default Re: 2 in 1 Command List

Quote:
Originally Posted by Dare Devil..... View Post
merge both of them under 1 command.
How? that is also one of my questions..
__________________
kbalor is offline   Reply With Quote
Old 16/07/2012, 02:46 PM   #4
Andi_Evandy
Big Clucker
 
Join Date: Nov 2011
Location: Indonesia
Posts: 125
Reputation: 23
Default Re: 2 in 1 Command List

pawn Code:
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:
Andi_Evandy is offline   Reply With Quote
Old 16/07/2012, 03:03 PM   #5
kbalor
High-roller
 
kbalor's Avatar
 
Join Date: May 2012
Location: Philippines
Posts: 1,240
Reputation: 54
Default Re: 2 in 1 Command List

Quote:
Originally Posted by Andi_Evandy View Post
pawn Code:
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
__________________
kbalor is offline   Reply With Quote
Old 16/07/2012, 03:10 PM   #6
kbalor
High-roller
 
kbalor's Avatar
 
Join Date: May 2012
Location: Philippines
Posts: 1,240
Reputation: 54
Default Re: 2 in 1 Command List

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

Code:
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);
}
__________________
kbalor is offline   Reply With Quote
Old 16/07/2012, 03:18 PM   #7
Andi_Evandy
Big Clucker
 
Join Date: Nov 2011
Location: Indonesia
Posts: 125
Reputation: 23
Default Re: 2 in 1 Command List

change this:
pawn Code:
if(AccInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))

to this:
pawn Code:
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)
Andi_Evandy is offline   Reply With Quote
Reply

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
List Command Help (+Rep) _DownLoaD_ Scripting Help 11 08/03/2012 06:29 PM
[Help]Command for a list Jimbo01 Scripting Help 3 05/09/2011 07:06 PM
Player list command sim_sima Help Archive 7 10/06/2011 09:25 PM
Command list [asg]davo Help Archive 4 26/05/2010 12:16 PM
list command Schock Help Archive 0 01/03/2009 02:54 PM


All times are GMT. The time now is 11:16 PM.


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