24.07.2010, 21:29
I have problems save a string, i got this dynamic 3d text. So i can create ingame, when i exit it saves that file. But when i create the label, the save part is not working correct. After i create the label in-game, it does work and it creates the label as i named it.
So, when i close the server, the file saves but it won't save the text i typed while in -game. It saves a number :/
here is the saving part:
Im guessing is something in the savelabels part.
Btw, LInfo = the name i add to the label.
So, when i close the server, the file saves but it won't save the text i typed while in -game. It saves a number :/
here is the saving part:
pawn Код:
stock LoadLabels()
{
for(new x = 0; x <MAX_LABELS; x++)
{
format(lFile,sizeof(lFile),LABELFILE,x);
format(lInfo[x][LInfo], 100, "%s", dini_Get(lFile, "LInfo"));
lInfo[x][LabelX] = dini_Float(lFile,"LabelX");
lInfo[x][LabelY] = dini_Float(lFile,"LabelY");
lInfo[x][LabelZ] = dini_Float(lFile,"LabelZ");
lInfo[x][LID] = CreateDynamic3DTextLabel(lInfo[x][LInfo], 0xFFFFFF,lInfo[x][LabelX],lInfo[x][LabelY],lInfo[x][LabelZ],100,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,-1,-1,-1,100);
}
}
stock CreateSavedLabel(name[], Float:x, Float:y, Float:z)
{
format(lIDFile, sizeof(lIDFile), LABELIDFILE);
if(!dini_Exists(lIDFile))
{
dini_Create(lIDFile);
dini_IntSet(lIDFile, "Total 3D Labels:", -1);
}
else
{
dini_IntSet(lIDFile, "Total 3D Labels:", dini_Int(lIDFile, "Total 3D Labels:")+1);
}
new lID = dini_Int(lIDFile, "Total 3D Labels:");
format(lFile, sizeof(lFile), LABELFILE, lID);
if(!dini_Exists(lFile)) dini_Create(lFile);
format(lInfo[lID][LInfo], 100, "%s", name);
lInfo[lID][LabelX] = x;
lInfo[lID][LabelY] = y;
lInfo[lID][LabelZ] = z;
lInfo[lID][LID] = CreateDynamic3DTextLabel(name, 0xFFFFFF, x, y, z, 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100);
}
public SaveLabels()
{
for(new x=0; x<MAX_LABELS; x++)
{
format(lFile, sizeof(lFile), LABELFILE, x);
dini_IntSet (lFile, "LInfo", lInfo[x][LInfo]);
dini_FloatSet (lFile, "LabelX", lInfo[x][LabelX]);
dini_FloatSet (lFile, "LabelY", lInfo[x][LabelY]);
dini_FloatSet (lFile, "LabelZ", lInfo[x][LabelZ]);
}
}
Btw, LInfo = the name i add to the label.