27.05.2013, 02:01
Hi, i need someone to explain me how to pass this into a dialog. I don't know how :/
I think i didn't miss anything. Please help me with this. Thanksss!
pawn Код:
//New
new Text:txtdraw;
new Text:Stats;
new
Text: text_Top5[2]
;
enum rankingEnum
{
player_Score,
player_ID
}
public OnGameModeInit()
{
text_Top5[1] = TextDrawCreate(16.000000, 135.000000, " ");
TextDrawBackgroundColor(text_Top5[1], 255);
TextDrawFont(text_Top5[1], 1);
TextDrawLetterSize(text_Top5[1], 0.200000, 0.999999);
TextDrawColor(text_Top5[1], -1);
TextDrawSetOutline(text_Top5[1], 0);
TextDrawSetProportional(text_Top5[1], 1);
TextDrawSetShadow(text_Top5[1], 0);
TextDrawUseBox(text_Top5[1], 1);
TextDrawBoxColor(text_Top5[1], 150);
TextDrawTextSize(text_Top5[1], 143.000000, 20.000000);
Stats = TextDrawCreate(291.000000, 390.000000, "Stats");
TextDrawBackgroundColor(Stats, 255);
TextDrawFont(Stats, 1);
TextDrawLetterSize(Stats, 0.500000, 1.400000);
TextDrawColor(Stats, -1);
TextDrawSetOutline(Stats, 0);
TextDrawSetProportional(Stats, 1);
TextDrawSetShadow(Stats, 1);
TextDrawSetSelectable(Stats, true);
TextDrawTextSize(Stats, 293.000000, 405.000000);
txtdraw = TextDrawCreate(240.000000, 20.000000 , "TOP PLAYERS");
TextDrawFont(txtdraw, 1);
TextDrawLetterSize(txtdraw, 0.6, 4.2);
TextDrawColor(txtdraw, 0x33AA33AA);
TextDrawSetOutline(txtdraw, false);
TextDrawSetProportional(txtdraw, true);
TextDrawSetShadow(txtdraw, 1);
return 1;
}
public OnGameModeExit()
{
TextDrawDestroy(text_Top5[0]);
TextDrawDestroy(text_Top5[1]);
return 1;
}
//COMMANDS
CMD:tops(playerid, params[])
{
new playerScores[MAX_PLAYERS][rankingEnum], index;
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
playerScores[index][player_Score] = GetPlayerScore(i);
playerScores[index++][player_ID] = i;
}
}
GetPlayerHighestScores(playerScores, 0, index);
new score_Text[256] = "~n~", player_Name[20];
for(new i; i < 5; ++i)
{
if(i < index)
{
GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
}
else
{
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~N/A", score_Text, i + 1);
}
}
TextDrawSetString(text_Top5[1], score_Text);
TextDrawShowForPlayer(playerid, text_Top5[0]);
TextDrawShowForPlayer(playerid, text_Top5[1]);
TextDrawShowForPlayer(playerid, txtdraw);
SendClientMessage(playerid, -1, "{FF3300}This are the top 5 players, use {DBED15}/notops{FFFFFF} stop viewing.");
return 1;
}
CMD:notops(playerid, params[])
{
TextDrawHideForPlayer(playerid, text_Top5[0]);
TextDrawHideForPlayer(playerid, text_Top5[1]);
TextDrawHideForPlayer(playerid, txtdraw);
return 1;
}
//STOCK
stock GetPlayerHighestScores(array[][rankingEnum], left, right)
{
new
tempLeft = left,
tempRight = right,
pivot = array[(left + right) / 2][player_Score],
tempVar
;
while(tempLeft <= tempRight)
{
while(array[tempLeft][player_Score] > pivot) tempLeft++;
while(array[tempRight][player_Score] < pivot) tempRight--;
if(tempLeft <= tempRight)
{
tempVar = array[tempLeft][player_Score], array[tempLeft][player_Score] = array[tempRight][player_Score], array[tempRight][player_Score] = tempVar;
tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
tempLeft++, tempRight--;
}
}
if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
}