Help 3DText
#1

Hello everybody my enterprise system is not working well i put 3DText to display the information so that it only shows the first company formed and others not.


pawn Код:
for(new I=0;I<=EmpCount;I++)
{
if(Empresa[I][Owned] == true)
{
format(string1, sizeof(string1), "Empresa Dono: %s\nPreco de Compra Gold: %d\n Preco de Venda Gold: %d",Empresa[I][EmpOwner],Empresa[I][EmpPreco], Empresa[I][EmpVenda]);
EMPC = Create3DTextLabel(string1,COLOR_RED,Empresa[I][PickupXX], Empresa[I][PickupYY], Empresa[I][PickupZZ]+0.75,15,0,1);
}
if(Empresa[I][Owned] == false)
{
format(string1, sizeof(string1), "Empresa Dono: Ninguem\nPreco de Compra Gold: %d\n Preco de Venda Gold: %d",Empresa[I][EmpPreco], Empresa[I][EmpVenda]);
EMPV = Create3DTextLabel(string1,COLOR_RED,Empresa[I][PickupXX], Empresa[I][PickupYY], Empresa[I][PickupZZ]+0.75,15,0,1);
}
return 1;
}
Reply
#2

at first glance...

Presuming your indentations are correct, and your variables are all defined, that code looks like it should make all the labels. You are using EMPV and EMPC to store the Text3D id's, and they are being overwritten each time the function loops, so all but the last Text3D id's are lost forever. You might want to put them in an array if you want to use them later.
Reply
#3

but the data only appears in the company's first company formed not know what happens
Reply
#4

looks like you put a return inside the loop, if you indent your code properly this will be more obvious

pawn Код:
for(new I=0;I<=EmpCount;I++)
{
     if(Empresa[I][Owned] == true)
     {
           format(string1, sizeof(string1), "Empresa Dono: %s\nPreco de Compra Gold: %d\n Preco de Venda Gold: %d",Empresa[I][EmpOwner],Empresa[I][EmpPreco], Empresa[I][EmpVenda]);
           EMPC = Create3DTextLabel(string1,COLOR_RED,Empresa[I][PickupXX], Empresa[I][PickupYY], Empresa[I][PickupZZ]+0.75,15,0,1);
      } else {
           format(string1, sizeof(string1), "Empresa Dono: Ninguem\nPreco de Compra Gold: %d\n Preco de Venda Gold: %d",Empresa[I][EmpPreco], Empresa[I][EmpVenda]);
           EMPV = Create3DTextLabel(string1,COLOR_RED,Empresa[I][PickupXX], Empresa[I][PickupYY], Empresa[I][PickupZZ]+0.75,15,0,1);
      }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)