07.08.2013, 13:42
something like that
pawn Код:
new Text:score[MAX_PLAYERS];//define var for textdraw (MAX_PLAYERS)
public OnGameModeInit()
{
SetTimer("MyFunction",2000,true);//creates the timer
/*Creates the textdraw for every player*/
for(new i = 0; i != MAX_PLAYERS; i++) {//loop trough all players (i = playerid)
score[i] = TextDrawCreate(545.0, 35.0, "_");
TextDrawLetterSize(score[i] , 0.2, 1.0);
TextDrawColor(score[i] , 0x800080FF);
TextDrawSetShadow(score[i] , 2);
TextDrawSetOutline(score[i] , true);
}
return 1;
}
forward MyFunction();//forward the function
public MyFunction()//the function (MyFunction)
{
new text[41];//variable store the text
for(new i = 0; i != MAX_PLAYERS; i++) {//loop trough all players (i = playerid)
if(IsPlayerConnected(i)) { //player is connected ok then do something
format(text, sizeof(text), "Score: %d",pScore[i]);
TextDrawSetString(score[i], text);
TextDrawShowForPlayer(i,score[i]);
}
}
}