Textdraws: Team, Score, Kills, Deaths.
#1

- OnGameModeInit

pawn Код:
SetTimer("Status", 300, 1);

for(new i = 0; i < MAX_PLAYERS; i++)
    {
    TEAM[i] = TextDrawCreate(495.000000, 118.000000, "_");
    TextDrawBackgroundColor(TEAM[i], 255);
    TextDrawFont(TEAM[i], 1);
    TextDrawLetterSize(TEAM[i], 0.420000, 1.900000);
    TextDrawColor(TEAM[i], -1);
    TextDrawSetOutline(TEAM[i], 1);
    TextDrawSetProportional(TEAM[i], 1);

    SCORE[i] = TextDrawCreate(495.000000, 136.000000, "_");
    TextDrawBackgroundColor(SCORE[i], 255);
    TextDrawFont(SCORE[i], 1);
    TextDrawLetterSize(SCORE[i], 0.420000, 1.900000);
    TextDrawColor(SCORE[i], -1);
    TextDrawSetOutline(SCORE[i], 1);
    TextDrawSetProportional(SCORE[i], 1);

    KILL[i] = TextDrawCreate(495.000000, 156.000000, "_");
    TextDrawBackgroundColor(KILL[i], 255);
    TextDrawFont(KILL[i], 1);
    TextDrawLetterSize(KILL[i], 0.420000, 1.900000);
    TextDrawColor(KILL[i], -1);
    TextDrawSetOutline(KILL[i], 1);
    TextDrawSetProportional(KILL[i], 1);

    DEATH[i] = TextDrawCreate(495.000000, 175.000000, "_");
    TextDrawBackgroundColor(DEATH[i], 255);
    TextDrawFont(DEATH[i], 1);
    TextDrawLetterSize(DEATH[i], 0.420000, 1.900000);
    TextDrawColor(DEATH[i], -1);
    TextDrawSetOutline(DEATH[i], 1);
    TextDrawSetProportional(DEATH[i], 1);
    }
- OnGameModeExit

pawn Код:
for(new i = 0;i < MAX_PLAYERS; i++)
    {
        TextDrawDestroy(TEAM[i]);
        TextDrawDestroy(SCORE[i]);
        TextDrawDestroy(KILL[i]);
        TextDrawDestroy(DEATH[i]);
    }
- OnPlayerSpawn

pawn Код:
TextDrawShowForPlayer(playerid, TEAM[playerid]);
    TextDrawShowForPlayer(playerid, SCORE[playerid]);
    TextDrawShowForPlayer(playerid, KILL[playerid]);
    TextDrawShowForPlayer(playerid, DEATH[playerid]);
pawn Код:
forward Status(playerid);
public Status(playerid)
{
    new String[5];

    format(String, sizeof(String), "Team: %s", GetTeamName(playerid));
    TextDrawSetString(TEAM[playerid], String);
   
    format(String, sizeof(String), "Score: %d", PlayerInfo[playerid][Scores]);
    TextDrawSetString(SCORE[playerid], String);
   
    format(String, sizeof(String), "Kills: %d", PlayerInfo[playerid][Kills]);
    TextDrawSetString(KILL[playerid], String);
   
    format(String, sizeof(String), "Deaths: %d", PlayerInfo[playerid][Deaths]);
    TextDrawSetString(DEATH[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 String;
}
I coded this into my script but the textdraws won't work probably. Do anyone see anything wrong with the coding?
When I log into the game and spawn the textdraws won't show up properly and they're like THIS on the screen.

Quote:

Team
Scor
Kill
Deat

Reply


Messages In This Thread
Textdraws: Team, Score, Kills, Deaths. - by Nicholas. - 14.06.2012, 02:44
Re: Textdraws: Team, Score, Kills, Deaths. - by Jonny5 - 14.06.2012, 02:48
Re: Textdraws: Team, Score, Kills, Deaths. - by Nicholas. - 14.06.2012, 03:15

Forum Jump:


Users browsing this thread: 1 Guest(s)