new sTimer;//variavel para armazenar o timer
public OnPlayerSpawn(playerid)//public chamada quando o player spawna
{
sTimer = SetTimerEx("MostrarScore", 1000, true, "d", playerid);//timer chamado de 1 em 1 segundo para atualizar a textdraw
return 1;//isso retorna informaзхes para o servidor sobre o cуdigo que estava na public
}
forward MostrarScore(playerid);//aqui crio uma public nova
public MostrarScore(playerid)//aqui utilizo a public criada
{
new String[40],
score = GetPlayerScore(playerid);//variбvel para armazenar o score, ja inserindo o score nela
format(String, sizeof(String), "Score: %d",score);//aqui insiro na String o score do player
TextDrawSetString(SuaText, String);//aqui insiro na TextDraw a String
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
return 1;
}
public OnPlayerConnect(playerid)
{
TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid, 586.250000, 6.250006, "0");
PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][0], 0.332498, 1.792499);
PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][0], 1);
PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][0], -2948865);
PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 0);
PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][0], 1);
PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0], 2);
PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][0], 1);
PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 0);
PlayerTextDrawSetString(playerid, TDEditor_PTD[playerid][0], Stringpequena);
PHP код:
|
PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][0]);