3D Label Creation problem. (+REP)
#1

It's saving only the first TP, how can i fix this? after restarting only the first tp that has created would be saved
what should i do?

PHP код:
#define MAX_TELEPORTS 500 
PHP код:
#define function%0(%1) forward%0(%1); public%0(%1)
#define LoadTeleports INI_ParseFile(tpFile(), "LoadTP", .bExtra = true, .extra = i); 
OnGameModeInit
PHP код:
for(new 0MAX_TELEPORTSi++){
    
LoadTeleports
    format
(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    
TPText[i] = Create3DTextLabel(StringC_WHITEtpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0tpDB[i][VW], 0);
    
TPText[i] = Create3DTextLabel(StringC_WHITEtpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0tpDB[i][ToVW], 0);
    } 
PHP код:
function LoadTP(playeridname[], value[])
{
    for(new 
0MAX_TELEPORTSi++){
    
INI_String("Description",tpDB[i][Description],64);
    
INI_Float("X",tpDB[i][X]);
    
INI_Float("Y",tpDB[i][Y]);
    
INI_Float("Z",tpDB[i][Z]);
    
INI_Float("ToX",tpDB[i][ToX]);
    
INI_Float("ToY",tpDB[i][ToY]);
    
INI_Float("ToZ",tpDB[i][ToZ]);
    
INI_Int("VW",tpDB[i][VW]);
    
INI_Int("ToVW",tpDB[i][ToVW]);}
return 
1;
}
stock SaveTPFile()
{
    new 
INI:tpfile INI_Open(tpFile());
    
INI_SetTag(tpfile"Database");
    
INI_WriteString(tpfile,"Description",tpDB[param[0]][Description]);
    
INI_WriteFloat(tpfile,"X",tpDB[param[0]][X]);
    
INI_WriteFloat(tpfile,"Y",tpDB[param[0]][Y]);
    
INI_WriteFloat(tpfile,"Z",tpDB[param[0]][Z]);
    
INI_WriteFloat(tpfile,"ToX",tpDB[param[0]][ToX]);
    
INI_WriteFloat(tpfile,"ToY",tpDB[param[0]][ToY]);
    
INI_WriteFloat(tpfile,"ToZ",tpDB[param[0]][ToZ]);
    
INI_WriteInt(tpfile,"VW",tpDB[param[0]][VW]);
    
INI_WriteInt(tpfile,"ToVW",tpDB[param[0]][ToVW]);
    
INI_Close(tpfile);
}
stock tpFile()
{
    
format(String,sizeof(String),"Teleports/Teleport (%i).ini",param[0]);
    return 
String;

Reply
#2

Should be
pawn Код:
function LoadTP(index, name[], value[])
{
    INI_String("Description",tpDB[index][Description],64);
    INI_Float("X",tpDB[index][X]);
    INI_Float("Y",tpDB[index][Y]);
    INI_Float("Z",tpDB[index][Z]);
    INI_Float("ToX",tpDB[index][ToX]);
    INI_Float("ToY",tpDB[index][ToY]);
    INI_Float("ToZ",tpDB[i][ToZ]);
    INI_Int("VW",tpDB[index][VW]);
    INI_Int("ToVW",tpDB[index][ToVW]);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Should be
pawn Код:
function LoadTP(index, name[], value[])
{
    INI_String("Description",tpDB[index][Description],64);
    INI_Float("X",tpDB[index][X]);
    INI_Float("Y",tpDB[index][Y]);
    INI_Float("Z",tpDB[index][Z]);
    INI_Float("ToX",tpDB[index][ToX]);
    INI_Float("ToY",tpDB[index][ToY]);
    INI_Float("ToZ",tpDB[i][ToZ]);
    INI_Int("VW",tpDB[index][VW]);
    INI_Int("ToVW",tpDB[index][ToVW]);
    return 1;
}
omg dude -,- it doesn't matter it's just tabsize, fuck it it won't solve my problem....
Reply
#4

I guess it shows only the second one, because you are overwriting the variable "TPText" with the second "Create3DTextLabel" everytime. Try to split the variable into two, meaning "TPText1" and "TPText2"
Reply
#5

Quote:
Originally Posted by Macronix
Посмотреть сообщение
I guess it shows only the second one, because you are overwriting the variable "TPText" with the second "Create3DTextLabel" everytime. Try to split the variable into two, meaning "TPText1" and "TPText2"
but if i'd do it i'd have to make tons of it, that's why I made it TPText[number] so i won't have to create tons of 3dtextlabel
Reply
#6

No, you don't have to create "TPText1", "TPText2", "TPText3" and so on... because the loop does that for you. You just have to create the first two, meaning:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText1[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText2[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
If that doesn't work, try this:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText[i+1] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
Reply
#7

Quote:
Originally Posted by Macronix
Посмотреть сообщение
I guess it shows only the second one, because you are overwriting the variable "TPText" with the second "Create3DTextLabel" everytime. Try to split the variable into two, meaning "TPText1" and "TPText2"
Quote:
Originally Posted by Macronix
Посмотреть сообщение
No, you don't have to create "TPText1", "TPText2", "TPText3" and so on... because the loop does that for you. You just have to create the first two, meaning:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText1[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText2[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
If that doesn't work, try this:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText[i+1] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
it isn't working, i noticed that the first 3dtext isnt working EVEN if i remove the second 3dtext, what should i do?
EDIT: oh sec it's saving all the positions on X, lemme try to fix
Reply
#8

Quote:
Originally Posted by Macronix
Посмотреть сообщение
No, you don't have to create "TPText1", "TPText2", "TPText3" and so on... because the loop does that for you. You just have to create the first two, meaning:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText1[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText2[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
If that doesn't work, try this:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText[i+1] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
Ty man. but I just noticed that after i i'm GMXing it's saving only the first Teleport, do u know how can i fix this shit?
Reply
#9

Quote:

INI_WriteFloat(tpfile,"X",tpDB[param[0]][X]);
INI_WriteFloat(tpfile,"X",tpDB[param[0]][Y]);
INI_WriteFloat(tpfile,"X",tpDB[param[0]][Z]);

You're saving them all as "X", why..

Also, what is "param[0]" and why are you using it as the teleport id/sort.
Reply
#10

Quote:
Originally Posted by Macronix
Посмотреть сообщение
No, you don't have to create "TPText1", "TPText2", "TPText3" and so on... because the loop does that for you. You just have to create the first two, meaning:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText1[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText2[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
If that doesn't work, try this:

Код:
for(new i = 0; i < MAX_TELEPORTS; i++){
    LoadTeleports
    format(String,sizeof(String),"- Teleport -\n%s",tpDB[i][Description]);
    TPText[i] = Create3DTextLabel(String, C_WHITE, tpDB[i][X],tpDB[i][Y],tpDB[i][Z], 25.0, tpDB[i][VW], 0);
    TPText[i+1] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
    }
Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
You're saving them all as "X", why..

Also, what is "param[0]" and why are you using it as the teleport id/sort.
ye i already fixed it, I forgot to change it here too. what should i do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)