SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/12/2018, 06:05 PM   #1
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default MySQL isn't Loading Text into 3DTextLabel

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 Code:
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 Code:
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
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs

Last edited by SkyFlare; 28/12/2018 at 06:09 PM. Reason: added mysql table
SkyFlare is offline   Reply With Quote
Old 28/12/2018, 06:31 PM   #2
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: MySQL isn't Loading Text into 3DTextLabel

https://wiki.sa-mp.com/wiki/MySQL#cache_get_value_name

Read warning and add length parameter.
Calisthenics is offline   Reply With Quote
Old 28/12/2018, 08:29 PM   #3
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: MySQL isn't Loading Text into 3DTextLabel

Quote:
Originally Posted by Calisthenics View Post
https://wiki.sa-mp.com/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 Code:
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];
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Old 28/12/2018, 08:34 PM   #4
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: MySQL isn't Loading Text into 3DTextLabel

Code:
cache_get_value_name(i, "jobtext", JobPickupInfo[i][NameText], 28);
Calisthenics is offline   Reply With Quote
Old 28/12/2018, 08:39 PM   #5
SkyFlare
Huge Clucker
 
SkyFlare's Avatar
 
Join Date: Apr 2015
Location: NZ
Posts: 221
Reputation: 43
Default Re: MySQL isn't Loading Text into 3DTextLabel

I can't believe I missed that fixed it perfectly
__________________
Purchasable Scripting Services Available, Inbox me with your Requests.
My Project Progress Tracker
My Work
Link
Information
S-Store System V2 LinkIngame Store in Dialogs
SkyFlare is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3dTextLabel not loading right AndreiWow Scripting Help 3 02/02/2017 04:21 PM
3d text labels vs dynamic 3dtextlabel audriuxxx Scripting Help 1 09/03/2014 06:29 PM
3DTextLabel Text Wrap Sk1lleD Scripting Help 7 24/03/2013 12:55 PM
MySQL - 3D Text Loading from Database! nGen.SoNNy Scripting Help 6 15/05/2012 03:47 PM
[MySQL] Text loading from database Agent Smith Help Archive 0 12/09/2010 10:27 AM


All times are GMT. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.