SA-MP Forums Archive
TEXTDRAW SHOW KILLS AND DEATHS HELP - 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: TEXTDRAW SHOW KILLS AND DEATHS HELP (/showthread.php?tid=168814)



TEXTDRAW SHOW KILLS AND DEATHS HELP - vakhtang - 17.08.2010

Hey guys I wanna make gamemode where on playerconnect textdraw shows but with amount of deaths and kills here is what I did :
Код:
public OnGameModeInit()
{
////////////////////////////////STATISTICS//////////////////////////////////////
	new kills;
	
	kills = PlayerInfo[playerid][Kills];
	
	Textdraw1 = TextDrawCreate(496.000000, 129.000000, "Deaths:");
	TextDrawBackgroundColor(Textdraw1, 255);
	TextDrawFont(Textdraw1, 1);
	TextDrawLetterSize(Textdraw1, 0.430000, 1.400000);
	TextDrawColor(Textdraw1, -1);
	TextDrawSetOutline(Textdraw1, 1);
	TextDrawSetProportional(Textdraw1, 1);

	Textdraw2 = TextDrawCreate(496.000000, 117.000000, "Kills:");
	TextDrawBackgroundColor(Textdraw2, 255);
	TextDrawFont(Textdraw2, 1);
	TextDrawLetterSize(Textdraw2, 0.509999, 1.400000);
	TextDrawColor(Textdraw2, -1);
	TextDrawSetOutline(Textdraw2, 1);
	TextDrawSetProportional(Textdraw2, 1);

	Textdraw3 = TextDrawCreate(557.000000, 118.000000, "10000");//DEATHS
	TextDrawBackgroundColor(Textdraw3, 255);
	TextDrawFont(Textdraw3, 3);
	TextDrawLetterSize(Textdraw3, 0.509999, 1.100000);
	TextDrawColor(Textdraw3, -1);
	TextDrawSetOutline(Textdraw3, 1);
	TextDrawSetProportional(Textdraw3, 1);

	Textdraw4 = TextDrawCreate(557.000000, 131.000000, "10000");//KILLS
	TextDrawBackgroundColor(Textdraw4, 255);
	TextDrawFont(Textdraw4, 3);
	TextDrawLetterSize(Textdraw4, 0.509999, 1.100000);
	TextDrawColor(Textdraw4, -1);
	TextDrawSetOutline(Textdraw4, 1);
	TextDrawSetProportional(Textdraw4, 1);
////////////////////////////////////////////////////////////////////////////////
Is this right?


Re: TEXTDRAW SHOW KILLS AND DEATHS HELP - ikey07 - 17.08.2010

OnGameModeInit ??

kills = PlayerInfo[playerid][Kills];


Re: TEXTDRAW SHOW KILLS AND DEATHS HELP - vakhtang - 17.08.2010

yes Is is wrong?


Re: TEXTDRAW SHOW KILLS AND DEATHS HELP - Retardedwolf - 17.08.2010

No its not right vakhtang.

You do
pawn Код:
new kills = PlayerInfo[playerid][Kills];
when you want to use the function like during OnPlayerDeath.


Re: TEXTDRAW SHOW KILLS AND DEATHS HELP - vakhtang - 17.08.2010

How should it work? help me


Re: TEXTDRAW SHOW KILLS AND DEATHS HELP - Claude - 17.08.2010

pawn Код:
public OnPlayerDeath(playerid, killerid, reason
{
    SetPVarInt(playerid, "Deaths", GetPVarInt(playerid, "Deaths")+1);
    SetPVarInt(killerid, "Kills", GetPVarInt(killerid, "Kills")+1);
   
    new strdbe[20];
    format(strdbe, 20, "Kills: %d", GetPVarInt(killerid, "Kills"));
   
    TextDrawDestroy(Textdraw4); // destroys the current textdraw, can cause lagg if it doesn't get refreshed
   
    TextDrawSetString(strdbe, Textdraw4);
    TextDrawShowForPlayer(playerid, Textdraw4); // shows the new stats but this time with the new amount of kills
   
    format(strdbe, 20, "Deaths: %d", GetPVarInt(playerid, "Deaths"));
   
    TextDrawDestroy(Textdraw3); // destroys the current textdraw, can cause lagg if it doesn't get refreshed
   
    TextDrawSetString(strdbe, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw3); // shows the new stats but this time with the new amount of deaths
    return 1;
}
Try that