Disable Scoring?

Posts 1–8 of 8 · Page 1 of 1
Disable Scoring?
Hello,
im totally new to mw2 scripting, so sorry for newbish questions .
I want to know if there is a way to disable scoring for a specific weapon.
For example, if someone knifes a player, i want him to get no score points for that.
Or as a workaround, is there a way to determine who killed who with what weapon (something that needs to be called on every kill -> also how do i do that ^^ ?). Then i could just substract the added scorepoints when somebody knifes.
Or as another idea, can i set the damage of a melee attack to zero somehow?
I know i can do "self setClientDvar(player_meleerange,0)", but that affects everyone. I want someone not to be able to knife in certain circumstances (eg when he has a score > x). When using player_meleerange the effect works on everyone as long as the condition is valid for the host (me), so no one can knife when my score is > x, and everyone can knife (those who are not supposed to be able to, too) when my score is <= x.

Anyone got any ideas for that?

THX a lot and greetz
Here you go! Edit the 100 value as you wish:

EDIT - self AllowMelee is only for SP
Code:
checkStatus()
{
    for(;;)
    {
        self.score = self.pers["score"];
  
        if(self isHost() && self.score > 100) //If you are the host and your score is higher than 100
        {
            setDvar("player_meleerange", 0); //Melee is disabled for everyone
        }

        if(self isHost() && self.score < 100) //If you are the host and your score is lower than 100
        {
            setDvar("player_meleerange", 64); //Melee is enabled for everyone
        }
        
        wait 0.1;
        
    }
}

noKnifing()
{
    for(;;)
    {
        self.score = self.pers["score"]; //Get's the score
        if(self.score > 100) //If your score is higher than 100
        {
            self setClientDvar("player_meleerange", 0);
        }
        wait 0.1;
    }
}
aah....too bad, but thanks for the fast reply anyways
yay, I got it!
Make sure to add:
self thread checkStatus();
self thread noKnifing();

on the onPlayerSpawned part.
wow, thanks a lot! Pretty fast

Three questions though (just for me to learn it):
1. What does the CheckStatus() do (in context with the noKnifing() )
2. In what file can i finde the noKnifing method, so i can take a closer look
3. How can i check with which weapon someone was killed ?


Again thanks for the (very fast) help

greetz
err, they're just some random threads I made up. The 2 threads could be put together into one but I couldn't be stuffed? lol. Here it is if you just want it as one thread:

Code:
checkStatus()
{
    for(;;)
    {
        self.score = self.pers["score"];
  
        if(self isHost() && self.score > 100) //If you are the host and your score is higher than 100
        {
            setDvar("player_meleerange", 0); //Melee is disabled for everyone
        }

        if(self isHost() && self.score < 100) //If you are the host and your score is lower than 100
        {
            setDvar("player_meleerange", 64); //Melee is enabled for everyone
        }
        
        if(self.score > 100) //If your score is higher than 100
        {
            self setClientDvar("player_meleerange", 0);
        }
        wait 0.1;
        
    }
}
As for the noKnifing method thing, I just googled some key boards such as self.score and used random parts of code.

To find out which weapon you were killed with... I don't know but in _damage.gsc if you look at this:
Code:
	if ( (sMeansOfDeath == "MOD_MELEE") )
	{
		
		if ( IsSubStr( sWeapon, "riotshield" ) )
		{
			attacker incPlayerStat( "shieldkills", 1 );
			
			if ( !matchMakingGame() )
				victim incPlayerStat( "shielddeaths", 1 );
		}
		else
			attacker incPlayerStat( "knifekills", 1 );
	}
Basically, that's means that if your means of death was by melee (or simply if you were knifed), it increases the attacker's riot kills if he/she had a riot or increases his/her knife kills he/she didn't have a shield. Now there, you could add some extra stuff you mod could do if you were killed by a knife. I've tried 'decreasing' the score but failed miserably. Maybe if I can find the friendly fire script that decreases your score, I might be able to help.
ah, didnt realise you edited your first reply, so i thought noknifing was an existing method.
Anyways, unfortunately the player_meleerange thing doesnt help me (im using it already), since it enables/disables knifing for everyone if the host meets the conditions (althoug its setClientDvar).


EDIT: thx for the help so far, ill read myself through the damage.gsc (playerkilledinternal and playerkilled
methods).
EDIT2: w00t u can change everything...nice! ;D no more weapon dropping
/Marked as Solved
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us