Turn Signal timer
#1

Hi, today i have create a textdraw ( speedometer ) , and i have put "<" and ">" symbol for my turn signal system , but now idk how to make a timer to change the textdraw color and to make it like a signal , the textdraw "TDEditor_PTD[playerid][22]" is the left signal "<" and TDEditor_PTD[playerid][21] is the right signal ">", when the player click A the left turn signal be in green color and after 1000 MS it's will be in black color and that's will repet, i have do that for this moment :

pawn Код:
forward TurnSignalOFF(playerid);
public TurnSignalOFF(playerid)
{
    if(turnleft[playerid] == 1)
    {
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][22]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][22], -2139062017);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][22]);
        return 1;
    }
    if(turnright[playerid] == 1)
    {
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][21]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][21], -2139062017);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][21]);
        return 1;
    }
    return 1;
}
forward TurnSignalON(playerid);
public TurnSignalON(playerid)
{
    if(turnleft[playerid] == 1)
    {
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][22]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][22], 16711935);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][22]);
        return 1;
    }
    if(turnright[playerid] == 1)
    {
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][21]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][21], 16711935);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][21]);
        return 1;
    }
    return 1;
}
Reply
#2

Код:
forward TurnSignalOFF(playerid);
public TurnSignalOFF(playerid)
{
	if(turnleft[playerid] == 1)
	{
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][22]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][22], -2139062017);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][22]);
        return 1;
	}
    if(turnright[playerid] == 1)
	{
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][21]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][21], -2139062017);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][21]);
		return 1;
	}
     if(turnright[playerid] == 1 || turnleft[playerid] == 1)
    SetTimerEx("TurnSignalON", 1000, false, "i", playerid);
    return 1;
}
forward TurnSignalON(playerid);
public TurnSignalON(playerid)
{
	if(turnleft[playerid] == 1)
	{
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][22]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][22], 16711935);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][22]);
        return 1;
	}
    if(turnright[playerid] == 1)
	{
        PlayerTextDrawHide(playerid, TDEditor_PTD[playerid][21]);
        PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][21], 16711935);
        PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][21]);
		return 1;
	}
     if(turnright[playerid] == 1 || turnleft[playerid] == 1)
            SetTimerEx("TurnSignalOFF", 1000, false, "i", playerid);
    return 1;
}
this maybe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)