TextdrawSetString?
#1

Wondering why this isnt working?
http://pastebin.com/Ui7AWTfE
not working
Reply
#2

"Please help me fix this, thank you"
Reply
#3

pawn Код:
public OnPlayerConnect(playerid)
{
        SetTimer("ShowWelcomeMessage",1000,true);
        return 1;
}
 
public ShowWelcomeMessage(playerid)
{
        WelcomeMessageStage ++;
        if(WelcomeMessageStage == 1)
        {
                TextDrawSetString(WelcomeMessage,"Welcome to!");
        }
        else if(WelcomeMessageStage == 2)
        {
                TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        }
        else if(WelcomeMessageStage == 3)
        {
                TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        }
        else if(WelcomeMessageStage == 4)
        {
                TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        }
        else if(WelcomeMessageStage == 5)
        {
                TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
                WelcomeMessageStage =0;
        }
        TextDrawShowForPlayer(playerid, WelcomeMessage);
        return 1;
}
Try this
EDIT: I just fixed the code again
Reply
#4

Quote:
Originally Posted by armyoftwo
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
        SetTimer("ShowWelcomeMessage",1000,true);
        return 1;
}
 
public ShowWelcomeMessage(playerid)
{
        WelcomeMessageStage ++;
        if(WelcomeMessageStage == 1)
        {
                TextDrawSetString(WelcomeMessage,"Welcome to!");
        }
        else if(WelcomeMessageStage == 2)
        {
                TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        }
        else if(WelcomeMessageStage == 3)
        {
                TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        }
        else if(WelcomeMessageStage == 4)
        {
                TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        }
        else if(WelcomeMessageStage == 5)
        {
                TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
                WelcomeMessageStage =0;
        }
        TextDrawShowForPlayer(playerid, WelcomeMessage);
        return 1;
}
Try this
EDIT: I just fixed the code again

hey warning on this line.
Tag mismatch TextDrawShowForPlayer(playerid,WelcomeMessageStage );
Reply
#5

pawn Код:
TextDrawShowForPlayer(playerid, WelcomeMessage);
Reply
#6

pawn Код:
new PlayerTimer[MAX_PLAYERS];
new PlayerWelcomeMessageState[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, WelcomeMessage);
    PlayerTimer[playerid] = SetTimerEx("ShowWelcomeMessage", 1000, true, "d", playerid);
    return 1;
}

public ShowWelcomeMessage(playerid)
{
    PlayerWelcomeMessageState[playerid] ++;
    switch(PlayerWelcomeMessageState[playerid])
    {
        case 1: TextDrawSetString(WelcomeMessage,"Welcome to!");
        case 2: TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        case 3: TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        case 4: TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        case 5: TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
        case 6:
        {
            KillTimer(PlayerTimer[playerid]);
            TextDrawHideForPlayer(playerid, WelcomeMessage);
        }

    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by DVDK
Посмотреть сообщение
pawn Код:
new PlayerTimer[MAX_PLAYERS];
new PlayerWelcomeMessageState[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, WelcomeMessageStage);
    PlayerTimer[playerid] = SetTimer("ShowWelcomeMessage", 1000, true, "d", playerid);
    return 1;
}

public ShowWelcomeMessage(playerid)
{
    PlayerWelcomeMessageState[playerid] ++;
    switch(PlayerWelcomeMessageState[playerid])
    {
        case 1: TextDrawSetString(WelcomeMessage,"Welcome to!");
        case 2: TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        case 3: TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        case 4: TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        case 5: TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
        case 6:
        {
            KillTimer(PlayerTimer[playerid]);
            TextDrawShowForPlayer(playerid, WelcomeMessageStage);
        }

    }
    return 1;
}
pawn Код:
new PlayerTimer[MAX_PLAYERS];
new PlayerWelcomeMessageState[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, WelcomeMessageStage);
    PlayerTimer[playerid] = SetTimer("ShowWelcomeMessage", 1000, true, "d", playerid);
    return 1;
}

public ShowWelcomeMessage(playerid)
{
    PlayerWelcomeMessageState[playerid] ++;
    switch(PlayerWelcomeMessageState[playerid])
    {
        case 1: TextDrawSetString(WelcomeMessage,"Welcome to!");
        case 2: TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        case 3: TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        case 4: TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        case 5: TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
        case 6:
        {
            KillTimer(PlayerTimer[playerid]);
            TextDrawShowForPlayer(playerid, WelcomeMessage);
        }

    }
    return 1;
}
The problem was that he was showing the wrong textdraw.
In this case he was editing WelcomeMessage Textdraw, but he tried to show WelcomeMessageStage textdraw

DVDK's method is faster, because use of switch()
Reply
#8

Quote:
Originally Posted by armyoftwo
Посмотреть сообщение
pawn Код:
new PlayerTimer[MAX_PLAYERS];
new PlayerWelcomeMessageState[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, WelcomeMessageStage);
    PlayerTimer[playerid] = SetTimer("ShowWelcomeMessage", 1000, true, "d", playerid);
    return 1;
}

public ShowWelcomeMessage(playerid)
{
    PlayerWelcomeMessageState[playerid] ++;
    switch(PlayerWelcomeMessageState[playerid])
    {
        case 1: TextDrawSetString(WelcomeMessage,"Welcome to!");
        case 2: TextDrawSetString(WelcomeMessage,"~g~K~w~Z~b~R");
        case 3: TextDrawSetString(WelcomeMessage,"~h~Welcome ~h~to!");
        case 4: TextDrawSetString(WelcomeMessage,"Kamikaze Racing");
        case 5: TextDrawSetString(WelcomeMessage,"~h~Kamikaz~h~e ~h~Racing");
        case 6:
        {
            KillTimer(PlayerTimer[playerid]);
            TextDrawShowForPlayer(playerid, WelcomeMessage);
        }

    }
    return 1;
}
The problem was that he was showing the wrong textdraw.
In this case he was editing WelcomeMessage Textdraw, but he tried to show WelcomeMessageStage textdraw
No, the problem was that SetTimer isn't returning any playerid.
And he didn't end the timer, and the state also wasn't including any playerid.
Reply
#9

Quote:
Originally Posted by DVDK
Посмотреть сообщение
No, the problem was that SetTimer isn't returning any playerid.
The problem was there too, just didn't notice ,because i noticed only the WelcomeMessageStage and didnt notice rest of the code

Edit: You're wrong, you don't need any player id's there. Use my code above it's better, but you can convert it to switch too
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)