3dtext
#1

Hi I am looking to find a command or system that creates 3dtext labels in game instead of me having to add them in the script can anyone help me as I can't seem to find one...
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=470652 here

or

https://sampforum.blast.hk/showthread.php?tid=466617
Reply
#3

PHP код:
CMD:createtext(playerid,params[]) {
    new 
text[64], Float:xFloat:y,Float:zFloat:distanceVWLOS;
    if(
sscanf(params,"s[64]ffffii",text,x,y,z,distance,VW,LOS))
        return 
SendClientMessage(playerid,COLOR_RED,"Usage: /createtext [text] x y z distance World LOS"
    
    
Create3DTextLabel(text0xFFFFFFx,y,z,distanceVWLOS);
    return 
1;

Untested but it should work
Reply
#4

Yes that command didnt work and i couldnt download either of the other to as the download link didnt work


Код:
CMD:tlabel(playerid,params[])
{
    new text[64];
	new Float:plocx,Float:plocy,Float:plocz;
	GetPlayerPos(playerid, plocx, plocy, plocz);
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params,"s[64]",text))
        return SendClientMessage(playerid,COLOR_RED,"Usage: /tlabel [text]");

    CreateDynamic3DTextLabel(text, COLOR_RED, plocy, plocx, plocz, 40);
    SendClientMessage(playerid, COLOR_WHITE, "You've created a new text label");
    return 1;
}
I even tried to change it around abit but it doesnt create the text in game but i got no errors on script from it...

i added the sendclientmessage to see if the command is being used and that comes up but no text label is created any ideas?
Reply
#5

PHP код:
#define MAX_LABELS 1000 // Change this to the limit of labels that can be created. Since you are using a streamer, there is no actual limit (I guess).
#define LABEL_FILE "labels.ini" // Label file name.
new Text3D:CreatedLabels[MAX_LABELS] = { Text3D:INVALID_3DTEXT_ID, ...};
public 
OnGameModeInit()
{
    
LoadSavedLabels(); // Loads every label from the labels file.
    
return 1;
}
CMD:tlabel(playeridparams[])
{
    new
        
Str[110];
    if(
sscanf(params"s[110]"Str)) return SendClientMessage(playerid, -1"Usage: /tlabel <text>");
    else
    {
        new 
idx;
        for(
idx 0idx MAX_LABELS; ++idx)
        {
            if(
CreatedLabels[idx] == Text3D:INVALID_3DTEXT_ID) break; // We find an empty ID.
        
}
        if(
idx == MAX_LABELS 1) return SendClientMessage(playerid, -1"Limit of labels reached."); // Limit reached.
        
new
            
Float:PosX,
            
Float:PosY,
            
Float:PosZ,
            
data[144]
        ;
        
GetPlayerPos(playeridPosXPosYPosZ);
        
CreatedLabels[idx] = CreateDynamic3DTextLabel(StrCOLOR_REDPosXPosYPosZ40.0);
        new 
File:fLabels fopen(LABEL_FILEio_append);
        if(
fLabels)
        {
            
format(datasizeof(data), "%f|%f|%f|%s\r\n"PosXPosYPosZStr);
            
fwrite(fLabelsdata);
            
fclose(fLabels);
            
            
format(Str110">> Label ID %d has been created successfully."idx);
            
SendClientMessage(playerid, -1Str);
        }else return 
SendClientMessage(playerid, -1"There has been an error while saving the label.");
    }
    return 
1;
}
LoadSavedLabels() // Function that loads the data.
{
    new 
File:fHandle fopen(LABEL_FILEio_read),
        
Data[144];
    if(
fHandle)
    {
        new 
idxStr[128], Float:lXFloat:lYFloat:lZ;
        while(
fread(fHandleData))
        {
            
sscanf(Data"p<|>fffs[144]"lXlYlZStr); // Split the data using sscanf.
            
CreatedLabels[idx] = CreateDynamic3DTextLabel(StrCOLOR_REDlXlYlZ40.0); // Creates the label.
            
++idx;
        }
        
fclose(fHandle);
        
printf("Total of labels created: %d"idx); // Debug.
    
}
    else
    {
        new 
File:uFile fopen(LABEL_FILEio_write); fclose(uFile);
        print(
"The file \""LABEL_FILE"\" does not exists, or can't be opened. File has been created by the system.");
    }
    return 
1;

Reply
#6

Right that's got them being created now and saving in the file but now the only problem I have is that when I restart the server it's not loading the file up
Reply
#7

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)