Help: MAX_PLAYERS
#1

I made a code for updating my textdraws but if i use
Код:
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
they don't show up? Why?
Reply
#2

Post your whole code, then maybe a solution will be found.
Reply
#3

have you used TextDrawSetString?
Reply
#4

Ok it should be a simple exp sys.

Код:
new Text:EXP;
new Text:LVL[MAX_PLAYERS];
new Text:NUMBER[MAX_PLAYERS];
forward TextdrawUpdater();

public OnGameModeInit()
{
	SetTimer("TextdrawUpdater", 5000, 1);
        //...
}

public TextdrawUpdater()
{
	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
	LVL[playerid] = TextDrawCreate(592.000000, 440.000000, "LV:0");
	TextDrawBackgroundColor(LVL[playerid], 255);
	TextDrawFont(LVL[playerid], 1);
	TextDrawLetterSize(LVL[playerid], 0.209999, 0.699899);
	TextDrawColor(LVL[playerid], -1);
	TextDrawSetOutline(LVL[playerid], 0);
	TextDrawSetProportional(LVL[playerid], 1);
	TextDrawSetShadow(LVL[playerid], 1);

	NUMBER[playerid] = TextDrawCreate(566.000000, 440.000000, "0/15");
	TextDrawBackgroundColor(NUMBER[playerid], 255);
	TextDrawFont(NUMBER[playerid], 1);
	TextDrawLetterSize(NUMBER[playerid], 0.210000, 0.699999);
	TextDrawColor(NUMBER[playerid], -1);
	TextDrawSetOutline(NUMBER[playerid], 0);
	TextDrawSetProportional(NUMBER[playerid], 1);
	TextDrawSetShadow(NUMBER[playerid], 1);
    }


	for(new i; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
 		{
  		TextDrawShowForPlayer(i, EXP);
		TextDrawShowForPlayer(i, LVL[i]);
		TextDrawShowForPlayer(i, NUMBER[i]);
		}
	}
	return 1;
}
@SkizzoTrick yes for udating i'm using it
Код:
TextDrawSetString(NUMBER[playerid], "blabla");
Reply
#5

Use smthing else than playerid:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
Reply
#6

Use smthing else than playerid:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
Edit: phone lags, sry for double
Reply
#7

Why don't you use public TextdrawUpdater(playerid) ?
Reply
#8

can i use it again? oO
@SkizzoTrick using playerid doesn't make them showing up also
Reply
#9

pawn Код:
new Text:EXP;
new Text:LVL[MAX_PLAYERS];
new Text:NUMBER[MAX_PLAYERS];

forward TextdrawUpdater();

public OnGameModeInit()
{
    SetTimer("TextdrawUpdater", 5000, 1);

    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        LVL[playerid] = TextDrawCreate(592.000000, 440.000000, "LV:0");
        TextDrawBackgroundColor(LVL[playerid], 255);
        TextDrawFont(LVL[playerid], 1);
        TextDrawLetterSize(LVL[playerid], 0.209999, 0.699899);
        TextDrawColor(LVL[playerid], -1);
        TextDrawSetOutline(LVL[playerid], 0);
        TextDrawSetProportional(LVL[playerid], 1);
        TextDrawSetShadow(LVL[playerid], 1);

        NUMBER[playerid] = TextDrawCreate(566.000000, 440.000000, "0/15");
        TextDrawBackgroundColor(NUMBER[playerid], 255);
        TextDrawFont(NUMBER[playerid], 1);
        TextDrawLetterSize(NUMBER[playerid], 0.210000, 0.699999);
        TextDrawColor(NUMBER[playerid], -1);
        TextDrawSetOutline(NUMBER[playerid], 0);
        TextDrawSetProportional(NUMBER[playerid], 1);
        TextDrawSetShadow(NUMBER[playerid], 1);
    }
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, EXP);
    TextDrawShowForPlayer(playerid, LVL[playerid]);
    TextDrawShowForPlayer(playerid, NUMBER[playerid]);
    return 1;
}

public TextdrawUpdater()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        TextDrawSetString(LVL[playerid], "blabla");
        TextDrawSetString(NUMBER[playerid], "blabla2");
    }
    return 1;
}
Reply
#10

don't create a new textdraw every 5 seconds for every player, update the string only, create the texdraws when a player connects or ongamemodeinit, make sure you delete it when the player leaves if you create it onplayeronnect
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)