Jump to content

[HELP] Why not working dxCreateFont?


Tokio

Recommended Posts

On my client the dx-font working fine, but with another client the dx-font does not working.. 

Got this warning: WARNING: customchat\sourceC.Lua:164: Bad argument @ 'dxDrawText' [Expected dx-font at argument 8, got boolean]

the code:

local TwCen14s = dxCreateFont('TwCen.ttf', 10)

		dxDrawText("Chat: #ffFFff"..chat.input, sx / 2 - 450 - 255, sy / 2 - 356 - 60 + 25 * chat.maxShowedMessage, 450, 300, tocolor(255, 181, 64, 255), 1, TwCen14s,_,_,_,_,_,true)

what wrong?... how can i fix this problem?

Link to comment
7 minutes ago, HassoN said:

This warning means your font was failed to load so it is returning 'false' value.

Make sure that you've added the font to your meta and/or make sure of the spelling of the file's name.

i added the font to meta, and correct the file name.. 

Link to comment

@Tokio, make sure that you have enough memory to create a new font

To see if creation is likely to fail, use dxGetStatus. (When VideoMemoryFreeForMTA is zero, failure is guaranteed.)
(c) Wiki

You can check it using dxSetTestMode function or with the following code below

local st = dxGetStatus()
print("Memory: "..(st.VideoMemoryFreeForMTA).."/"..(st.VideoCardRAM).." MB.")

 

  • Like 1
Link to comment
  • Moderators

 

For the cause of the issue, see post of @JeViCo

 

Fallback in case of failure:

local TwCen14s = dxCreateFont('TwCen.ttf', 10) or "default"

@Tokio

 

Also delete the file out of your mta cache folder. You may have it, but if you changed the destination of the file + in the meta but not in the script. You do have the font from the previous download, but everybody else does not. Files do not delete themselves after all. So check that as well, as

@HassoN

said.

 

Edited by IIYAMA
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...