problem with /vips command
#1

I have a problem
when i do /vip ingame it show only playerid/viprank
can anyone change it for me ?
playername/rank ?


pawn Код:
dcmd_vips(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

I dont know what are you trying to do there, but this is quite better:

Код:
static const AdminTypeNames[4][10] =
{
	"None",
    "Silver",
	"Gold",
	"Premium"
};

dcmd_vips(playerid, params[])
{
	#pragma unused params
	if (!AccInfo[playerid][LoggedIn])
		return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");

	if (!AccInfo[playerid][Level])
		return ErrorMessages(playerid, 1);

	new 
		Count,
		string[128],
		adminname[MAX_PLAYER_NAME]
	;

	SendClientMessage(playerid, yellow, "VIP Players:");

	for (new j = GetMaxPlayers(), i; i < j; i++)
	{
		if (!IsPlayerConnected(i))
			continue;
		
		if (!AccInfo[i][pVip])
			continue;

		Count++;
		GetPlayerName(i, adminname, sizeof(adminname));
		
		format(string,sizeof(string),"%s (%d), %s",adminname, i, AdminTypeNames[AccInfo[i][pVip]]);
		SendClientMessage(playerid, yellow, string);
	}

	if (!Count)
		SendClientMessage(playerid,red, "None");

	return 1;
}
Reply
#3

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
I dont know what are you trying to do there, but this is quite better:

Код:
static const AdminTypeNames[4][10] =
{
	"None",
    "Silver",
	"Gold",
	"Premium"
};

dcmd_vips(playerid, params[])
{
	#pragma unused params
	if (!AccInfo[playerid][LoggedIn])
		return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");

	if (!AccInfo[playerid][Level])
		return ErrorMessages(playerid, 1);

	new 
		Count,
		string[128],
		adminname[MAX_PLAYER_NAME]
	;

	SendClientMessage(playerid, yellow, "VIP Players:");

	for (new j = GetMaxPlayers(), i; i < j; i++)
	{
		if (!IsPlayerConnected(i))
			continue;
		
		if (!AccInfo[i][pVip])
			continue;

		Count++;
		GetPlayerName(i, adminname, sizeof(adminname));
		
		format(string,sizeof(string),"%s (%d), %s",adminname, i, AdminTypeNames[AccInfo[i][pVip]]);
		SendClientMessage(playerid, yellow, string);
	}

	if (!Count)
		SendClientMessage(playerid,red, "None");

	return 1;
}
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)