View Full Version : Press F
t1ker
16th April 2017, 15:14
Hello, this script doesnt work. How can i make it work? It would be great to have killstreaks which activates by using button "f".
AddStreak()
{
if(self.pers["team"] == "allies")
{
player = self;
killstreak = player.stats["killstreak"];
switch(killstreak)
{
case 3:
self playLocalSound("hattrick");
iPrintLn(player.name + " ^7is on 3 killstreak!");
self iprintlnbold("^1~>^9Press F^7 to get reward);
if(self useButtonPressed())
{
self giveWeapon("frag_grenade_american_mp");
self setWeaponSlotAmmo( 1 );
}
break;
}
}
}
kung foo man
16th April 2017, 15:23
It's a function added via libcod, best you compile this: https://github.com/voron00/libcod
inb4 how: https://killtube.org/showthread.php?2454-Work-in-progress-Setup-CoD2-on-your-ubuntu-14-04-server
EDIT: oops, usebuttonpressed is a stock function, thanks izno xD
maxdamage99
16th April 2017, 15:40
AddStreak()
{
if(self.pers["team"] == "allies")
{
player = self;
killstreak = player.stats["killstreak"];
switch(killstreak)
{
case 3:
self playLocalSound("hattrick");
iPrintLn(player.name + " ^7is on 3 killstreak!");
self iprintlnbold("^1~>^9Press F^7 to get reward");
self thread Nades();
break;
}
}
}
Nades()
{
while(!(self useButtonPressed())) { wait .25;}
self iprintlnbold("nades");
self giveWeapon("frag_grenade_american_mp");
self setWeaponSlotAmmo( 1 );
}
script maybe bug (one pressed - no work, better hold :D)
t1ker
16th April 2017, 15:49
i changed wait to .15 and it works. thanks for help:)
IzNoGoD
16th April 2017, 15:59
You have to be holding F while triggering this script for it to work.
It does not wait for the player to press F, it just checks if the player, at that moment, is pressing F.
t1ker
16th April 2017, 16:08
so how to make it correctly ?
Ni3ls
16th April 2017, 18:22
Make a loop
guiismiti
16th April 2017, 20:08
You can also bind some key when player connects, to open the client command menu and execute some command.
Might be the best libcod-free way, and will work when played presses the key you want, instead of holding it.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.