SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/10/2009, 04:52 PM   #1
Striker_Moe
Gangsta
 
Join Date: Apr 2009
Posts: 569
Reputation: 1
Default [HELP] Need help - kill/death textdraw

Hey ther.

I need help creating a simple kill/death textdraw.

Ive added that yet:

Code:
//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?
Striker_Moe is offline  
Old 20/10/2009, 04:54 PM   #2
Streetplaya
Gangsta
 
Join Date: Nov 2007
Posts: 603
Reputation: 1
Default Re: [HELP] Need help - kill/death textdraw

Code:
SetTimer("CheckLoggedInAs", 1500, true);
Code:
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];"
Streetplaya is offline  
Old 20/10/2009, 05:06 PM   #3
Striker_Moe
Gangsta
 
Join Date: Apr 2009
Posts: 569
Reputation: 1
Default Re: [HELP] Need help - kill/death textdraw

Could someone please show me how to do that? Im too dumb, getting shitloads of errors D:
Striker_Moe is offline  
Old 20/10/2009, 05:34 PM   #4
Striker_Moe
Gangsta
 
Join Date: Apr 2009
Posts: 569
Reputation: 1
Default Re: [HELP] Need help - kill/death textdraw

Anyone? It kinda hurrys, I had to temporarily close my server because of it.
Striker_Moe is offline  
Old 01/01/2010, 10:56 PM   #5
juanrivas
Little Clucker
 
Join Date: Aug 2009
Posts: 35
Reputation: 11
Default Re: [HELP] Need help - kill/death textdraw

http://xtremegta.pastebin.com/f53a43f99
juanrivas is offline  
Old 01/01/2010, 11:21 PM   #6
MerLow
Big Clucker
 
Join Date: Jul 2008
Posts: 64
Reputation: 0
Default Re: [HELP] Need help - kill/death textdraw

Code:
//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;
}
MerLow is offline  
Old 01/01/2010, 11:33 PM   #7
John Rockie
Huge Clucker
 
Join Date: Dec 2009
Posts: 319
Reputation: 20
Default Re: [HELP] Need help - kill/death textdraw

Change This
Code:
format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
To
Code:
format(string, sizeof(string), "~g~Kills~b~%d~w~ - ~r~Deaths ~b~%d" , kill[playerid], Death[playerid]);
Simple Mistake there
John Rockie is offline  
Old 01/01/2010, 11:41 PM   #8
dice7
High-roller
 
Join Date: Apr 2009
Location: Slovenia
Posts: 2,200
Reputation: 22
Default Re: [HELP] Need help - kill/death textdraw

http://wiki.sa-mp.com/wiki/SetTimerEx
dice7 is offline  
Old 01/01/2010, 11:44 PM   #9
MerLow
Big Clucker
 
Join Date: Jul 2008
Posts: 64
Reputation: 0
Default Re: [HELP] Need help - kill/death textdraw

Quote:
Originally Posted by John Rockie
Change This
Code:
format(string, sizeof(string), "~r~Deaths ~b~%d~w~ - ~g~Kills ~b~%d" , kill[playerid], Death[playerid]);
To
Code:
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:

Code:
//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;
}
MerLow is offline  
Old 01/01/2010, 11:47 PM   #10
John Rockie
Huge Clucker
 
Join Date: Dec 2009
Posts: 319
Reputation: 20
Default Re: [HELP] Need help - kill/death textdraw

There You Go
John Rockie is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill/Death Ratio and amount stats cozza123456 Help Archive 1 30/03/2010 08:12 AM
[Include] [INC]KIll Death Admin - ReVo_ ReVo_ Includes 6 02/01/2010 06:02 PM
Death/kill textdraw help. Striker_Moe Help Archive 6 18/12/2009 01:33 PM
Need some help with this formula to calculate kill death ratio Celson Help Archive 5 18/03/2009 12:35 PM


All times are GMT. The time now is 12:09 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.