MySQL isn't Loading Text into 3DTextLabel
#1

Alright so I have been messing around with my MYSQL Script....
My 3DTextLabel is not showing the MySQL Text that its supposed to show between "(0) /getjob"
it's supposed to say something like this "(0) Drug Dealer /getjob"



here is where the TextLabel is created

pawn Код:
SyncJobPickup(jobid)
{
    if(JobPickupInfo[jobid][Exists])
    {
        new string[53];

        DestroyDynamic3DTextLabel(JobPickupInfo[jobid][NameTextLabel]);
        DestroyDynamicPickup(JobPickupInfo[jobid][Pickup]);
       
        format(string, sizeof(string), "(%d) %s /getjob", jobid, JobPickupInfo[jobid][NameText]);
        JobPickupInfo[jobid][NameTextLabel] = CreateDynamic3DTextLabel(string, -1, JobPickupInfo[jobid][PosX], JobPickupInfo[jobid][PosY], JobPickupInfo[jobid][PosZ] + 0.1, 10.0, .worldid = JobPickupInfo[jobid][WorldID], .interiorid = JobPickupInfo[jobid][InteriorID]);
        JobPickupInfo[jobid][Pickup] = CreateDynamicPickup(JobPickupInfo[jobid][ModelID], 1, JobPickupInfo[jobid][PosX], JobPickupInfo[jobid][PosY], JobPickupInfo[jobid][PosZ], .worldid = JobPickupInfo[jobid][WorldID], .interiorid = JobPickupInfo[jobid][InteriorID]);
    }
}
and heres where its all loading from

pawn Код:
forward JobPickupsLoad();
public JobPickupsLoad()
{
    new rows = cache_num_rows();
    for(new i = 0; i < rows && i < MAX_JOBPICKUPS; i ++)
    {
        cache_get_value_name_int(i, "id", JobPickupInfo[i][ID]);
        cache_get_value_name(i, "jobtext", JobPickupInfo[i][NameText]);
        cache_get_value_name_int(i, "modelid", JobPickupInfo[i][ModelID]);
        cache_get_value_name_float(i, "x", JobPickupInfo[i][PosX]);
        cache_get_value_name_float(i, "y", JobPickupInfo[i][PosY]);
        cache_get_value_name_float(i, "z", JobPickupInfo[i][PosZ]);
        cache_get_value_name_int(i, "worldid", JobPickupInfo[i][WorldID]);
        cache_get_value_name_int(i, "interiorid", JobPickupInfo[i][InteriorID]);
       
        cache_get_value_name_float(i, "streamdistance", JobPickupInfo[i][StreamDistance]);

        JobPickupInfo[i][NameTextLabel] = Text3D:INVALID_3DTEXT_ID;
        JobPickupInfo[i][Pickup] = -1;
        JobPickupInfo[i][Exists] = 1;

        SyncJobPickup(i);
    }
    printf("%i Job Pickups loaded", rows);
}
and heres my MySQL Table
Reply
#2

https://sampwiki.blast.hk/wiki/MySQL#cache_get_value_name

Read warning and add length parameter.
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MySQL#cache_get_value_name

Read warning and add length parameter.
Done, changed my enum like so "NameText[28]" got a length now
cache_get_value_name(i, "jobtext", JobPickupInfo[i][NameText]);
and jobtext in mysql has a 28 length limit. still coming up same ingame, missing the text in middle
pawn Код:
enum jobpickupinfo
{
    Exists,
    ID,
    Pickup,
    Text3D:NameTextLabel,
    NameText[28],
    ModelID,
    Float:PosX,
    Float:PosY,
    Float:PosZ,
    WorldID,
    InteriorID,
    Float:StreamDistance
};
new JobPickupInfo[MAX_JOBPICKUPS][jobpickupinfo];
Reply
#4

Код:
cache_get_value_name(i, "jobtext", JobPickupInfo[i][NameText], 28);
Reply
#5

I can't believe I missed that fixed it perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)