SA-MP Forums Archive
Textdraw Team. - 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)
+--- Thread: Textdraw Team. (/showthread.php?tid=350658)



Textdraw Team. - Nicholas. - 13.06.2012

I am trying to display my selected team/class when spawn using a textdraw but it won't work.

- OnPlayerConnect.

pawn Код:
Team[playerid] = TextDrawCreate(495.000000, 118.000000, "Team: %s");
    TextDrawBackgroundColor(Team[playerid], 255);
    TextDrawFont(Team[playerid], 1);
    TextDrawLetterSize(Team[playerid], 0.420000, 1.900000);
    TextDrawColor(Team[playerid], -1);
    TextDrawSetOutline(Team[playerid], 1);
    TextDrawSetProportional(Team[playerid], 1);
- OnPlayerSpawn.

pawn Код:
TextDrawShowForPlayer(playerid, Team[playerid]);
- Forwards.

pawn Код:
forward Stats(playerid);
public Stats(playerid)
{
    new String[5];
    format(String, sizeof(String), "Team: %s", GetTeamName(playerid));
    TextDrawSetString(Team[playerid], String);
}

forward GetTeamName(playerid);
public GetTeamName(playerid)
{
    new String[30];
    switch(GetPlayerTeam(playerid))
    {
        case 0: format(String, sizeof(String), "---");
        case 1: format(String, sizeof(String), "---");
        case 2: format(String, sizeof(String), "---");
        case 3: format(String, sizeof(String), "---");
        case 4: format(String, sizeof(String), "---");
    }
    return 1;
}



Re: Textdraw Team. - park4bmx - 13.06.2012

pawn Код:
forward GetTeamName(playerid);
public GetTeamName(playerid)
{
    new String[30];
    switch(GetPlayerTeam(playerid))
    {
        case 0: format(String, sizeof(String), "---");
        case 1: format(String, sizeof(String), "---");
        case 2: format(String, sizeof(String), "---");
        case 3: format(String, sizeof(String), "---");
        case 4: format(String, sizeof(String), "---");
    }
    return String;
}
you need to return the string
also if it dont work but it should if you have the GetPlayerTeam(playerid) defined currectly


Re: Textdraw Team. - Nicholas. - 14.06.2012

Didn't worked.


Respuesta: Textdraw Team. - CidadeNovaRP - 14.06.2012

pawn Код:
forward Stats(playerid);
public Stats(playerid)
{
    new String[5];
    format(String, sizeof(String), "Team: %s", GetTeamName(playerid));
    TextDrawHideForPlayer(playerid, Team[playerid]);
    TextDrawSetString(Team[playerid], String);
    TextDrawShowForPlayer(playerid, Team[playerid]);
}