Help with textdraw and colors
#1

Well i needed some help with textdraws and color

1) How do you color a text like [INFO] Use /bla bla

i do this but it works wrong always {0x0077BB00}[INFO] use bla..

2) Same problem with textdraws

xxx has ~g~joined server

it colors joined server^

3) How to stop highlighting whole textdraw

like when i do SelectTextDraw(playerid,COLOR_RED);

it colors all clickable textdraws red when i hover my mouse

4) How to stop escape key work in textdraw

when i press esc key while textdraw is on it freezes textdraw and then its always there on my screen


I will be very thankful to you for your help and +rep for sure
Reply
#2

ummm...i didnt really understand u...by u actually mean colour embedding...if m not wrong... ill explain what all i know... u may check samp.wiki its the main source of help... ok look... i had this problem too but i learnt all by myself.

For the client message which will appear on the chat... u have to use the hex colours... their Format is RRGGBBAA... and u have to cover them with curly brackets.. for example i want to send a play message that u are an idiot..

SendClientMessage(playerid, -1,"{FF0000}You are a fucking idiot");

this will send him a message in red colour... the '-1' after playerid is the shorter way of writing color white... if u want multiple colors then it ll go like..

"{FF0000}Red Shit.{FFFF00}Now Yellow?" it ll appear first red then yellow...

and the colour embedding of textdraw and gametext are same but different than sendclientmessage...

Like they need to be within the ~ for example for red colour..
~r~Red~w~White... if the red color is dark u can apply ~h~ it ll lighten the color...tho using it a lot will make text white...
Reply
#3

For 4th question use:

pawn Code:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Text:INVALID_TEXT_DRAW) SelectTextDraw(playerid,COLOR_RED);
    return 1;
}
It will check if player pressed Key ESC and will show him cursor again.
Reply
#4

it still works,when i press esc then i am not able to select textdraw

Code:
Soldier = TextDrawCreate(275.021667, 179.666671, "Soldier");
	TextDrawLetterSize(Soldier, 0.449999, 1.600000);
	TextDrawAlignment(Soldier, 1);
	TextDrawColor(Soldier, 8388863);
	TextDrawSetShadow(Soldier, 0);
	TextDrawSetOutline(Soldier, 1);
	TextDrawBackgroundColor(Soldier, 51);
	TextDrawFont(Soldier, 2);
	TextDrawSetProportional(Soldier, 1);
	
	
	JetTrooper = TextDrawCreate(254.406707, 210.000030, "Jet Trooper");
	TextDrawLetterSize(JetTrooper, 0.458900, 1.611665);
	TextDrawAlignment(JetTrooper, 1);
	TextDrawColor(JetTrooper, 65535);
	TextDrawSetShadow(JetTrooper, 0);
	TextDrawSetOutline(JetTrooper, 1);
	TextDrawBackgroundColor(JetTrooper, 51);
	TextDrawFont(JetTrooper, 2);
	TextDrawSetProportional(JetTrooper, 1);
Reply
#5

Quote:
Originally Posted by Nabster
View Post
it still works,when i press esc then i am not able to select textdraw

Code:
Soldier = TextDrawCreate(275.021667, 179.666671, "Soldier");
	TextDrawLetterSize(Soldier, 0.449999, 1.600000);
	TextDrawAlignment(Soldier, 1);
	TextDrawColor(Soldier, 8388863);
	TextDrawSetShadow(Soldier, 0);
	TextDrawSetOutline(Soldier, 1);
	TextDrawBackgroundColor(Soldier, 51);
	TextDrawFont(Soldier, 2);
	TextDrawSetProportional(Soldier, 1);
	
	
	JetTrooper = TextDrawCreate(254.406707, 210.000030, "Jet Trooper");
	TextDrawLetterSize(JetTrooper, 0.458900, 1.611665);
	TextDrawAlignment(JetTrooper, 1);
	TextDrawColor(JetTrooper, 65535);
	TextDrawSetShadow(JetTrooper, 0);
	TextDrawSetOutline(JetTrooper, 1);
	TextDrawBackgroundColor(JetTrooper, 51);
	TextDrawFont(JetTrooper, 2);
	TextDrawSetProportional(JetTrooper, 1);
Please show the OnPlayerClickTextDraw callback.
Reply
#6

Code:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
 {
    SelectTextDraw(playerid,COLOR_RED);
	if(_:clickedid != INVALID_TEXT_DRAW)
		{
			if(clickedid == Soldier)
		    {
		         {
			        if(GetPlayerScore(playerid) >= 0)//if player have 0 score then  he can choose this class
						{
								SendClientMessage(playerid, COLOR_GREEN, "You chose the Soldier as your class.");
								TextDrawShowForPlayer(playerid,SoldierBox);
								TextDrawShowForPlayer(playerid,SoldierInfo);
								TextDrawShowForPlayer(playerid,Spawn);
					            gPlayerClass[playerid] = SOLDIER;//setting the class to soldier
					            PickedClass[playerid] = 1;
					            SetPlayerVirtualWorld(playerid, 0);
					            SetPlayerArmour(playerid,99);
								ResetPlayerWeapons(playerid);
								GivePlayerWeapon(playerid, 31, 200);
								GivePlayerWeapon(playerid, 25, 100)
								GivePlayerWeapon(playerid, 24, 70);
								TextDrawHideForPlayer(playerid,Box);
								TextDrawHideForPlayer(playerid,Soldier);
								TextDrawHideForPlayer(playerid,Class);
								TextDrawHideForPlayer(playerid,JetTrooper);
						}

                  }

			}

		}
		
  	if(clickedid == Spawn)
  	{


			TextDrawHideForPlayer(playerid,SoldierBox);
			TextDrawHideForPlayer(playerid,SoldierInfo);
   			TextDrawHideForPlayer(playerid,Spawn);
			SpawnPlayer(playerid);
			CancelSelectTextDraw(playerid);
            
  	}
    return 1;
}
Reply
#7

pawn Code:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Soldier)
    {
         {
            if(GetPlayerScore(playerid) >= 0)//if player have 0 score then  he can choose this class
        {
                SendClientMessage(playerid, COLOR_GREEN, "You chose the Soldier as your class.");
                TextDrawShowForPlayer(playerid,SoldierBox);
            TextDrawShowForPlayer(playerid,SoldierInfo);
            TextDrawShowForPlayer(playerid,Spawn);
            gPlayerClass[playerid] = SOLDIER;//setting the class to soldier
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerArmour(playerid,99);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 31, 200);
            GivePlayerWeapon(playerid, 25, 100)
            GivePlayerWeapon(playerid, 24, 70);
            TextDrawHideForPlayer(playerid,Box);
            TextDrawHideForPlayer(playerid,Soldier);
            TextDrawHideForPlayer(playerid,Class);
            TextDrawHideForPlayer(playerid,JetTrooper);
        }

           }

    }
       
    else if(clickedid == Spawn)
    {
        TextDrawHideForPlayer(playerid,SoldierBox);
    TextDrawHideForPlayer(playerid,SoldierInfo);
    TextDrawHideForPlayer(playerid,Spawn);
    pawnPlayer(playerid);
    CancelSelectTextDraw(playerid);        
    }

    else if(clickedid == Text:INVALID_TEXT_DRAW) SelectTextDraw(playerid,COLOR_RED);//If it is not working try SetTimerEx here, with internel of like 500 miliseconds//
    return 1;
}
If it is not working, try SetTimerEx for showing cursor again.
Reply
#8

Well esc problem is fixed but when i spawn i can see the cursor and i am frozen
Reply
#9

bump,need help please..
Reply
#10

Don't know, it should not happen. But for fixing it you can use it.
pawn Code:
//Under OnPlayerSpawn (Add it at the bottom of the callback, cuz I think you are using custom class selection so it should not mess with it))//
CancelSelectTextDraw(playerid);
https://sampwiki.blast.hk/wiki/CancelSelectTextDraw
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)