Results 1 to 5 of 5
  1. #1
    ineedbots's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    14

    Player hasAttachment?

    is it possible to have an command that return false or true when a player has an attachment? say

    Code:
    if(player IsFiring == 1 && not player hasAttachment("silencer")) {
    reactiontime/0.2;}
    if anyone is wondering, I am planning on making my own bot mod.. player is the player the bot encountered and self is the bot itself.

  2. #2
    EpicPlayer's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    628
    Reputation
    13
    Thanks
    155
    That's easy to do, here's a function I made pretty quick:

    Code:
    hasAttachment(attachment)
    {
    	if(isSubStr(self getcurrentweapon(), attachment))
    	{
    	return true;
    	}
    	else {
    	return false;
    	}
    }
    Put it somewhere in your .GSC file.

    Here's an example of this function:
    Code:
    if(player IsFiring == 1 && !player hasAttachment("silencer")) {
    //Do stuff
    
    }
    Btw, I've no idea if it actually works, since I didn't test it, but it should do.
    Last edited by EpicPlayer; 02-25-2012 at 02:54 PM. Reason: Fixed a syntax error

  3. The Following User Says Thank You to EpicPlayer For This Useful Post:

    ineedbots (02-25-2012)

  4. #3
    ineedbots's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    14
    bad syntax error. /: i think it has to do with the hasAttachment(attachment) thread... tried everything to get rid of error.


    also, how can i get the closest player to x from y?

    x = variable of closest person
    y = from the bot

    so i can use

    if(self.hasUAV == 1 && !self.aimattt hasPerk("specialty_coldblooded")){
    waittime = 0+(waittime*0.2); }

    and what not..
    Last edited by ineedbots; 02-25-2012 at 08:13 PM.

  5. #4
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,309
    My Mood
    Breezy
    Code:
    hasAttachment(attachment)
    {
        return isSubStr(self getCurrentWeapon(), attachment);
    }
    
    getClosestPlayer()
    {
        closest = undefined;
        for(i = 0; i < level.players.size; i++)
        {
            if(closest == undefined || closer(self.origin, level.players[i].origin, closest.origin))
                closest = level.players[i];
        }
        return closest;
    }
    Something like that? As for checking if a player is firing, you'd probably have to do it using a hackish approach.

    Code:
    // Call this when the player spawns.
    monitorFiring()
    {
        self endon("death");
        self endon("disconnect");
    
        self.isFiring = false;
    
        for(;;)
        {
            self waittill("weapon_fired");
            self.isFiring = true;
            wait 0.5; // 0.5 second cooldown for the firing.
            self.isFiring = false;
        }
    }
    To check if a player is firing you'd use player.isFiring.
    Last edited by master131; 02-26-2012 at 12:21 AM.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  6. The Following User Says Thank You to master131 For This Useful Post:

    ineedbots (02-26-2012)

  7. #5
    ineedbots's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    14
    alright, how about getting the player's secondary? so i could use SwitchToOffhand("weapon");

Similar Threads

  1. Windows Media Player 10
    By 1h1a1i in forum Hardware & Software Support
    Replies: 32
    Last Post: 07-14-2006, 05:50 PM
  2. Watch Out, Warrock Players Are Spying
    By System79 in forum General
    Replies: 13
    Last Post: 07-11-2006, 01:14 AM
  3. Windows Media Player 11
    By stingray001 in forum General
    Replies: 9
    Last Post: 05-30-2006, 02:30 PM
  4. offline player
    By naughtynurse in forum Gunz General
    Replies: 2
    Last Post: 03-21-2006, 10:16 PM
  5. Can u use the gain experience hack with 1 player
    By mjt20mik in forum WarRock - International Hacks
    Replies: 7
    Last Post: 02-05-2006, 03:20 AM