-
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 :)
-
@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/
-
where is IsLookingAt() or geteye() function?
-
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.
-
Ok, players[i] iprintlnBold("Press K to exchange weapons...") now if the player press k, he will accept and the weapons will exchange.
-
so now we need the continue the script..
-
Now you can add a loop on aimedPlayer, which is checking useButtonPressed() for like 5 seconds.
-
kung, sorry i am not good in english and i am bad in script. pls explain me not just write a script pls :D
-
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.
-
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);
}
}