24.03.2015, 19:45
1. So... I create TextDraw for change color
2. Add TextDrawSetSelectable
3. Add the display of these TD for players
So I deduce that while TD, and their outputs normally
And continue problem !!
Public this does not work
Original post (RU): https://sampforum.blast.hk/showthread.php?tid=568742
PHP код:
for(new i=1; i < sizeof(ChangeColor); i++)
{
ChangeColor[i] = TextDrawCreate(X, Y, "box");
TextDrawLetterSize(ChangeColor[i], 0.0, 1.426062);
TextDrawTextSize(ChangeColor[i], 40, 0.0);
TextDrawAlignment(ChangeColor[i], 1);
TextDrawColor(ChangeColor[i], -1);
TextDrawUseBox(ChangeColor[i], 1);
TextDrawBoxColor(ChangeColor[i], Colors[i]);
TextDrawSetOutline(ChangeColor[i], 0);
TextDrawBackgroundColor(ChangeColor[i], 255);
TextDrawFont(ChangeColor[i], 1);
TextDrawSetProportional(ChangeColor[i], 1);
TextDrawSetShadow(ChangeColor[i], 0);
TextDrawSetSelectable(ChangeColor[i], 1);
X = X + 25;
count++;
if(count == 4)
{
Y = Y + 30.0;
X = 25.0;
count = 1;
}
}
3. Add the display of these TD for players
So I deduce that while TD, and their outputs normally
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SUBMISSION)
{
for(new i; i < sizeof(ChangeColor); i++)
{
TextDrawShowForPlayer(playerid,ChangeColor[i]);
}
SelectTextDraw(playerid, 0xFF4040AA) ;
}
return 1;
}
Public this does not work
PHP код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
print("OnPlayerClickTextDraw 1");
if (_:clickedid == INVALID_TEXT_DRAW )
{
print("OnPlayerClickTextDraw 2");
for(new i; i < sizeof(ChangeColor); i++)
{
TextDrawHideForPlayer(playerid,ChangeColor[i]);
}
}
for(new i; i < sizeof(ChangeColor); i++)
{
print("OnPlayerClickTextDraw 3");
if(clickedid == ChangeColor[i])
{
SetPlayerColor( playerid, Colors[ i ] );
CancelSelectTextDraw( playerid ) ;
for(new j; j < sizeof(ChangeColor); j++)
{
TextDrawHideForPlayer(playerid,ChangeColor[j]);
}
}
}
return 1 ;
}