12.01.2011, 15:01
I have this code:
It is supposed to create 5 textdraws to simulate connect/disconnect messages similar to SACNR one but in a different position...
For some reason it only displays 4 textdraws... seems like it skips textdraw 0... what could be the problem?
Код:
#include <a_samp> new Text:cText[6], cContent[6][64]; public OnFilterScriptInit() { for(new i=0; i<5; i++) { format(cContent[i], 64, " "); cText[i] = TextDrawCreate(155.000000, 350.0+(i*10), " "); TextDrawBackgroundColor(cText[i], 255); TextDrawFont(cText[i], 1); TextDrawLetterSize(cText[i], 0.300000, 0.799999); TextDrawColor(cText[i], -1); TextDrawSetOutline(cText[i], 1); TextDrawSetProportional(cText[i], 1); } return 1; } public OnFilterScriptExit() { for(new i=0; i<5; i++) { TextDrawHideForAll(cText[i]); TextDrawDestroy(cText[i]); } return 1; } public OnPlayerConnect(playerid) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); format(cContent[5], 64, "~g~JOIN: ~w~%s (%d)", pName, playerid); for(new i=0; i<5; i++) { format(cContent[i], 64, "%d. %s", i, cContent[i+1]); TextDrawHideForAll(cText[i]); TextDrawSetString(cText[i], cContent[i]); TextDrawShowForAll(cText[i]); } } public OnPlayerDisconnect(playerid, reason) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); switch(reason) { case 0:{format(cContent[5], 64, "~y~TIME: ~w~%s (%d)", pName, playerid);} case 1:{format(cContent[5], 64, "~r~QUIT: ~w~%s (%d)", pName, playerid);} case 2:{format(cContent[5], 64, "~r~QUIT: ~w~%s (%d)", pName, playerid);} } for(new i=0; i<5; i++) { format(cContent[i], 64, "%d. %s", i, cContent[i+1]); TextDrawHideForAll(cText[i]); TextDrawSetString(cText[i], cContent[i]); TextDrawShowForAll(cText[i]); } }
For some reason it only displays 4 textdraws... seems like it skips textdraw 0... what could be the problem?