[Pedido] Contador de Kills e Mortes em Textdraw.
#1

Entгo galera, estou precisando de um contador de kills e mortes em textdraw que salve nos scriptfiles tambйm, vou deixar as textdraw aqui para quem quiser ajudar.
Код:
Textdraw2 = CreatePlayerTextDraw(playerid,493.000000, 169.000000, "Matou: ~g~~h~999999");
PlayerTextDrawBackgroundColor(playerid,Textdraw2, 255);
PlayerTextDrawFont(playerid,Textdraw2, 2);
PlayerTextDrawLetterSize(playerid,Textdraw2, 0.270000, 1.400000);
PlayerTextDrawColor(playerid,Textdraw2, -1);
PlayerTextDrawSetOutline(playerid,Textdraw2, 1);
PlayerTextDrawSetProportional(playerid,Textdraw2, 1);
PlayerTextDrawSetSelectable(playerid,Textdraw2, 0);

Textdraw3 = CreatePlayerTextDraw(playerid,493.000000, 182.000000, "Morreu: ~r~~h~999999");
PlayerTextDrawBackgroundColor(playerid,Textdraw3, 255);
PlayerTextDrawFont(playerid,Textdraw3, 2);
PlayerTextDrawLetterSize(playerid,Textdraw3, 0.270000, 1.400000);
PlayerTextDrawColor(playerid,Textdraw3, -1);
PlayerTextDrawSetOutline(playerid,Textdraw3, 1);
PlayerTextDrawSetProportional(playerid,Textdraw3, 1);
PlayerTextDrawSetSelectable(playerid,Textdraw3, 0);
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=370638
Reply
#3

Eu fui no Search antes e encontrei isso, porйm isso й uma sequencia de kills, tipo "Double Kill" nгo um contador, Obrigado por tenta ajudar.
Reply
#4

Nгo cheguei a testar, mas consegui compilar e jб tive minhas experiкncias com TextDraw

Код:
new contas[48];
new pkill[MAX_PLAYERS];
new pdeath[MAX_PLAYERS];
new PlayerText:TDKill[MAX_PLAYERS], PlayerText:TDDeath[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(playerid));
	if(DOF2_FileExists(contas))
	{
	    pkill[playerid] = DOF2_GetInt(contas, "Matou");
	    pdeath[playerid] = DOF2_GetInt(contas, "Morreu");
	}
	else
	{
	    pkill[playerid] = 0;
	    pdeath[playerid] = 0;
	}
	TDKill[playerid] = CreatePlayerTextDraw(playerid,493.000000, 169.000000, "Matou: ~g~~h~999999");
	PlayerTextDrawBackgroundColor(playerid,TDKill[playerid], 255);
	PlayerTextDrawFont(playerid,TDKill[playerid], 2);
	PlayerTextDrawLetterSize(playerid,TDKill[playerid], 0.270000, 1.400000);
	PlayerTextDrawColor(playerid,TDKill[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDKill[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDKill[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDKill[playerid], 0);

	TDDeath[playerid] = CreatePlayerTextDraw(playerid,493.000000, 182.000000, "Morreu: ~r~~h~999999");
	PlayerTextDrawBackgroundColor(playerid,TDDeath[playerid], 255);
	PlayerTextDrawFont(playerid,TDDeath[playerid], 2);
	PlayerTextDrawLetterSize(playerid,TDDeath[playerid], 0.270000, 1.400000);
	PlayerTextDrawColor(playerid,TDDeath[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDDeath[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDDeath[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDDeath[playerid], 0);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	format(contas, sizeof(contas),"Contas/%s.ini", PlayerName(playerid));
	DOF2_SetInt(contas, "Matou", pkill[playerid]);
	DOF2_SetInt(contas, "Morreu", pdeath[playerid]);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new kills[24], deaths[24];
	pkill[killerid] ++;
	pdeath[playerid] ++;
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(killerid));
	DOF2_SetInt(contas, "Matou", pkill[killerid]);
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(playerid));
	DOF2_SetInt(contas, "Morreu", pdeath[playerid]);
	format(kills, sizeof(kills), "Matou: ~g~~h~%d", pkill[killerid]);
	PlayerTextDrawSetString(killerid, TDKill[killerid], kills);
	format(deaths, sizeof(deaths), "Morreu: ~r~~h~%d", pdeath[playerid]);
	PlayerTextDrawSetString(playerid, TDDeath[playerid], deaths);
	SetTextPlayer(killerid);
	return 1;
}

public OnPlayerSpawn(vehicleid)
{
	SetTextPlayer(playerid);
	return 1;
}

stock PlayerName(playerid)
{
	new nome[MAX_PLAYER_NAME +1];
	GetPlayerName(playerid, nome, sizeof(nome));
	return nome;
}
stock SetTextPlayer(playerid)
{
	PlayerTextDrawShow(playerid, TDKill[playerid]);
	PlayerTextDrawShow(playerid, TDDeath[playerid]);
	return 1;
}
Qualquer coisa... Me manda uma MP
Espero que tenha ajudado ^^
Reply
#5

Quote:
Originally Posted by MrEdu
Посмотреть сообщение
Nгo cheguei a testar, mas consegui compilar e jб tive minhas experiкncias com TextDraw

Код:
new contas[48];
new pkill[MAX_PLAYERS];
new pdeath[MAX_PLAYERS];
new PlayerText:TDKill[MAX_PLAYERS], PlayerText:TDDeath[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(playerid));
	if(DOF2_FileExists(contas))
	{
	    pkill[playerid] = DOF2_GetInt(contas, "Matou");
	    pdeath[playerid] = DOF2_GetInt(contas, "Morreu");
	}
	else
	{
	    pkill[playerid] = 0;
	    pdeath[playerid] = 0;
	}
	TDKill[playerid] = CreatePlayerTextDraw(playerid,493.000000, 169.000000, "Matou: ~g~~h~999999");
	PlayerTextDrawBackgroundColor(playerid,TDKill[playerid], 255);
	PlayerTextDrawFont(playerid,TDKill[playerid], 2);
	PlayerTextDrawLetterSize(playerid,TDKill[playerid], 0.270000, 1.400000);
	PlayerTextDrawColor(playerid,TDKill[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDKill[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDKill[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDKill[playerid], 0);

	TDDeath[playerid] = CreatePlayerTextDraw(playerid,493.000000, 182.000000, "Morreu: ~r~~h~999999");
	PlayerTextDrawBackgroundColor(playerid,TDDeath[playerid], 255);
	PlayerTextDrawFont(playerid,TDDeath[playerid], 2);
	PlayerTextDrawLetterSize(playerid,TDDeath[playerid], 0.270000, 1.400000);
	PlayerTextDrawColor(playerid,TDDeath[playerid], -1);
	PlayerTextDrawSetOutline(playerid,TDDeath[playerid], 1);
	PlayerTextDrawSetProportional(playerid,TDDeath[playerid], 1);
	PlayerTextDrawSetSelectable(playerid,TDDeath[playerid], 0);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	format(contas, sizeof(contas),"Contas/%s.ini", PlayerName(playerid));
	DOF2_SetInt(contas, "Matou", pkill[playerid]);
	DOF2_SetInt(contas, "Morreu", pdeath[playerid]);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new kills[24], deaths[24];
	pkill[killerid] ++;
	pdeath[playerid] ++;
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(killerid));
	DOF2_SetInt(contas, "Matou", pkill[killerid]);
	format(contas, sizeof(contas), "Contas/%s.ini", PlayerName(playerid));
	DOF2_SetInt(contas, "Morreu", pdeath[playerid]);
	format(kills, sizeof(kills), "Matou: ~g~~h~%d", pkill[killerid]);
	PlayerTextDrawSetString(killerid, TDKill[killerid], kills);
	format(deaths, sizeof(deaths), "Morreu: ~r~~h~%d", pdeath[playerid]);
	PlayerTextDrawSetString(playerid, TDDeath[playerid], deaths);
	SetTextPlayer(killerid);
	return 1;
}

public OnPlayerSpawn(vehicleid)
{
	SetTextPlayer(playerid);
	return 1;
}

stock PlayerName(playerid)
{
	new nome[MAX_PLAYER_NAME +1];
	GetPlayerName(playerid, nome, sizeof(nome));
	return nome;
}
stock SetTextPlayer(playerid)
{
	PlayerTextDrawShow(playerid, TDKill[playerid]);
	PlayerTextDrawShow(playerid, TDDeath[playerid]);
	return 1;
}
Qualquer coisa... Me manda uma MP
Espero que tenha ajudado ^^
Veja a data do tуpico antes de postar.

E esse codigo tem como melhorar muito
Reply
#6

Eu sei, mas como disse... Sу quis ajudar
Obrigado a percepзгo
Reply
#7

Man, revivendo top mds..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)