Textdraw
#1

Hello i am using Yagu race system.In that an auto message will show when the race is ready.
I want to make when the message show then at the same time a textdraw should show and that textdraw should disappear after 30 seconds.

Here is the textdraw
pawn Код:
Ygversion = TextDrawCreate(283.000000, 58.000000, "type /join to join the race");
    TextDrawBackgroundColor(Ygversion, 255);
    TextDrawFont(Ygversion, 2);
    TextDrawLetterSize(Ygversion, 0.200000, 1.200001);
    TextDrawColor(Ygversion, -65281);
    TextDrawSetOutline(Ygversion, 0);
    TextDrawSetProportional(Ygversion, 1);
    TextDrawSetShadow(Ygversion, 1);
pawn Код:
public startrace()
{
    format(ystring,128,"Race '%s' is about to start, type /join to join!",CRaceName);
    SendClientMessageToAll(yellow,ystring);
    if(Racemode == 0) format(ystring,sizeof(ystring),"default");
    else if(Racemode == 1) format(ystring,sizeof(ystring),"ring");
    else if(Racemode == 2) format(ystring,sizeof(ystring),"yoyo");
    else if(Racemode == 3) format(ystring,sizeof(ystring),"mirror");
    format(ystring,sizeof(ystring),"Racemode: %s Laps: %d",ystring,Racelaps);
    if(PrizeMode >= 2) format(ystring,sizeof(ystring),"%s Join fee: %d",ystring,JoinFee);
    if(Airrace == 1) format(ystring,sizeof(ystring),"%s AIR RACE",ystring);
    if(Racemode == 0 || Racemode == 3) format(ystring,sizeof(ystring),"%s Track lenght: %0.2fkm", ystring, RLenght/1000);
    else if(Racemode == 1) format(ystring,sizeof(ystring),"%s Lap lenght: %.2fkm, Total: %.2fkm", ystring, LLenght/1000, LLenght * Racelaps / 1000);
    SendClientMessageToAll(yellow,ystring);
    //i think here is the textdraw should come and it should disappear after 30 seconds
    RaceStart=0;
    RaceActive=1;
    ScoreChange=0;
    Ranking=1;
    PrizeMP=3;
}
Please help me
Reply
#2

Try to follow:

pawn Код:
public OnGameModeInit()
{
    //creating the textdraw
    Ygversion = TextDrawCreate(283.000000, 58.000000, "type /join to join the race");
    TextDrawBackgroundColor(Ygversion, 255);
    TextDrawFont(Ygversion, 2);
    TextDrawLetterSize(Ygversion, 0.200000, 1.200001);
    TextDrawColor(Ygversion, -65281);
    TextDrawSetOutline(Ygversion, 0);
    TextDrawSetProportional(Ygversion, 1);
    TextDrawSetShadow(Ygversion, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawHideForPlayer(playerid,Ygversion);//just make sure it stay hidden until it's ready to be used
    return 1;
}

public startrace()
{
    format(ystring,128,"Race '%s' is about to start, type /join to join!",CRaceName);
    SendClientMessageToAll(yellow,ystring);
    TextDrawShowForPlayer(playerid,Ygversion);//showing it when it's time to use it
    SetTimerEx("TextDraw_HideRaceTextDraw",30000,false,"i",playerid);//set a 30s timer to hide it
    if(Racemode == 0) format(ystring,sizeof(ystring),"default");
    else if(Racemode == 1) format(ystring,sizeof(ystring),"ring");
    else if(Racemode == 2) format(ystring,sizeof(ystring),"yoyo");
    else if(Racemode == 3) format(ystring,sizeof(ystring),"mirror");
    format(ystring,sizeof(ystring),"Racemode: %s Laps: %d",ystring,Racelaps);
    if(PrizeMode >= 2) format(ystring,sizeof(ystring),"%s Join fee: %d",ystring,JoinFee);
    if(Airrace == 1) format(ystring,sizeof(ystring),"%s AIR RACE",ystring);
    if(Racemode == 0 || Racemode == 3) format(ystring,sizeof(ystring),"%s Track lenght: %0.2fkm", ystring, RLenght/1000);
    else if(Racemode == 1) format(ystring,sizeof(ystring),"%s Lap lenght: %.2fkm, Total: %.2fkm", ystring, LLenght/1000, LLenght * Racelaps / 1000);
    SendClientMessageToAll(yellow,ystring);
    //i think here is the textdraw should come and it should disappear after 30 seconds
    RaceStart=0;
    RaceActive=1;
    ScoreChange=0;
    Ranking=1;
    PrizeMP=3;
}

forward TextDraw_HideRaceTextDraw(playerid);
public TextDraw_HideRaceTextDraw(playerid)
{
    TextDrawHideForPlayer(playerid,Ygversion);//textdraw will be hidden when this function is called
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)