[Ajuda] Textdraw com valor
#1

Bom estou colocando o valor do "Cash" do player em Textdraw e estб dando este erro nгo sei o porque

error 017: undefined symbol "Player"

PHP код:
forward AtCash(playerid);
public 
AtCash(playerid){
       new 
String[128];
    
format(String, sizeof(String), "Cash: %d", Player[playerid][rCash]);
    
TextDrawSetString(CashText, String);
    
CashText = TextDrawCreate(511.500000, 107.644447, "Cash:");
    
TextDrawLetterSize(CashText, 0.449999, 1.600000);
    
TextDrawAlignment(CashText, 1);
    
TextDrawColor(CashText, -1061109505);
    
TextDrawSetShadow(CashText, 0);
    
TextDrawSetOutline(CashText, 1);
    
TextDrawBackgroundColor(CashText, 51);
    
TextDrawFont(CashText, 0);
    
TextDrawSetProportional(CashText, 1);
    
TextDrawShowForPlayer(playerid, CashText);
    return 
true;
} 
Reply
#2

Quote:
Originally Posted by rLucky
Посмотреть сообщение
Bom estou colocando o valor do "Cash" do player em Textdraw e estб dando este erro nгo sei o porque

error 017: undefined symbol "Player"

PHP код:
forward AtCash(playerid);
public 
AtCash(playerid){
       new 
String[128];
    
format(String, sizeof(String), "Cash: %d", Player[i][rCash]);
    
TextDrawSetString(CashText, String);
    
CashText = TextDrawCreate(511.500000, 107.644447, "Cash:");
    
TextDrawLetterSize(CashText, 0.449999, 1.600000);
    
TextDrawAlignment(CashText, 1);
    
TextDrawColor(CashText, -1061109505);
    
TextDrawSetShadow(CashText, 0);
    
TextDrawSetOutline(CashText, 1);
    
TextDrawBackgroundColor(CashText, 51);
    
TextDrawFont(CashText, 0);
    
TextDrawSetProportional(CashText, 1);
    
TextDrawShowForPlayer(playerid, CashText);
    return 
true;
} 
Simbolo indefinido!
Quer dizer que nгo hб Variavel Player
ou enum nгo sei como estб fazendo e creio eu que [i] й sу em Loop por causa da var... Tente trocar por playerid

@OFF

Se eu estiver errado me corrijam!
Reply
#3

Quote:
Originally Posted by JhowWatkins
Посмотреть сообщение
Simbolo indefinido!
Quer dizer que nгo hб Variavel Player
ou enum nгo sei como estб fazendo e creio eu que [i] й sу em Loop por causa da var... Tente trocar por playerid

@OFF

Se eu estiver errado me corrijam!
Entгo deixei em playerid e mudei pra [i] pra ver se era isso, mais nгo foi, o erro perciste mesmo mudando
Nгo intendi como criar a variavel, quando estб em ongamemodeinit funciona sem erro algum
Reply
#4

pхe sу
format(String, sizeof(String), "Cash: %d",[rCash]);
tenta assim
@EDIT

Caso nгo for mande sua Variavel

rCash!
Reply
#5

Quote:

error 029: invalid expression, assumed zero
error 017: undefined symbol "rCash"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Em outra parte da gm o code funciona perfeitamente com o 'Player' que chama os arquivos salvos em dof

PHP код:
Player[playerid][rCash] = DOF2_GetInt(file, "rCash"); 
Reply
#6

@EDIT
Bom fiz uma base pra vocк ter uma noзгo de como й

PHP код:
new PlayerText:CashText[MAX_PLAYERS][1];
enum pInfo
{
pCash,
};
new 
PlayerInfo[MAX_PLAYERS][pInfo];
//AS VARIAVEIS ESTГO ACIMA, COMO VOCК ESTAVA COLOCANDO Player[i][pCash]; com certeza esse player estб em um enum!
public OnPlayerConnect(playerid){
    
CashText[playerid][0] = CreatePlayerTextDraw(playerid, 494.800079, 101.146675, "");
    
PlayerTextDrawLetterSize(playerid, CashText[playerid][0], 0.400000, 1.600000);
    
PlayerTextDrawAlignment(playerid, CashText[playerid][0], 1);
    
PlayerTextDrawColor(playerid, CashText[playerid][0], -1);
    
PlayerTextDrawSetShadow(playerid, CashText[playerid][0], 0);
    
PlayerTextDrawSetOutline(playerid, CashText[playerid][0], 1);
    
PlayerTextDrawBackgroundColor(playerid, CashText[playerid][1], 255);
    
PlayerTextDrawFont(playerid, CashText[playerid][0], 3);
    
PlayerTextDrawSetProportional(playerid, CashText[playerid][0], 1);
    
PlayerTextDrawSetShadow(playerid, CashText[playerid][0], 0);
    return 
1;
}
CMD:darcash(playerid){
    
PlayerInfo[playerid][pCash] = 200;
    return 
1;
}
forward TextDrawUpdate(playerid);
public 
TextDrawUpdate(playerid)
{
    new 
STR[250];
    
format(STR, sizeof(STR), "~b~$~w~%d",PlayerInfo[playerid][pCash]);
    
PlayerTextDrawSetString(playerid,CashText[playerid][1], STR);
    
PlayerTextDrawShow(playerid,CashText[playerid][1]);
    return 
1;
}
public 
OnGamemodeInit()
{
    
SetTimer("TextDrawUpdate",1000,true);
return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: