[AJUDA] Problemas Com TextDraw. Ajude pf
#1

Bem meu problema й o seguinte.
eu gostaria de criar um comando (/rank) que quando for ativado apareзa um TextDraw com um rank dos 3 primeiros (o q tiver mais score й o 1є).

no topo eu coloquei:
pawn Код:
new Text:Textdraw13;
new Text:Textdraw14;
new Text:Textdraw15;
no OnFilterScriptInit:
pawn Код:
Textdraw13 = TextDrawCreate(439.000000, 367.000000, "_");
TextDrawBackgroundColor(Textdraw13, 255);
TextDrawFont(Textdraw13, 0);
TextDrawLetterSize(Textdraw13, 0.329999, 1.099999);
TextDrawColor(Textdraw13, -1);
TextDrawSetOutline(Textdraw13, 0);
TextDrawSetProportional(Textdraw13, 1);
TextDrawSetShadow(Textdraw13, 0);

Textdraw14 = TextDrawCreate(446.000000, 367.000000, "_");
TextDrawBackgroundColor(Textdraw14, 255);
TextDrawFont(Textdraw14, 0);
TextDrawLetterSize(Textdraw14, 0.329999, 1.099999);
TextDrawColor(Textdraw14, -1);
TextDrawSetOutline(Textdraw14, 0);
TextDrawSetProportional(Textdraw14, 1);
TextDrawSetShadow(Textdraw14, 0);

Textdraw15 = TextDrawCreate(446.000000, 367.000000, "_");
TextDrawBackgroundColor(Textdraw15, 255);
TextDrawFont(Textdraw15, 0);
TextDrawLetterSize(Textdraw15, 0.329999, 1.099999);
TextDrawColor(Textdraw15, -1);
TextDrawSetOutline(Textdraw15, 0);
TextDrawSetProportional(Textdraw15, 1);
TextDrawSetShadow(Textdraw15, 0);
no OnPlayerCommandText eu criei:
pawn Код:
new
cmd[256],
idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/rank", true) == 0)
{
new
ar[MAX_PLAYERS][2],
tmpsize;
tmpsize = fill ( ar );
process( ar , tmpsize );
Primeiro ( ar , tmpsize );
Segundo ( ar , tmpsize );
Terceiro ( ar , tmpsize );
return 1;
}
e no final eu coloquei:
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

//************************************************** ***************************
stock PlayerName(playerid)
{
new Name[MAX_PLAYERS];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
//************************************************** ***************************
stock fill ( array[][] )
{
new x_count;
for ( new g = 0; g < MAX_PLAYERS; g++ )
if ( IsPlayerConnected ( g ) )
{
x_count++;
array[g][1] = g;
array[g][0] = GetPlayerScore ( g );
array[g][2] = GetPlayerScore ( g );
array[g][3] = GetPlayerScore ( g );
}
return x_count;
}

//************************************************** ***************************
stock process ( array[][] , size = sizeof ( array ) )
{
if ( size > 1 )
{
new
bool:flag,
tmpx;
do
{
flag = true;
for ( new i = size - 1; i > 0; i-- )
if ( array[i][0] < array[i - 1][0] )
{
tmpx = array[i][3];
array[i][3] = array[i - 1][3];
array[i - 1][3] = tmpx;
tmpx = array[i][2];
array[i][2] = array[i - 1][2];
array[i - 1][2] = tmpx;
tmpx = array[i][0];
array[i][0] = array[i - 1][0];
array[i - 1][0] = tmpx;
tmpx = array[i][1];
array[i][1] = array[i - 1][1];
array[i - 1][1] = tmpx;
flag = false;
}
}
while flag == false;
}
}
//************************************************** ***************************
stock Primeiro ( array[][] , max , count = 1 )
{
new
str[255],
pln[255];

for ( new i = 0; i < ( ( max < count) ? max : count ); i++ )
{

GetPlayerName ( array[i][1] , pln , sizeof ( pln ) );
format( str , sizeof ( str ) , "1 - %s . %d " , pln, array[i][0]);
TextDrawSetString(Textdraw13, str);
TextDrawShowForPlayer(i,Textdraw13);

}
return true;
}
stock Segundo ( array[][] , max , count = 1 )
{
new
strr[255],
plnn[255];

for ( new i = 0; i < ( ( max < count) ? max : count ); i++ )
{
GetPlayerName ( array[i][1] - 1, plnn , sizeof ( plnn ) );
format( strr , sizeof ( strr ) , "2 - %s . %d " , plnn, array[i][2]);
TextDrawSetString(Textdraw14, strr);
TextDrawShowForPlayer(i,Textdraw14);
}
return true;
}
stock Terceiro ( array[][] , max , count = 1 )
{

new
strrr[255],
plnnn[255];

for ( new i = 0; i < ( ( max < count) ? max : count ); i++ )
{
GetPlayerName ( array[i][1] - 2, plnnn , sizeof ( plnnn ) );
format( strrr , sizeof ( strrr ) , "3 - %s . %d " , plnnn, array[i][3]);
TextDrawSetString(Textdraw15, strrr);
TextDrawShowForPlayer(i,Textdraw15);
return 1;

}
return true;
}
Esse Comando eu tirei do prуprio forum, nao lembro quem fez agora, mais fiz umas modificaзхes para tentar alcanзar o q eu queria mais nao consegui =(

Se alguem Souber poderia me ajuda porfavor....

Agadeзo desde jб.
Reply
#2

pra comeзar, vocк nгo falou os erros

segundo, coloque o cуdigo em [ pawn ] [ /pawn ]... que aн sim irб dar para ajudar vocк.
Reply
#3

tipo cara sou novo no forum.. mil desculpa cara.. mais o problema й q nao da erro O.o
apenas nao aparece a textdraw..
quando eu tiro a Textdraw e crio um SendClientMessageForAll ai da certo. aparece o rank sу q no chat..
eu queria um de textdraw no cantinho, ou em baixo.
Reply
#4

aqui estб um sistema de ranking
https://sampforum.blast.hk/showthread.php?tid=191605
se baseia nele =)
Reply
#5

Valeu Caroline. Vou ver oq faзo aki e posto ai =)
Reply
#6

Olб amigo, vejo que vocк й novato no fуrum, entгo espero que antes de fazer uma postagem leia as Regras, utilize o tуpico de FAQ, e tambйm se quiser procurar algo, consulte o Search.

E quando for postar algum cуdigo utilize as tags:

Код:
[ pawn] & [ /pawn]
Do mais, seja bem vindo, e esclareзa sua duvida, pois nгo entendi ela bem.
Reply
#7

Desculpa cara sou ruim para explica. Mas tipo assim
Eu to tentando fazer um comando que ao digitar /rank, apareзa uma textdraw do
1є colocado e o numero de Score do player
2є colocado e o numero de Score do Player
3є colocado e o numero de score do Player

o player q tiver maior score fique em 1є, e assim por diante.

eu consegui fazer sу q pelo "SendClientMessage" assim o rank fica no chat publico. eu sу nao to conseguindo colocar a textdraw. entende?!?
Reply
#8

porque nгo faзa em dialog ? acho mais inovador :P
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)