[HELP] Need help - kill/death textdraw
#1

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?
Reply
#2

Код:
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];"
Reply
#3

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

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

http://xtremegta.pastebin.com/f53a43f99
Reply
#6

Код:
//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;
}
Reply
#7

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
Reply
#8

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#9

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;
}
Reply
#10

There You Go
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)