[Ajuda] Score em Texdraw
#1

pawn Код:
Textdraw2 = TextDrawCreate(561.000000, 151.000000, "500[variave]");
    TextDrawBackgroundColor(Textdraw2, 255);
    TextDrawFont(Textdraw2, 1);
    TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
    TextDrawColor(Textdraw2, -1);
    TextDrawSetOutline(Textdraw2, 0);
    TextDrawSetProportional(Textdraw2, 1);
    TextDrawSetShadow(Textdraw2, 1);
    new Str[10]; // Mude para a quantidade de valores mбximos da textdraw, exemplo: 123 seria 4 celulas pois o ъltimo valor deve ser nulo :D  ( '\0' )
    format(Str,sizeof(Str),"%d", Variavel[playerid]); // Variavel a ser utilizada
    TextDrawSetString(Textdraw2[playerid], Str2); // Setar o texto da textdraw
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]); // Mostrar / atualizar o valor da nossa text

    new Str2[10];
    format(Str2,sizeof(Str2),"%d", GetPlayerScore(playerid)); // Vamos converter nosso score para um texto
    TextDrawSetString(Textdraw2[playerid], Str2); // Setar o texto da textdraw
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]); // Mostrar / atualizar o valor da nossa text
    // Demos
Estou tentando fazer um texdraw de score do Kuddy ma nгo estou obtendo sucesso.

erros
PHP код:
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 028invalid subscript (not an array or too many subscripts): "Textdraw2"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : warning 215expression has no effect
C
:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 001expected token";"but found "]"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 029invalid expressionassumed zero
C
:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Linha do erro:
PHP код:
TextDrawSetString(Textdraw2[playerid], Str2); // Setar o texto da textdraw 
Reply
#2

pawn Код:
new Text:Textdraw2 [ MAX_PLAYERS ] ;  //no inicio do gm

// sempre usar assim a var da text
Textdraw2 [ playerid ]
Reply
#3

pawn Код:
// No Inicio
new Text:Textdraw2 [ MAX_PLAYERS ] ;

// OnGameModeInit
for(new i; i < MAX_PLAYERS; i++)
{
    Textdraw2[i] = TextDrawCreate(561.000000, 151.000000, " ");
    TextDrawBackgroundColor(Textdraw2[i], 255);
    TextDrawFont(Textdraw2[i], 1);
    TextDrawLetterSize(Textdraw2[i], 0.500000, 1.000000);
    TextDrawColor(Textdraw2[i], -1);
    TextDrawSetOutline(Textdraw2[i], 0);
    TextDrawSetProportional(Textdraw2[i], 1);
    TextDrawSetShadow(Textdraw2[i], 1);
}

// Aonda mostra
    new Str[10];
    format(Str,sizeof(Str),"%d", Variavel[playerid]);
    TextDrawSetString(Textdraw2[playerid], Str2);
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]);

    new Str2[10];
    format(Str2,sizeof(Str2),"%d", GetPlayerScore(playerid));
    TextDrawSetString(Textdraw2[playerid], Str2);
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
Reply
#4

pawn Код:
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(242) : error 028: invalid subscript (not an array or too many subscripts): "Textdraw2"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(242) : warning 215: expression has no effect
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(242) : error 001: expected token: ";", but found "]"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(242) : error 029: invalid expression, assumed zero
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(242) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Код:
new Text:Textdraw4;
Код:
new Text:Scores[MAX_PLAYERS];
Код:
public OnPlayerDeath(playerid, killerid, reason) {
	SetPlayerScore(playerid, GetPlayerScore(killerid)+ 1);
	new str[100];
	
	format(str, sizeof(str),"Score: %d", GetPlayerScore(killerid));
	TextDrawSetString(Scores[killerid], str);
	TextDrawShowForPlayer(killerid, Scores[killerid]);
	return 1;
}
Код:
public OnGameModeInit() {
       Textdraw4 = TextDrawCreate(407.000000, 433.000000, "     ");
	TextDrawBackgroundColor(Textdraw4, 421075455);
	TextDrawFont(Textdraw4, 1);
	TextDrawLetterSize(Textdraw4, 0.230000, 1.400000);
	TextDrawColor(Textdraw4, -1);
	TextDrawSetOutline(Textdraw4, 1);
	TextDrawSetProportional(Textdraw4, 1);
        return 1;
}
Код:
public OnPlayerSpawn(playerid) {
   TextDrawShowForPlayer(playerid, Textdraw4);
   return 1;
}
PHP код:
Pronto,pode testar que vai funcionar (: 
#Edit pois tinha erros...
Reply
#6

Quote:
Originally Posted by @LucasVinicius
Посмотреть сообщение
Код:
new Text:Textdraw4[MAX_PLAYERS];
Код:
public OnPlayerDeath(playerid, killerid, reason) {
	SetPlayerScore(playerid, GetPlayerScore(killerid)+ 1);
	new str[100];
	
	format(str, sizeof(str),"Score: %d", GetPlayerScore(killerid));
	TextDrawSetString(Scores[killerid], str);
	TextDrawShowForPlayer(killerid, Scores[killerid]);
	return 1;
}
Код:
public OnGameModeInit() {
       Textdraw4 = TextDrawCreate(407.000000, 433.000000, "     ");
	TextDrawBackgroundColor(Textdraw4, 421075455);
	TextDrawFont(Textdraw4, 1);
	TextDrawLetterSize(Textdraw4, 0.230000, 1.400000);
	TextDrawColor(Textdraw4, -1);
	TextDrawSetOutline(Textdraw4, 1);
	TextDrawSetProportional(Textdraw4, 1);
        return 1;
}
Код:
public OnPlayerSpawn(playerid) {
   TextDrawShowForPlayer(playerid, Textdraw4);
   return 1;
}
PHP код:
Pronto,pode testar que vai funcionar (: 
pqp --'

cara vocк definiu a text em [MAX_PLAYERS] e ta passando sem o parametro ? --'

Olha seu topo e o resto do code.
Reply
#7

Concertei ^^
Reply
#8

Aff, me embaralhei todo, alguйm pode fazer pra mim? um em baixo da grana? e.e
Reply
#9

Aqui:

pawn Код:
// No Inicio
new Text:Textdraw2 [ MAX_PLAYERS ] ;

// OnGameModeInit
for(new i; i < MAX_PLAYERS; i++)
{
    Textdraw2[i] = TextDrawCreate(561.000000, 151.000000, " ");
    TextDrawBackgroundColor(Textdraw2[i], 255);
    TextDrawFont(Textdraw2[i], 1);
    TextDrawLetterSize(Textdraw2[i], 0.500000, 1.000000);
    TextDrawColor(Textdraw2[i], -1);
    TextDrawSetOutline(Textdraw2[i], 0);
    TextDrawSetProportional(Textdraw2[i], 1);
    TextDrawSetShadow(Textdraw2[i], 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetTimerEx("AtualizarScore", 2000, true, "d", playerid);
    return 1;
}

forward AtualizarScore(playerid);
public AtualizarScore(playerid)
{
    new Str[32];
    format(Str,sizeof(Str),"Dinheiro: %d ~n~Level: %d", GetPlayerMoney(playerid), GetPlayerScore(playerid));
    TextDrawSetString(Textdraw2[playerid], Str);
    TextDrawShowForPlayer(playerid, Textdraw2[playerid]);

    return 1;
}
Reply
#10

Obrigado Murilo mas deu os seguintes erros, procurei soluзгo mas nгo tem nada haver com os tуpicos que procurei.

PHP код:
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(251) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(252) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(253) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(254) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(255) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(256) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(257) : error 017undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(258) : error 017undefined symbol "i"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
8 Errors

PHP код:
public OnPlayerConnect(playerid)
{
    
SetTimerEx("AtualizarScore"2000true"d"playerid);
    return 
1;

isso naх seria em init?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)