Help: MAX_PLAYERS - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help: MAX_PLAYERS (
/showthread.php?tid=225259)
Help: MAX_PLAYERS -
XoX - 13.02.2011
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?
Re: Help: MAX_PLAYERS -
Serbish - 13.02.2011
Post your whole code, then maybe a solution will be found.
Re: Help: MAX_PLAYERS -
SkizzoTrick - 13.02.2011
have you used TextDrawSetString?
Re: Help: MAX_PLAYERS -
XoX - 13.02.2011
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");
Re: Help: MAX_PLAYERS -
Mean - 13.02.2011
Use smthing else than playerid:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
Re: Help: MAX_PLAYERS -
Mean - 13.02.2011
Use smthing else than playerid:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
Edit: phone lags, sry for double
Re: Help: MAX_PLAYERS -
SkizzoTrick - 13.02.2011
Why don't you use public TextdrawUpdater(playerid) ?
Re: Help: MAX_PLAYERS -
XoX - 13.02.2011
can i use it again? oO
@SkizzoTrick using playerid doesn't make them showing up also
Re: Help: MAX_PLAYERS -
Serbish - 14.02.2011
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;
}
Re: Help: MAX_PLAYERS -
cessil - 14.02.2011
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