[Tutorial] How to use new line(Enter) with SetObjectMaterialText
#1

Hello

Today after messing around abit with SetObjectMaterialText, I thought about some idea and it worked, with this you can set text in many lines on the object, in short this tutorial show you how to use \n with SetObjectMaterialText function.

The trick is hidding in the HTTP function, so you will need a_http include.


Result:



pawn Код:
#include <a_samp>
#include <a_http>

forward Response(index, response_code, data[]);//forward http response ( https://sampwiki.blast.hk/wiki/HTTP )

new MyObj; //Define object for global use

public OnFilterScriptInit()
{
    HTTP(-1, HTTP_GET,"localhost/text.txt"," ","Response");//using HTTP_GET to read text file ( https://sampwiki.blast.hk/wiki/HTTP )
    MyObj = CreateObject(objectid,1211.9685,-1344.7974,14.1289,0.0,0.0,0.0,50.0);//Create object ( https://sampwiki.blast.hk/wiki/CreateObject)

}
public Response(index, response_code, data[])//getting http response ( https://sampwiki.blast.hk/wiki/HTTP )
{
    SetObjectMaterialText(MyObj ,data,2,140,"Arial",250,1,0xFF000000,-1,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);//Set text from the file to the object ( https://sampwiki.blast.hk/wiki/SetObjectMaterialText )
    return 1;
}
Text file contains:

Код:
12
es
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 10 Guest(s)