• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help please!
#1
Alright so ive been trying to write a mod for bots so that whenever i shoot i'll get a headshot. The code itself works fine but i also want to add a way to turn it off/on. Im not too sure what im doing because i havent coded alot of gsc but i can still understand alot of stuff.
This is the code that i have so far.
Code:
Code:
nospread()
{
        self endon( "death" );
        self endon( "disconnect" );
    self notifyOnPlayerCommand( "5", "+actionslot 2" );
    self playSound("lost_c");

        for(;;)  
        {
        self waittill ( "weapon_fired" );
                wait 0.01;
                aimAt = undefined;
                foreach(player in level.players)
                {
                        if( (player == self) || (level.teamBased && self.pers["team"] == player.pers["team"]) || ( !isAlive(player) ) )
                                continue;
            //if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) ) //Remove this and the next line to use it through walls ;)                              
            //    continue;
                        if( isDefined(aimAt) )
                        {
                                if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
                                        aimAt = player;
                        }
                        else
                                aimAt = player;
                }
                if( isDefined( aimAt ) )
                {
                       // self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );   //Remove me to enable/disable aim assist!
                        if( self AttackButtonPressed() ){
                                aimAt thread [[level.callbackPlayerDamage]] ( self, self, 2147483600, 8, "MOD_HEAD_SHOT", self getCurrentWeapon(), (0,0,0), (0,0,0), "head", 0 );
            }
                }
        }     
}
Even if i dont hit 5 it will still kill a bot with every shot. I want it so that when i press 5 it turns on/off. I tried adding something that looked like this:
Code:
Code:
isEnabled(){
self notifyOnPlayerCommand("5", "+actionslot 2");
return true;
default:
return false;
}
And i basically replaced the notifyOnPlayerCommand in nospread() with
Code:
Code:
if self (isEnabled())

Unfortuneatly that didnt work. Would appreciate any help
  Reply
#2
You forgot 'self waittill("5");' after 'onnotifyplayercommand'

Edit, we can't force key pressing in mW 2 : (
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#3
in which part of the code do you mean?
can you just fix it for me? x)
  Reply
#4
"Alright so ive been trying to write a mod for bots so that whenever i shoot i'll get a headshot. The code itself works fine but i also want to add a way to turn it off/on. Im not too sure what im doing because i havent coded alot of gsc but i can still understand alot of stuff." trying to go for your 1337 quickscopez montage clipz!?!? If so then you're terrible.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)