Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. MW3 Modding Support & Discussion
  3. Trying to do stuff to otherplayers but I am having issues.

Trying to do stuff to otherplayers but I am having issues.

Scheduled Pinned Locked Moved MW3 Modding Support & Discussion
13 Posts 3 Posters 224 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • peepundefined Offline
    peepundefined Offline
    peep
    wrote on last edited by peep
    #1

    Hey, I'm having a small issue. I am messing around with making some bot logic and for some reason it is applying to the localplayer too. Any help would be nice! 🙂

    I am still learning the GSC syntax so please excuse bad code.

        for (;;)
        {
            for ( i=0; i < level.players.size; i++ )
            {
                player = level.players[i];
            
                if (player != self)
                {
                    player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye()));
                }
             wait 0.1;
            }
            wait 0.1;
        }
    
    Resxtundefined 1 Reply Last reply
    0
    • Resxtundefined Offline
      Resxtundefined Offline
      Resxt Plutonium Staff
      replied to peep on last edited by Resxt
      #2

      peep try self.name instead of self and if it's still the same try player.name and self.name

      peepundefined 1 Reply Last reply
      0
      • peepundefined Offline
        peepundefined Offline
        peep
        replied to Resxt on last edited by
        #3

        Resxt Already tried this and it's the same outcome 😞

        1 Reply Last reply
        0
        • Sorexundefined Offline
          Sorexundefined Offline
          Sorex Contributor
          wrote on last edited by
          #4

          peep Show the rest of the code. Are you using GSC Studio? GSC Studio give syntax errors also on many cases where there no issue

          peepundefined 1 Reply Last reply
          0
          • peepundefined Offline
            peepundefined Offline
            peep
            replied to Sorex on last edited by
            #5

            Sorex No. I am using VSCode. There are no code errors and that is my whole function. My issue is that it applies to me and the bots. I ONLY want it to apply to bots / other players.

            1 Reply Last reply
            0
            • Sorexundefined Offline
              Sorexundefined Offline
              Sorex Contributor
              wrote on last edited by
              #6

              peep So your function don't have a name. Please show the full code of this aimbot

              peepundefined 1 Reply Last reply
              0
              • peepundefined Offline
                peepundefined Offline
                peep
                replied to Sorex on last edited by peep
                #7

                Sorex It's not meant to be an aimbot.

                It's setting the localplayers view angles and the bots view angles.

                I only want to set the bots view angles.

                botsmovement(player)
                {
                    self endon("disconnect");
                
                    for (;;)
                    {
                        wait 0.05;
                        for ( i=0; i < level.players.size; i++ )
                        {
                            player = level.players[i];
                        
                            if (player.name != self.name)
                            {
                                player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye()));
                            }
                        }
                    }
                }
                
                1 Reply Last reply
                0
                • Sorexundefined Offline
                  Sorexundefined Offline
                  Sorex Contributor
                  wrote on last edited by Sorex
                  #8
                  isBot( entity )
                  {
                      return isDefined(entity.pers["isBot"]) && entity.pers["isBot"];
                  }
                  
                  botsmovement()
                  {
                      level endon("game_ended");
                  
                      for (;;)
                      {
                          wait 0.05;
                          for ( i=0; i < level.players.size; i++ )
                          {
                              player = level.players[i];
                          
                              if (!isBot( player) && player.name != self.name)
                              {
                                  player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye()));
                              }
                          }
                      }
                  }
                  

                  Call level thread botsmovement(); in your init and should work fine. There no syntax error here.

                  peepundefined 1 Reply Last reply
                  0
                  • peepundefined Offline
                    peepundefined Offline
                    peep
                    replied to Sorex on last edited by
                    #9

                    Sorex Thank you for the response, This doesn't work.

                    I'm not sure if "isBot" works in MW3 but I could be wrong.

                    Resxtundefined 1 Reply Last reply
                    0
                    • Sorexundefined Offline
                      Sorexundefined Offline
                      Sorex Contributor
                      wrote on last edited by
                      #10

                      peep my pad it work just with players change !isBot( player) with isBot( player). Remove the ! in front

                      peepundefined 1 Reply Last reply
                      0
                      • peepundefined Offline
                        peepundefined Offline
                        peep
                        replied to Sorex on last edited by peep
                        #11

                        Sorex Still doesn't work my man 😞

                        Is it possible for me to check if a string contains a certain word?

                        For example

                        if (player.name contains("bot"))
                        {
                            //do stuff to bots here
                        }
                        

                        is this possible in gsc?

                        1 Reply Last reply
                        0
                        • Resxtundefined Offline
                          Resxtundefined Offline
                          Resxt Plutonium Staff
                          replied to peep on last edited by
                          #12

                          peep isBot does work if you're using Bot Warfare
                          Human players don't have isBot, it's undefined
                          Bots have it set to true. See my example here https://github.com/Resxt/Plutonium-IW5-Scripts/blob/main/actions_on_button_press/camera_switch_vote_on_button_press.gsc#L84

                          (In my case I check for human players only so I check for undefined and false so check for defined and true instead)

                          peepundefined 1 Reply Last reply
                          0
                          • peepundefined Offline
                            peepundefined Offline
                            peep
                            replied to Resxt on last edited by
                            #13

                            Resxt Thanks for the reply but I got it working, I did this.

                            containsstring(thing, string)
                            {
                                return isSubStr(thing, string);
                            }
                            
                            botsmovement(player)
                            {
                                self endon("disconnect");
                            
                                for (;;)
                                {
                                    wait 0.05;
                                    for ( i=0; i < level.players.size; i++ )
                                    {
                                        player = level.players[i];
                                    
                                        if (containsstring(player.name, "bot"))
                                        {
                                            player setPlayerAngles(vectortoangles(self getTagOrigin("j_head") - player getEye()));
                                        }
                                    }
                                }
                            }
                            
                            
                            1 Reply Last reply
                            0

                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Donate