Сообщений: 2 Откуда: Россия Зарегистрирован: 31 Января 2011, 07:13:28 Пол:
Не определен Статус: offline
Опубликовано 31 Января 2011, 07:18:29
чуваки, помогите с ножевым раундом!
я его все как надо устанавливаю, на серваке он вылазит, только по странному!
не дает запрос на подтверждение махаться на ножах!
в чем проблема??!!
AUTOMATIC KNIFE DUEL
====================
Where I come from, if you cut the wall repeteadly with your knife it means you're challenging your last opponent to a knife duel. ;-)
I decided to automate this process.
If only you and another person on the opposite team remain in the round, you can hit a wall (or another object) with your knife, THREE TIMES in fast succession.
By this action you challenge your opponent to a knife duel. The person you challenge gets a menu where he can accept/decline your
challenge. The challenged person has 10 seconds to decide his mind, else the challenge is automatically declined, and the menu should be closed automatically.
Should a knife duel start, it works out pretty much like a round of Knife Arena: you can only use the knife (and the C4!).
As soon as the round ends the Knife Arena mode is turned off.
/JGHG
VERSIONS
========
050421 0.3 You must now slash with your knife three times in fast succession to challenge someone.
050208 0.2 Fixed seconds display.
Bots should now respond correctly and a little human like. They will mostly accept challenges. ;-)
Small fixes here and there. :-)
050208 0.1 First version - largely untested
*/
#if defined DEBUG
#include <amxmisc>
#endif // defined DEBUG
#define MENUSELECT1 0
#define MENUSELECT2 1
#define TASKID_CHALLENGING 2348923
#define TASKID_BOTTHINK 3242321
#define DECIDESECONDS 10
#define ALLOWED_WEAPONS 2
#define KNIFESLASHES 3 // the nr of slashes within a short amount of time until a challenge starts...
// Globals below
new g_allowedWeapons[ALLOWED_WEAPONS] = {CSW_KNIFE, CSW_C4}
new g_MAXPLAYERS
new bool:g_challenging = false
new bool:g_knifeArena = false
new bool:g_noChallengingForAWhile = false
new g_challengemenu
new g_challenger
new g_challenged
new g_challenges[33]
// Globals above
public plugin_modules()
{
require_module("fakemeta"
require_module("fun"
}
new team = get_user_team(PIRATE), otherteam = 0, matchingOpponent = 0
// Make sure exactly one person on each team is alive.
for (new i = 1; i <= g_MAXPLAYERS; i++) {
if (!is_user_connected(i) || !is_user_alive(i) || PIRATE == i)
continue
if (get_user_team(i) == team) {
// No fun.
return FMRES_IGNORED
}
else {
if (++otherteam > 1) {
// No fun.
return FMRES_IGNORED
}
matchingOpponent = i
}
}
if (matchingOpponent == 0)
return FMRES_IGNORED
if (++g_challenges[PIRATE] >= KNIFESLASHES) {
Challenge(PIRATE, matchingOpponent)
if (is_user_bot(matchingOpponent)) {
new Float:val = float(DECIDESECONDS)
if (val < 2.0)
val = 2.0
remove_task(TASKID_BOTTHINK)
set_task(random_float(1.0, float(DECIDESECONDS) - 1.0), "BotDecides", TASKID_BOTTHINK)
}
g_challenges[PIRATE] = 0
}
else
set_task(1.0, "decreaseChallenges", PIRATE)
public event_holdwpn(id) {
if (!g_knifeArena || !is_user_alive(id))
return PLUGIN_CONTINUE
new weaponType = read_data(2)
for (new i = 0; i < ALLOWED_WEAPONS; i++) {
if (weaponType == g_allowedWeapons[i])
return PLUGIN_CONTINUE
}
engclient_cmd(id, "weapon_knife"
return PLUGIN_CONTINUE
}
public event_roundend() {
if (g_challenging || g_knifeArena)
CancelAll()
g_noChallengingForAWhile = true
set_task(4.0, "NoChallengingForAWhileToFalse"
return PLUGIN_CONTINUE
}
public NoChallengingForAWhileToFalse() {
g_noChallengingForAWhile = false
}
CancelAll() {
if (g_challenging) {
g_challenging = false
// Close menu of challenged
if (is_user_connected(g_challenged)) {
new usermenu, userkeys
get_user_menu(g_challenged, usermenu, userkeys) // get user menu
// Hmm this ain't working :-/
if (usermenu == g_challengemenu) // Close it!
show_menu(g_challenged, 0, "blabla" // show empty menu
}
}
if (g_knifeArena) {
g_knifeArena = false
}
remove_task(TASKID_BOTTHINK)
remove_task(TASKID_CHALLENGING)
}
public event_death() {
if (g_challenging || g_knifeArena)
CancelAll()
return PLUGIN_CONTINUE
}
#if defined DEBUG
public challengefn(id, level, cid) {
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new challenger[64], challenged[64]
read_argv(1, challenger, 63)
read_argv(2, challenged, 63)