Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Exchange weapons

  1. #1
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts

    Exchange weapons

    Hello Guys!
    I need a V menu with exchange weapons!
    Its how like.. You Press V 9 1 and you must aim on a player to exchange the weapons.
    The guy, who was aimed, he must press K to accept exchangeweapons.
    The Guy press K and the weapons will exchange :>
    I hope you will help me

  2. #2
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    @Loveboy help of course but I think no one will give you full code...

    Tip: Try to use IsLookingAt() function. (or geteye() function. I don't know which is better in this case so I ask someone with experience btw )

    Here is a great collection of useful functions/scripts - http://www.zeroy.com/script/

  3. #3
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    where is IsLookingAt() or geteye() function?

  4. #4
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    I will show you based on this code:

    Code:
    if(self.name == Loveboy)      //<- for example if player got name "Loveboy" then continue
    {
           players = getentarray("player", "classname");
           aimedplayer = undefined;              //undefined yet
           for(i = 0; i < players.size; i++)
           {
                  if(self islookingat (players[i]) )   //here is used IsLookingAt function... so if player is looking at the target(on other player) then continue also...
                  {
                          aimedplayer = players[i];
                          players[i] iprintlnBold("something!")      //this text is visible only for aimed player...
                  }
           }
    }
    I hope you understand now, if you have questions write.
    Last edited by Jeplaa; 28th December 2012 at 16:08.

  5. The Following User Says Thank You to Jeplaa For This Useful Post:

    kung foo man (28th December 2012)

  6. #5
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    Ok, players[i] iprintlnBold("Press K to exchange weapons...") now if the player press k, he will accept and the weapons will exchange.

  7. #6
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    so now we need the continue the script..

  8. #7
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Now you can add a loop on aimedPlayer, which is checking useButtonPressed() for like 5 seconds.
    timescale 0.01

  9. The Following User Says Thank You to kung foo man For This Useful Post:

    Jeplaa (29th December 2012)

  10. #8
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    kung, sorry i am not good in english and i am bad in script. pls explain me not just write a script pls

  11. #9
    Private
    Join Date
    Jul 2012
    Posts
    76
    Thanks
    9
    Thanked 56 Times in 38 Posts
    Hope I'm able to explain what Kungy means in a newbie way.
    You need to add a loop: while() or for(;;)
    a loop is something that does the same thing over and over again
    example:
    seconds = 0;
    while(seconds < 5)
    {
    wait 1;
    seconds += 1;
    }
    This loop counts the seconds and after 5 seconds the loop stops.
    In such a loop you can check, whether the aimedplayer pressed the useButton(that standardly is the 'F' Button)
    if(aimedPlayer useButtonPressed()) //if aimedPlayer pressed the useButton(F-Button) the function exchangeWeapons is called.
    player exchangeWeapons(aimedPlayer);
    you could write a thread exchangeWeapons(player){} where 'self' and 'player' exchange the weapons in.

    This is just an example and I'm pretty sure this won't work the way you want it to work. I just wanted to explain the loop and stuff to you, at least as best as I can.
    Hope this could help you a little, even though I'm not that good at explaining, I'm aware of that.

  12. The Following User Says Thank You to Peterlankton For This Useful Post:

    kung foo man (29th December 2012)

  13. #10
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    so could work this?

    players = getentarray("player", "classname");
    aimedplayer = undefined; //undefined yet
    for(i = 0; i < players.size; i++)
    {
    if(self islookingat (players[i]) ) //here is used IsLookingAt function... so if player is looking at the target(on other player) then continue also...
    {
    aimedplayer = players[i];
    players[i] iprintlnBold("Press F to exchange weapons with "players.name" ") //this text is visible only for aimed player...
    if(aimedPlayer useButtonPressed()) //if aimedPlayer pressed the useButton(F-Button) the function exchangeWeapons is called.
    {
    player exchangeWeapons(aimedPlayer);
    aimedPlayer exchangeWeapons(player);
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •