SA-MP Forums Archive
[HELP] Need help - kill/death textdraw - 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] Need help - kill/death textdraw (/showthread.php?tid=103612)



[HELP] Need help - kill/death textdraw - Striker_Moe - 20.10.2009

Hey ther.

I need help creating a simple kill/death textdraw.

Iґve added that yet:

Код:
//At the top
forward CheckLoggedInAs(playerid);
new Text:LoggedInAs;
new kill[MAX_PLAYERS];
new Death[MAX_PLAYERS];

//at OnGameModeInit
SetTimer("CheckLoggedInAs", 1500, true); //at OnGameModeInit
LoggedInAs = TextDrawCreate(497.000000,111.000000, "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d");
//+ some other crap for the textdraw. (Proportional etc.)

//Then here at OnPlayerDeath

CheckLoggedInAs();
kill[killerid]++;
Death[playerid]++;

//And as a public..

public CheckLoggedInAs(playerid)
{
	new string[128];

	format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
 	TextDrawSetString(Text:LoggedInAs, string);
	return 1;
}
Well the textdraw shows up as its supposed to, but the kills/deaths wont change from 0 to the number. - why?


Re: [HELP] Need help - kill/death textdraw - Streetplaya - 20.10.2009

Код:
SetTimer("CheckLoggedInAs", 1500, true);
Код:
forward CheckLoggedInAs(playerid);
You need to do a timer like CheckLoggedInAs(), so no playerid-argument, and loop through all players in that procedure...
Also, I think you will need a Textdraw for every player, so "new Text:LoggedInAs[MAX_PLAYERS];"


Re: [HELP] Need help - kill/death textdraw - Striker_Moe - 20.10.2009

Could someone please show me how to do that? Im too dumb, getting shitloads of errors D:


Re: [HELP] Need help - kill/death textdraw - Striker_Moe - 20.10.2009

Anyone? It kinda hurrys, I had to temporarily close my server because of it.


Re: [HELP] Need help - kill/death textdraw - juanrivas - 01.01.2010

http://xtremegta.pastebin.com/f53a43f99


Re: [HELP] Need help - kill/death textdraw - MerLow - 01.01.2010

Код:
//At the top
forward CheckLoggedInAs(playerid);
new Text:LoggedInAs[MAX_PLAYERS];
new kill[MAX_PLAYERS];
new Death[MAX_PLAYERS];

//at OnPlayerConnect
LoggedInAs[playerid] = TextDrawCreate(497.000000,111.000000, " ");
//+ some other crap for the textdraw. (Proportional etc.)
CheckLoggedInAs();


//at OnPlayerDisconnect
TextDrawDestroy(LoggedInAs[playerid]);

//at OnPlayerSpawn
TextDrawShowForPlayer(playerid,LoggedInAs[playerid]);

//Then here at OnPlayerDeath

kill[killerid]++;
Death[playerid]++;
CheckLoggedInAs();

//And as a public..

public CheckLoggedInAs(playerid)
{
	new string[128];
	format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
 	TextDrawSetString(Text:LoggedInAs[playerid], string);
	return 1;
}



Re: [HELP] Need help - kill/death textdraw - John Rockie - 01.01.2010

Change This
Код:
format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
To
Код:
format(string, sizeof(string), "~g~Kills~b~%d~w~ - ~r~Deaths ~b~%d" , kill[playerid], Death[playerid]);
Simple Mistake there


Re: [HELP] Need help - kill/death textdraw - dice7 - 01.01.2010

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: [HELP] Need help - kill/death textdraw - MerLow - 01.01.2010

Quote:
Originally Posted by John Rockie
Change This
Код:
format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
To
Код:
format(string, sizeof(string), "~g~Kills~b~%d~w~ - ~r~Deaths ~b~%d" , kill[playerid], Death[playerid]);
Simple Mistake there
Really, thanks for your attention.

The whole code again:

Код:
//At the top
new Text:LoggedInAs[MAX_PLAYERS];
new kill[MAX_PLAYERS];
new Death[MAX_PLAYERS];

//at OnPlayerConnect
LoggedInAs[playerid] = TextDrawCreate(497.000000,111.000000, " ");
//+ some other crap for the textdraw. (Proportional etc.)
CheckLoggedInAs(playerid);


//at OnPlayerDisconnect
TextDrawDestroy(LoggedInAs[playerid]);

//at OnPlayerSpawn
TextDrawShowForPlayer(playerid,LoggedInAs[playerid]);

//Then here at OnPlayerDeath

kill[killerid]++;
Death[playerid]++;
CheckLoggedInAs(playerid);

//And...

stock CheckLoggedInAs(playerid)
{
	new string[128];
	format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d", Death[playerid], kill[playerid]);
 	TextDrawSetString(Text:LoggedInAs[playerid], string);
	return 1;
}



Re: [HELP] Need help - kill/death textdraw - John Rockie - 01.01.2010

There You Go