-
Press F
Hello, this script doesnt work. How can i make it work? It would be great to have killstreaks which activates by using button "f".
PHP Code:
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;
}
}
}
-
It's a function added via libcod, best you compile this: https://github.com/voron00/libcod
inb4 how: https://killtube.org/showthread.php?...u-14-04-server
EDIT: oops, usebuttonpressed is a stock function, thanks izno xD
-
PHP Code:
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)
-
i changed wait to .15 and it works. thanks for help:)
-
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.
-
so how to make it correctly ?
-
-
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.