SA-MP Forums Archive
TextdrawSetString? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: TextdrawSetString? (/showthread.php?tid=211019)



TextdrawSetString? - legho - 14.01.2011

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


Re: TextdrawSetString? - alpha500delta - 14.01.2011

"Please help me fix this, thank you"


Re: TextdrawSetString? - armyoftwo - 14.01.2011

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


Re: TextdrawSetString? - legho - 14.01.2011

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 );


Re: TextdrawSetString? - armyoftwo - 14.01.2011

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



Re: TextdrawSetString? - DVDK - 14.01.2011

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;
}



Re: TextdrawSetString? - armyoftwo - 14.01.2011

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()


Re: TextdrawSetString? - DVDK - 14.01.2011

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.


Re: TextdrawSetString? - armyoftwo - 14.01.2011

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