Saving a 3D Text Label
#1

Hello, I currently have this:
pawn Код:
new Filename[64], line[256];
    format(Filename, sizeof(Filename), "Labels.ini");
    new File:handle = fopen(Filename, io_write);
    format(line, 256, "X=%f\n", fTextPos[0]);fwrite(handle, line);
    format(line, 256, "Y=%f\n", fTextPos[1]);fwrite(handle, line);
    format(line, 256, "Z=%f\n", fTextPos[2]);fwrite(handle, line);
    format(line, 256, "Text=%s", text);fwrite(handle, line);
    fclose(handle);
    }
When I create a label it saves etc, but whenever I create another it over-writes it, so how can I add in like multiple saving? Like a new label on a new line?

Also, how would I would this?

Thanks+rep
Reply
#2

just creat and afte destroy if you want make other one or update text
https://sampwiki.blast.hk/wiki/Delete3DTextLabel
https://sampwiki.blast.hk/wiki/Update3DTextLabelText
Reply
#3

But when I create another one, i want to keep the existing one, if that makes sense

I.E.
/createtlabel ergweghgw
- text is now created for eg-

then I do the cmd again
but the text I created at the start still exists and is saved as well as the second one i made
Reply
#4

not much understood what you said, what you want?
you want to make multiple 3d texts? and every still in game?
or you want to replace old one with other one?
or what?
Reply
#5

'you want to make multiple 3d texts? and every still in game?'
Yes, that
Reply
#6

PHP код:
public OnGameModeInit()

    new 
Text3D:label[100];
    new 
cont;
    return 
1;
}
public 
OnPlayerCommand(cmdtext[])
{
new 
cmd,tmp[256],idx;
cmdstrtok(cmdtext,idx);
if(!
strcmp(cmd,"/createtext",true))
{
tmp strtok(cmdtext,idx);
if(!
strlen(tmp)) return SendClientMessage(playerid,-1,"/createtext <text>");
new 
Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
label[cont] = Create3DTextLabel(tmp,0x008080FF,x,y,z,40.0,0);
cont++;
return 
1;
}
return 
0;

Reply
#7

That doesnt save the text though
Reply
#8

PHP код:
public OnGameModeInit()

    new 
Text3D:label[100];
    new 
cont;
    return 
1;
}
public 
OnPlayerCommand(cmdtext[])
{
new 
cmd,tmp[256],idx;
cmdstrtok(cmdtext,idx);
if(!
strcmp(cmd,"/createtext",true))
{
tmp strtok(cmdtext,idx);
if(!
strlen(tmp)) return SendClientMessage(playerid,-1,"/createtext <text>");
new 
Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
label[cont] = Create3DTextLabel(tmp,0x008080FF,x,y,z,40.0,0);
new 
Filename[64], line[256];
format(Filenamesizeof(Filename), "Labels.ini");
new 
File:handle fopen(Filenameio_write);
format(line256"X=%f\n",x);fwrite(handleline);
format(line256"Y=%f\n"y);fwrite(handleline);
format(line256"Z=%f\n"z);fwrite(handleline);
format(line256"Text=%s"tmp);fwrite(handleline);
fclose(handle);
cont++;
return 
1;
}
return 
0;

Reply
#9

Thats the same system i already have
Reply
#10

you want when server started up to load all them labels?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)