14.10.2013, 18:43
(
Последний раз редактировалось Shoulen; 14.10.2013 в 19:13.
)
EDIT: SOLVED
Hey Guys,
So I'm working on a bit of a race script and I have no idea why the script is behaving the way that it is.
Basically I have created 16 textdraws using a loop that is run OnGameModeInit()
pawn Код:
for(new i = 0; i < 16; i++) {
ScoreboardNames[i] = TextDrawCreate(480.000000, 130+(i*10), "~r~Error");
TextDrawFont(ScoreboardNames[i], 2);
TextDrawLetterSize(ScoreboardNames[i], 0.200000, 1.000000);
TextDrawColor(ScoreboardNames[i], -1);
TextDrawSetOutline(ScoreboardNames[i], 1);
TextDrawSetProportional(ScoreboardNames[i], 1);
TextDrawSetSelectable(ScoreboardNames[i], 0);
}
Once the user crosses the last checkpoint (Finish line) a variable (called Finish) will decide upon which place they came (As it increments every time someone finishes) and that will then decide on which Textdraw will be displayed (as it will correspond with the Textdraw.)
OnPlayerEnterRaceCheckpoint() [On the last checkpoint]:
pawn Код:
CurrCP[playerid] = 0;
if(Finish == 0) { TextDrawShowForAll(ScoreboardBG); TextDrawShowForAll(Scoreboard); }
new string[35];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "~g~%i. ~w~%s", Finish+1, pname);
TextDrawSetString(ScoreboardNames[Finish], string);
TextDrawShowForAll(ScoreboardNames[Finish]);
DisablePlayerRaceCheckpoint(playerid);
Finish++;
GameTextForPlayer(playerid, "~g~Finished!", 2000, 5);
When I ran
pawn Код:
new string[35];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "~g~%i. ~w~%s", Finish+1, pname);
TextDrawSetString(ScoreboardNames[Finish], string);
TextDrawShowForAll(ScoreboardNames[Finish]);
When I ran the code within the OnPlayerEnterRaceCheckpoint(playerid) callback, I receive an error where only one textdraw in the ScoreboardNames[] array can be displayed at a time, it moves to the correct location, however, it hides the textdraw above it.
I'm really stuck on this and have no idea what to do to fix it.
Thanks,