Round stats text getting over-layed.
#1

o/ guys,

So I am working onn this script and it's based on rounds where you kill anyone you can (DM).
I've been trying to get this to work properly but it seems like it's not willing to cooperate with me.
Here's the code bit:
(btw I don't get any errors when compilaing/running.)
Код:
public OnPlayerDeath(playerid, killerid, reason)
{

	    if(killerid == playerid)
	{
	    new message[256];
		GetPlayerName(playerid, playername, sizeof(playername));
	    SendDeathMessage(killerid, playerid, reason);
	    format(message, sizeof(message), ">> %s has killed himself.", playername);
	    SendClientMessageToAll(SYSTEM_COLOR, message);
	}
		
    	if(killerid != INVALID_PLAYER_ID || killerid != playerid)
	{
		new rand = random(sizeof(SoundOnDeath)), Float:Xp, Float:Yp, Float:Zp, Float:Xk, Float:Yk, Float:Zk;
		GetPlayerPos(playerid, Xp, Yp, Zp);
		GetPlayerPos(killerid, Xk, Yk, Zk);
        PlayerPlaySound(killerid, SoundOnDeath[rand][0],Xk,Yk,Zk);
		SendDeathMessage(killerid, playerid, reason);
		SetPVarInt(playerid, "PKills", PlayerInfo[killerid][pKills]++);
        SetPVarInt(playerid, "PDeaths", PlayerInfo[playerid][pDeaths]++);
        roundstats[playerid][rKills]++;
        roundstats[playerid][rDeaths]++;
   	 	SetPlayerHealth(killerid, 100);
		SetPlayerArmour(killerid, 100);
	}
    
    
	return 1;
}
Код:
enum rInfo
{
	rKills,
	rDeaths
}
new roundstats[MAX_PLAYERS][rInfo];

stock GetHighestKiller() // TOP KILLER.
{
	new kills;
	new player = -1;
	
	for (new i=0, mx = GetMaxPlayers(); i!=mx; ++i)
	{
	    if(IsPlayerConnected(i))
	        {
	            if (roundstats[i][rKills] > kills)
	                {
	                    player = i;
	                    kills = roundstats[i][rKills];
					}
			}
	}
	return player;
}
Код:
public OnPlayerSpawn(playerid)
{
	new Text:messagetextdraw;
	new topkillermessage[256];
	messagetextdraw = TextDrawCreate(1.0, 5.6, "");
	new highestkillerid = GetHighestKiller();
	GetPlayerName(highestkillerid, playername, sizeof(playername));
	format(topkillermessage, sizeof(topkillermessage), "%s has the most amount of kills.", playername);
	TextDrawSetString(messagetextdraw,topkillermessage);
	TextDrawShowForPlayer(playerid, messagetextdraw);
}
The issue is once a new HighestKiller comes up, the new TEXTDRAW gets layed over the old one and you can't read much. and I tried using TextDrawDestroy but I can't do it.

I was wondering if there is a way to detect when highestkillerid changes in order to destroy the old textdraw and create the new textdraw.

If anyone could help me that'd be great!

Thank you =)
Reply


Messages In This Thread
Round stats text getting over-layed. - by Lofti - 23.07.2015, 21:32
AW: Round stats text getting over-layed. - by Nero_3D - 23.07.2015, 22:56
Re: AW: Round stats text getting over-layed. - by Lofti - 24.07.2015, 02:14
AW: Round stats text getting over-layed. - by Nero_3D - 24.07.2015, 11:24
Re: AW: Round stats text getting over-layed. - by Lofti - 24.07.2015, 23:37
AW: Round stats text getting over-layed. - by Nero_3D - 25.07.2015, 00:53
Re: AW: Round stats text getting over-layed. - by Lofti - 25.07.2015, 01:26
AW: Re: AW: Round stats text getting over-layed. - by Nero_3D - 25.07.2015, 10:13
Re: AW: Re: AW: Round stats text getting over-layed. - by Lofti - 26.07.2015, 23:24

Forum Jump:


Users browsing this thread: 1 Guest(s)