17.02.2010, 18:26
Hi , i want to list who is v.i.p member.
How can i do this?
(PlayerInfo[playerid][Premium])
How can i do this?
(PlayerInfo[playerid][Premium])
if(strcmp(cmd,"/vips",true) == 0)
{
SendClientMessage(playerid,COLOR_RED, "Currently online VIPs:");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Premium] == 1)
{
new pName[MAX_PLAYER_NAME], string[128], count = 0;
GetPlayerName(i,pName,sizeof(pName));
format(string, sizeof(string), "[%s] %s", PlayerInfo[i][Premium]);
SendClientMessage(playerid, COLOR_RED, string);
count ++;
}
if(count == 0)
{
SendClientMessage(playerid,COLOR_RED, "No VIP members online!");
}
}
return 1;
}
Originally Posted by VonLeeuwen
It would be something like this:
pawn Код:
|
if(strcmp(cmd,"/vips",true) == 0)
{
SendClientMessage(playerid,COLOR_RED, "Currently online VIPs:");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Premium] == 1)
{
new pName[MAX_PLAYER_NAME], string[128], count = 0;
GetPlayerName(i,pName,sizeof(pName));
format(string, sizeof(string), "[%s] %s", i,pname);
SendClientMessage(playerid, COLOR_RED, string);
count ++;
}
if(count == 0)
{
SendClientMessage(playerid,COLOR_RED, "No VIP members online!");
}
}
return 1;
}
Originally Posted by VonLeeuwen
Oh yea true, had just the name at first, but later I added the ID :$ I'm ashamed of my self.
|
Originally Posted by CoverH.ng
@┤ŞąiBЄЯҒПŋ├
does it work? |
if(strcmp(cmd,"/vips",true) == 0) // if the player types /vips
{
SendClientMessage(playerid,COLOR_RED, "Currently online VIPs:"); // sends 'Currently Online VIPs'
for(new i=0; i<MAX_PLAYERS; i++) // creates new loop 'i'
{
if(PlayerInfo[i][Premium] == 1) // is the i a VIP?
{
new pName[MAX_PLAYER_NAME], string[128], count = 0; // new things
GetPlayerName(i,pName,sizeof(pName)); // Get the name of the I
format(string, sizeof(string), "[%s] %s", i,pname); // Format his name
SendClientMessage(playerid, COLOR_RED, string); // Send the names to the playerid
count ++; // add 1 to count
}
if(count == 0) // if the count = 0
{
SendClientMessage(playerid,COLOR_RED, "No VIP members online!"); // there are no vips online
}
}
return 1;
}
Originally Posted by VonLeeuwen
Explained enough?
|