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
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 028: invalid subscript (not an array or too many subscripts): "Textdraw2"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : warning 215: expression has no effect
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 001: expected token: ";", but found "]"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : error 029: invalid expression, assumed zero
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(6630) : 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.
TextDrawSetString(Textdraw2[playerid], Str2); // Setar o texto da textdraw
new Text:Textdraw2 [ MAX_PLAYERS ] ; //no inicio do gm
// sempre usar assim a var da text
Textdraw2 [ playerid ]
// 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]);
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.
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; }
Pronto,pode testar que vai funcionar (:
Код:
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 код:
|
// 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;
}
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(251) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(252) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(253) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(254) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(255) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(256) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(257) : error 017: undefined symbol "i"
C:\Users\Richard\Desktop\SAMP 0.3E\gamemodes\E.z.pwn(258) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.
public OnPlayerConnect(playerid)
{
SetTimerEx("AtualizarScore", 2000, true, "d", playerid);
return 1;
}