This is what you looking for ?
CMD:viponlinemem(playerid, params[]) { new szDialog[1024]; foreach(new i: Player) { if(PlayerInfo[i][pDonateRank] >= 1) { format(szDialog, sizeof(szDialog), "%s\n* %s (%d)", szDialog, GetPlayerNameEx(i), PlayerInfo[i][pDonateRank]); } } ShowPlayerDialog(playerid, 1849, DIALOG_STYLE_LIST, "Online VIP Members", szDialog, "Skip", ""); return 1; } |
If I write textdraws several times, you're still stupid enough to give me a dialog, you've plagarized it too, idiot.
Obviously that wasen't what I meant. Please only reply if you're here to help me. |
new String[256]; new PlayerName[MAX_PLAYER_NAME]; for(new A,B = GetMaxPlayers(); A < B; A++) { if(IsPlayerConnected(A) && IsPlayerVip(A)) format(String,sizeof(String),"%s%s\n",String,PlayerName); } TextDrawSetString(TextDrawId,String);
Well I can imagine right now how it should look, do you want just a list with the names under each other like
name1 name2 name3 ... But than is the question how long is the list, is it scrollable ? or what happens if more vips are online than space in the vip list |
No need to attack him like that, be glad he tried to help.
Ontopic: Just replace that ShowPlayerDialog from his code with TextDrawSetString. |
Create one textdraw where names will be showed. And my question is, is this textdraw display everytime or when player use command?
Код:
new String[256]; new PlayerName[MAX_PLAYER_NAME]; for(new A,B = GetMaxPlayers(); A < B; A++) { if(IsPlayerConnected(A) && IsPlayerVip(A)) format(String,sizeof(String),"%s%s\n",String,PlayerName); } TextDrawSetString(TextDrawId,String); |
enum eVipList {
Text: vTID, // Textdrawid
vPID // playerid
} // just an example variable
new gVipList[20][eVipList];
// I expect that you create the textdraw in OnGameModeInit, something like that
for(new i; i < 20; ++i) {
// setting every position to INVALID_PLAYER_ID
gVipText[i][vPID] = INVALID_PLAYER_ID;
// the first textdraw (id 0) is the highest one in my example
gVipText[i][vTID] = TextDrawCreate(50.0, 50.0 + i * 5.0, "_");
// other textdraw functions to customize it
}
VipListAdd(playerid) {
for(new idx; idx < sizeof gVipList; ++idx) {
if(gVipList[idx][vPID] == INVALID_PLAYER_ID) {
// we found a free spot
new
name[MAX_PLAYER_NAME]
;
if(GetPlayerName(playerid, name, sizeof name)) {
TextDrawSetString(gVipList[idx][vTID], name);
gVipList[idx][vPID] = playerid;
return true;
}
break;
}
}
return false;
}
VipListRemove(playerid) {
for(new idx; idx < sizeof gVipList; ++idx) {
if(gVipList[idx][vPID] == playerid) {
// we found the player in the list, now shuffle everyone up and update the names
new
name[MAX_PLAYER_NAME]
;
do {
if(GetPlayerName((gVipList[idx][vPID] = gVipList[idx + 1][vPID]), name, sizeof name) == 0) {
// we hit in INVALID PLAYER ID because it isn't connected
TextDrawSetString(gVipList[idx][vTID], "_");
return true;
}
TextDrawSetString(gVipList[idx][vTID], name);
} while(++idx < (sizeof gVipList - 1));
// if the list was full we set the last to invalid
TextDrawSetString(gVipList[sizeof gVipList - 1][vTID], "_");
gVipList[sizeof gVipList - 1][vPID] = INVALID_PLAYER_ID;
return true;
}
}
return false;
}
// OnPlayerConnect
if(IsPlayerVIP(playerid)) {
VipListAdd(playerid);
}
// OnPlayerDisconnect
// we don't need to check if the player is a vip here because it only removes the player if he is on the list
// but it will prevent useless function calls
if(IsPlayerVIP(playerid)) {
VipListRemove(playerid);
}