Русское сообщество по скриптингу

Изъятие и отключение оружия у игроков

Все вопросы по скриптингу для Metamod, помощь в редактировании плагинов.
Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающие только скриптинга для
Metamod.


Правила при создании новой темы:
1. При вставке кода плагина необходимо использовать тег [pawn], в противном случае, если тег [pawn] не отображает ваш код, можно использовать тег [code].
2. Любые изображения должны быть загружены, как вложения к вашему сообщению.
3. При описании проблемы или запросе на помощь в редактировании плагина обязательно выкладывайте исходник плагина.

Изъятие и отключение оружия у игроков

Сообщение 9iky6 » 17 май 2012, 18:50

Существует ли способ в метамод изъять и запретить покупку оружия игрокам?
Просто хочу попытаться сделать нормальный, полноценный Clan War модуль, что-то навроде amxmodx. Да, и как Вам такая идейка? ;)
Аватара пользователя
9iky6
 
Сообщения: 2174
Зарегистрирован: 30 янв 2012, 19:07
Откуда: Россия
Благодарил (а): 375 раз.
Поблагодарили: 707 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение Chuvi » 17 май 2012, 20:56

Изьять оружие и запретить его покупать можно с помощью AmxModX.

Посмотри, как это реализовано в исходниках AmxModX и сделай так-же )
Плагинами на заказ не занимаюсь.
Своих дел хватает.
Аватара пользователя
Chuvi
Модератор
 
Сообщения: 2253
Зарегистрирован: 24 ноя 2011, 08:03
Благодарил (а): 127 раз.
Поблагодарили: 562 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение 9iky6 » 17 май 2012, 22:44

Chuvi, я хочу обойтись без amxmodx, в нем я уже знаю как это сделать да и много плагинов, которые делают это. Просто собрал CW сервер на rcon с fps 1200 не хочется портить его глюкнутым amxmodx с десяткой плагинов. Легче сделать 1 метамод плагни, заодно поучится писать для метамод )))
Аватара пользователя
9iky6
 
Сообщения: 2174
Зарегистрирован: 30 янв 2012, 19:07
Откуда: Россия
Благодарил (а): 375 раз.
Поблагодарили: 707 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение Chuvi » 17 май 2012, 22:52

9iky6, я имел ввиду не исходники плагинов, а сишные исходники тех функций, которые используются в тех плагинах.

То бишь я посоветовал посмотреть не исходники аналогичных плагинов, а исходники самого AmxModX и его библиотек.
Плагинами на заказ не занимаюсь.
Своих дел хватает.
Аватара пользователя
Chuvi
Модератор
 
Сообщения: 2253
Зарегистрирован: 24 ноя 2011, 08:03
Благодарил (а): 127 раз.
Поблагодарили: 562 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение 9iky6 » 17 май 2012, 23:06

Chuvi, а, теперь понял. Попробую.
Аватара пользователя
9iky6
 
Сообщения: 2174
Зарегистрирован: 30 янв 2012, 19:07
Откуда: Россия
Благодарил (а): 375 раз.
Поблагодарили: 707 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение DJ_WEST » 18 май 2012, 13:50

Оружие забирается через объект player_weaponstrip. Тебе нужно его заспавнить и заюзать.
Запретить покупку можно разными способами, включая хуки на меню, алиасы оружий и т.д.
Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.
Аватара пользователя
DJ_WEST
Администратор
 
Сообщения: 3641
Зарегистрирован: 22 авг 2009, 00:38
Благодарил (а): 48 раз.
Поблагодарили: 2209 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Counter-Strike: Source
Left 4 Dead
Left 4 Dead 2

Re: Изъятие и отключение оружия у игроков

Сообщение 9iky6 » 18 май 2012, 21:24

DJ_WEST, ну в общих чертах я уже смог понять, что отличие от pawn только в языке програмирования. Я просто думал, тут больше различий будет. А запретить покупку, я думаю в моде сделать реализацию сброса денег на 0 во время "Режима на ножах". Только пока что надо узнать, будет ли вообще такое работать.

P.S. А можешь подсказать, чем в amxmodx убрали ограничение движка на строки в меню?
Просто тестировал comandmenu c amxmodx и без него, так получилось, что в игре без amxmodmenu строки были обрезаны. Я же хочу поставить основное урпавление модом как раз через comandmenu, чтобы была реализация легкого перехода игроков с "Reallite Rcon Mod" (ну и прочих таких пакостей) на данный Clan War mod. Что-то вроде совместимости этих модов сделать.
Аватара пользователя
9iky6
 
Сообщения: 2174
Зарегистрирован: 30 янв 2012, 19:07
Откуда: Россия
Благодарил (а): 375 раз.
Поблагодарили: 707 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение Chuvi » 19 май 2012, 14:39

9iky6,
отличие от pawn только в языке програмирования.

Отличий гораздо больше. Они описаны Вы должны зарегистрироваться, чтобы видеть ссылки..
[spoiler]
⋄ pawn lacks the typing mechanism of C. pawn is an “integer-only” variety
of C; there are no structures or unions, and floating point support must be
implemented with user-defined operators and the help of native functions.
⋄ The accepted syntax for rational numbers is stricter than that of floating
point values in C. Values like “.5” and “6.” are acceptable in C, but
in pawn one must write “0.5” and “6.0” respectively. In C, the decimal
period is optional if an exponent is included, so one can write “2E8”; pawn
does not accept the upper case “E” (use a lower case “e”) and it requires
the decimal point: e.g. “2.0e8”. See page 98 for more information.
⋄ pawn does not provide “pointers”. For the purpose of passing function
arguments by reference, pawn provides a “reference” argument, (page 70).
The “placeholder” argument replaces some uses of the NULL pointer (page
74).
⋄ Numbers can have hexadecimal, decimal or binary radix. Octal radix is
not supported. See “Constants” on page 97. Hexadecimal numbers must
start with “0x” (a lower case “x”), the prefix “0X” is invalid.
⋄ Escape sequences (“\n”, “\t”, etc.) are the same, except for “\ddd”
where “ddd” represent three decimal digits, instead of the octal digits
that C/C++ uses. The backslash (“\”) may be replaced with another
symbol; see #pragma ctrlchar on page 119 —notably, previous versions
of pawn used the caret (“^”) as the escape character.
⋄ Cases in a switch statement are not “fall through”. Only a single instruction
may (and must) follow each case label. To execute multiple
instructions, you must use a compound statement. The default clause
of a switch statement must be the last clause of the switch statement.
More on page 114. In C/C++, switch is a “conditional goto”, akin to
Fortran’s calculated labels. In pawn, switch is a structured “if”.
⋄ A break statement breaks out of loops only. In C/C++, the break statement
also ends a case in a switch statement. Switch statements are
implemented differently in pawn (see page 114).
⋄ pawn supports “array assignment”, with the restriction that both arrays
must have the same size. For example, if “a” and “b” are both arrays
with 6 cells, the expression “a = b” is valid. Next to literal strings, pawn
also supports literal arrays, allowing the expression “a = {0,1,2,3,4,5}”
(where “a” is an array variable with 6 elements).
⋄ defined is an operator, not a preprocessor directive. The defined operator
in pawn operates on constants (declared with const), global variables,
local variables and functions.
⋄ The sizeof operator returns the size of a variable in “elements”, not in
“bytes”. An element may be a cell or a sub-array. See page 108 for details.
⋄ The empty instruction is an empty compound block, not a semicolon (page
111). This modification avoids a frequent error.
⋄ The compiler directives differ from C’s preprocessor commands. Notably,
the #define directive is incompatible with that of C/C++, and #ifdef and
#ifndef are replaced by the more general #if directive (see “Directives”
on page 116). To create numeric constants, see also page 101; to create
string constants, see also page 92.
⋄ Text substitutions (preprocessor macros; see the #define directive) are
not matched across lines. That is, the text that you want to match and
replace with a #define macro must appear on a single line.
⋄ A division is carried out in such a way that the remainder after division
has (or would have) the same sign as the denominator. For positive denominators,
this means that the direction for truncation for the operator
“/” is always towards the smaller value, where -2 is smaller than -1, and
that the “%” operator always gives a positive result —regardless of the
sign of the numerator. See page 103.
⋄ There is no unary “+” operator, which is a “no-operation” operator anyway.
⋄ Three of the bitwise operators have different precedence than in C. The
precedence levels of the “&”, “^” and | operators is higher than the relational
operators (Dennis Ritchie explained that these operators got their
low precedence levels in C because early C compilers did not yet have the
logical “&&” and || operators, so the bitwise “&” and | were used instead).
⋄ The “extern” keyword does not exist in pawn; the current implementation
of the compiler has no “linking phase”. To create a program from several
source files, add all source files the compilers command line, or create one
main project script file that “#include’s” all other source files. The pawn
compiler can optimize out functions and global variables that you do not
use. See pages 61 and 83 for details.
⋄ The keyword const in pawn implements the enum functionality from C,
see page 101.
⋄ In most situations, forward declarations of functions (i.e., prototypes) are
not necessary. pawn is a two-pass compiler, it will see all functions on the
first pass and use them in the second pass. User-defined operators must
be declared before use, however.
If provided, forward declarations must match exactly with the function
definition, parameter names may not be omitted from the prototype or
differ from the function definition. pawn cares about parameter names
in prototypes because of the “named parameters” feature. One uses prototypes
to call forwardly declared functions. When doing so with named
parameters, the compiler must already know the names of the parameters
(and their position in the parameter list). As a result, the parameter
names in a prototype must be equal to the ones in the definition.
[/spoiler]
Плагинами на заказ не занимаюсь.
Своих дел хватает.
Аватара пользователя
Chuvi
Модератор
 
Сообщения: 2253
Зарегистрирован: 24 ноя 2011, 08:03
Благодарил (а): 127 раз.
Поблагодарили: 562 раз.

Re: Изъятие и отключение оружия у игроков

Сообщение 9iky6 » 19 май 2012, 19:32

Chuvi, ну это зависимость от кодировки идет. А так основа идет практически теми же самыми командами.
Аватара пользователя
9iky6
 
Сообщения: 2174
Зарегистрирован: 30 янв 2012, 19:07
Откуда: Россия
Благодарил (а): 375 раз.
Поблагодарили: 707 раз.


Вернуться в Скриптинг

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 7