Help in kill assist
#1

Hello guys. I want to make a kill assist system. I made a script but it lags a lot and I'm not very sure if that will work properly. I want to start it again from beginning. Some suggestions will be appreciated. Thanks
Reply
#2

The best would be to use OnPlayerGiveDamage and store who the player has damaged or OnPlayerTakeDamage to store who has damaged the player (and how much, depending on how your assist script will work).

Then when a player is killed, you check who has killed and damaged them.
Reply
#3

I have done that in my old script. I had to use a variable like this :

Tdamage[playerid][damgedid]

And that makes a lot of lag
Reply
#4

Any help?
Reply
#5

BUMP
Reply
#6

Stop bumping it without waiting 24-42 hours.

Without code we can't help, please post your code.
Reply
#7

I'm not asking to correct my code. I'm asking how to start off with such a script.

Well, this is the old script. But it lags a lot. I want it to be more efficient.

Код:
new assist[MAX_PLAYERS];
new Float:Tdamage[MAX_PLAYERS][MAX_PLAYERS];

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
	Tdamage[playerid][damagedid]=Tdamage[playerid][damagedid]+amount;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	for(new i;i<=MAX_PLAYERS;i++)
	{
		if(Tdamage[i][playerid]>=50.0)
		{
	    	assist[i]++;
	    	SendClientMessage(i,0x33AA33AA,"You gained an assist.");
	    	if(assist[i]==2)
	    	{
	        	//kills[playerid]++;
	        	SendClientMessage(i,0x33AA33AA,"You gained a kill for 2 assist's.");
	        	Tdamage[i][playerid]=0;
			}
		}
	}
	return 1;
}
Reply
#8

idea :
Player X is the killer , player Y is the Helper (assiste killing) and player Z is the killed
When the Player Z is shooted , make a variable on the shooter (Y&X)
when the Player Z is dead , you can remove the variable on Y (the killer) and give him score/money or whatever and at the same time detect all the Y player (players who still have the varible) and use an other function on all those players,
example that will detect all the players that still have the variable when Z is dead
Код:
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if( Var[ playerid ] >= 1 ){
			//your function + don't forget to remove the Variable
		}
this is just a soft example , it should be much more longer
Reply
#9

Thank you Amine_Mejrhirrou. Can you explain a bit more? I didn't really get most of the thing.
Reply
#10

sorry for my english Virus
i'm gonna try to explain my idea
the thing is to put a Variable on the player who "hit" the target (i will keep the Example with player X,Y and Z )
you will OnPlayerTakeDamage to mark the player who Hit the targer with a variable (player Y)
exmple :
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    //we gonna say that the variable name is Var[ MAX_PLAYERS ] ( but this codes are just a small exmple they are not complete)
    Var[issuerid] = 1;
    return 1;
}
then you will use OnPlayerDeath , to use a funtion on the player who killed the target
when the player die , you will check who killed him and cancel the variable on the killer ( because the killer won't need to get the same thing as the assistant ) and after you cancel the variable of the killer, you will check , all the players who hit the Target before the Target died.
exmple :
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//set the variable of the killer to 0 
        Var[killerid] = 0;
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (Var[i] >= 1)
		{
			SendClientMessage(i, COLOR, "you have helped to kill an enemy");//just put the things you wanna add to the assistant there
		}
	}

}
The codes wont work because you will need to work much more on them , but i'm just giving an idea to make you know how you can proceed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)