Help with SetObjectMaterialText
#1

Hello, well I am quite new to this command, never did anything with it. I got this idea that I want to make, like a grafitti system, so if a player sprays near the wall a text will appear. I already got a system like that, I just want to ask how does the SetObjectMaterialText should work. How can I chose the font and the color of the text and do i need to set the text instead of some object or??

-thanks
Reply
#2

You need to create an object and then apply the material text to it. Look at the parameters of the function and the example: https://sampwiki.blast.hk/wiki/SetObjectMaterialText
Reply
#3

Let's say I want to replace the Grove Street Families tag object with text, is it possible to do so?
Reply
#4

You can replace almost any object with text. Create the object as you normally would and store the ID, then use SetObjectMaterialText on that object's stored ID.
Reply
#5

Hmm, for some reason it wont work for me IG, maybe you could help me out with this one.

Код:
		if(GangInfo[playerid][Gang] == 1)
	    {
         for(new stags = Tag; stags < MAX_TAGS; stags++)
	        {
	       		if (Tag >= MAX_TAGS-1) return SendClientMessage(playerid,COLOR_RED,"You can no longer spray tags because there are too many tags.");
	    		new Float:X, Float:Y, Float:Z,Float:A,name[24];
				GetPlayerPos(playerid, X, Y, Z);
				GetPlayerFacingAngle(playerid, A);
				GetPlayerName(playerid,name,24);
				X += (1 * floatsin(-A, degrees));
				Y += (1 * floatcos(-A, degrees));
				TagInfo[stags][tgX] = X;
    			TagInfo[stags][tgY] = Y;
    			TagInfo[stags][tgZ] = Z;
				Sprayed[playerid] = 1;
				Tag += 1;
    			Spray[stags] = CreateObject(ROLLIN_TAG, X, Y, Z, 0.0, 0.0, A+90);
                SetObjectMaterialText(ROLLIN_TAG, "SA-MP {FFFFFF}0.3{008500}e {FF8200}RC7", 0, OBJECT_MATERIAL_SIZE_256x128,\
				"Arial", 28, 0, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
				GameTextForPlayer(playerid,"~0x800080AA~Sprayed!",3000,3);
    			PlayerPlaySound(playerid,1057,0,0,0);
    			strmid(TagInfo[stags][tgSprayer], name, 0, strlen(name),128);
    			printf("[TAG] %s - %d",TagInfo[stags][tgSprayer],stags);
    			break;
			}
		}
It just sprays the original spray tag IG.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)