#define MAX_TELEPORTS 500
#define function%0(%1) forward%0(%1); public%0(%1)
#define LoadTeleports INI_ParseFile(tpFile(), "LoadTP", .bExtra = true, .extra = i);
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] = Create3DTextLabel(String, C_WHITE, tpDB[i][ToX],tpDB[i][ToY],tpDB[i][ToZ], 25.0, tpDB[i][ToVW], 0);
}
function LoadTP(playerid, name[], value[])
{
for(new i = 0; i < MAX_TELEPORTS; i++){
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;
}
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;
}
Should be
pawn Код:
|
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"
|
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); }
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); }
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"
|
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); } Код:
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); } |
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); } Код:
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); } |
INI_WriteFloat(tpfile,"X",tpDB[param[0]][X]); INI_WriteFloat(tpfile,"X",tpDB[param[0]][Y]); INI_WriteFloat(tpfile,"X",tpDB[param[0]][Z]); |
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); } Код:
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); } |
You're saving them all as "X", why..
Also, what is "param[0]" and why are you using it as the teleport id/sort. |