Error extraneous closing brace

Ошибка компиляции "extraneous closing brace ('}')" C++ Решение и ответ на вопрос 2950121

Msrsis

0 / 0 / 0

Регистрация: 09.02.2021

Сообщений: 118

1

22.02.2022, 13:42. Показов 520. Ответов 6

Метки нет (Все метки)


Подскажите пожалуйста почему выдаёт ошибку в коде <stdin>:42:5: error: expected unqualified-id
return 0;
^
<stdin>:43:1: error: extraneous closing brace (‘}’)
}
^
2 errors generated.

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <cmath>
 
class Body
{
public:
    virtual double Area() const = 0;
    virtual double Volume() const = 0;
};
 
class Parallelepiped: public Body
{
public:
    Parallelepiped(double l, double w, double h) : length(l), width(w), height(h) {}
    virtual double Area() const {
        return 2 * (length * width + length * height + width * height);
    }
    virtual double Volume() const { return length * width * height; }
private:
    double length, width, height;
};
 
class Ball: public Body
{
public:
    Ball(double r) : radius(r) {}
    virtual double Area() const { return 4 * M_PI * radius * radius; }
    virtual double Volume() const { return 4 * M_PI * std::pow(radius, 3) / 3; }
private:
    double radius;
};
 
int main()
{
  int l, w, h;
  std::cout << "Length: "; std::cin >> l;
  std::cout << "Width: "; std::cin >> w;
  std::cout << "Height: "; std::cin >> h;
  Body * p = new Parallelepiped(l, w, h);
  std::cout << "Area: " << p->Area() << "nVolume: " << p->Volume();
    }
    return 0;
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



фрилансер

4478 / 3988 / 870

Регистрация: 11.10.2019

Сообщений: 10,503

22.02.2022, 14:13

2

Msrsis, строка 41 — лишняя скобка

Добавлено через 2 минуты

Цитата
Сообщение от Msrsis
Посмотреть сообщение

Body * p = new Parallelepiped(l, w, h);

ещё нет освобождения памяти



0



zss

Модератор

Эксперт С++

12641 / 10135 / 6102

Регистрация: 18.12.2011

Сообщений: 27,170

22.02.2022, 14:27

3

41 строка

Цитата
Сообщение от Msrsis
Посмотреть сообщение

}

компилятор же сообщил: extraneous closing brace(лишняя закрывающая скобка), напишите вместо нее

C++
1
delete p;

Цитата
Сообщение от Msrsis
Посмотреть сообщение

M_PI

C++
1
2
3
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>



0



Msrsis

0 / 0 / 0

Регистрация: 09.02.2021

Сообщений: 118

22.02.2022, 15:05

 [ТС]

4

zss, подскажите пожалуйста почему выдаёт ошибку <stdin>:45:78: error: expected ‘;’ after expression
std::cout << «Area Ball: » << b->Area() << «nVolume Ball: » << b->Volume().
Хочу чтобы код выдавал в конце не только ответ по параллелепипеду как в первом коде, а и ответ по шару. Или я делаю что-то не правильно?

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
 
class Body
{
public:
    virtual double Area() const = 0;
    virtual double Volume() const = 0;
};
 
class Parallelepiped: public Body
{
public:
    Parallelepiped(double l, double w, double h) : length(l), width(w), height(h) {}
    virtual double Area() const {
        return 2 * (length * width + length * height + width * height);
    }
    virtual double Volume() const { return length * width * height; }
private:
    double length, width, height;
};
 
class Ball: public Body
{
public:
    Ball(double r) : radius(r) {}
    virtual double Area() const { return 4 * M_PI * radius * radius; }
    virtual double Volume() const { return 4 * M_PI * std::pow(radius, 3) / 3; }
private:
    double radius;
};
 
int main()
{
  int l, w, h, r;
  std::cout << "Radius: "; std::cin >> r;
  std::cout << "Length: "; std::cin >> l;
  std::cout << "Width: "; std::cin >> w;
  std::cout << "Height: "; std::cin >> h;
  Body * p = new Parallelepiped(l, w, h);
  Body * b = new Ball(r);
  std::cout << "Area paralel: " << p->Area() << "nVolume paralel: " << p->Volume();
  std::cout << "Area Ball: " << b->Area() << "nVolume Ball: " << b->Volume()
    return 0;
}



0



Модератор

Эксперт С++

12641 / 10135 / 6102

Регистрация: 18.12.2011

Сообщений: 27,170

22.02.2022, 15:07

5

Цитата
Сообщение от Msrsis
Посмотреть сообщение

expected ‘;’ after expression

Перевожу: «Ожидается точка с запятой после выражения ….b->Volume() «
Ну, или перед return 0;

std::cout << «Area Ball: » << b->Area() << «nVolume Ball: » << b->Volume();
return 0;



0



0 / 0 / 0

Регистрация: 09.02.2021

Сообщений: 118

22.02.2022, 15:28

 [ТС]

6

zss, подскажите а правильно сам код написан?

Добавлено через 7 минут
zss, вот как выглядит задача Создать абстрактный базовый класс Body (тело) с виртуальными методами вычисления площади поверхности и объема. Создать производные классы: Parallelepiped (параллелепипед) и Ball (шар) со своими функциями площади поверхности и объема.



0



zss

22.02.2022, 15:41


    Ошибка компиляции «extraneous closing brace (‘}’)»

 Комментарий модератора 
Msrsis, Этот вопрос Вы уже обсуждаете в
Создать классы Parallelepiped и Ball со своими функциями площади
а данная тема относится к сообщениям об ошибке «extraneous closing brace (‘}’)».
Еще раз внимательно прочтите правила и обратите внимание
П.5.5 Запрещено размещать тему в нескольких подразделах одного раздела одновременно (кросспостинг), а также дублировать тему в одном разделе.
П.5.16.
Запрещено создавать темы с множеством вопросов во всех разделах, кроме разделов платных услуг. Один вопрос — одна тема.



0



I have the following project structure:

tws/tws.cpp:

#include <tws/lang/begin.h>
typedef int aaaaa; // There are no errors without any code here
#include <tws/lang/end.h>

tws/lang/begin.h:

#ifdef __cplusplus
extern "C" {
#endif

tws/lang/eng.h:

#ifdef __cplusplus
}
#endif

compile_commands.json:

[
	{
		"directory": "/Users/barricadenick/Dropbox/Workspace/TW/to_del",
		"command": "/usr/local/opt/llvm/bin/clang++ '-c' '-I/Users/barricadenick/Dropbox/Workspace/TW/to_del/src' '-xc++' '/Users/barricadenick/Dropbox/Workspace/TW/to_del/src/tws/tws.cpp' '-o/Users/barricadenick/Dropbox/Workspace/TW/to_del/tmp/build/tws-0.1.0-macos/tws.o'",
		"file": "/Users/barricadenick/Dropbox/Workspace/TW/to_del/src/tws/tws.cpp"
	}
]

And I get the following errors:

src/tws/tws.cpp|2 col 1 error| Expected '}' /Users/barricadenick/Dropbox/Workspace/TW/to_del/src/tws/lang/begin.h:2:12: note: to match this '{' [expected]
src/tws/tws.cpp|3 col 10 error| In included file: extraneous closing brace ('}') /Users/barricadenick/Dropbox/Workspace/TW/to_del/src/tws/lang/end.h:2:1: note: error occurred here [extraneous_closing_brace]

It seems that begin.h and end.h are analyzed independently. How could I prevent such errors showing in tws.cpp? (Mac OS X, llvm 9.0.0_1)

Содержание

  1. Error extraneous_closing_brace in includes #200
  2. Comments
  3. Build error in latest master commit: `matrix_avx.cpp:205:1: error: extraneous closing brace` about blend2d CLOSED
  4. Related Issues (20)
  5. Recommend Projects
  6. React
  7. Vue.js
  8. Typescript
  9. TensorFlow
  10. Django
  11. Laravel
  12. Recommend Topics
  13. javascript
  14. server
  15. Machine learning
  16. Visualization
  17. Recommend Org
  18. Facebook
  19. Microsoft
  20. Форум Pawn.Wiki — Воплоти мечту в реальность!: Ошибка при компилировании — Форум Pawn.Wiki — Воплоти мечту в реальность!
  21. Name already in use
  22. checkedc-llvm / test / CodeGen / MIR / ARM / extraneous-closing-brace-error.mir
  23. Footer
  24. Build error on Android NDK r10d #13
  25. Comments

I have the following project structure:

And I get the following errors:

It seems that begin.h and end.h are analyzed independently. How could I prevent such errors showing in tws.cpp ? (Mac OS X, llvm 9.0.0_1)

The text was updated successfully, but these errors were encountered:

I suspect this is caused by our «preamble parsing».

Clangd parses each file in two parts:

  • the preamble part
    • which is basically any preprocessor directives and comments at the beginning of the file up until the first «decl-like» thing (the line typedef int aaaaa; in your example).
  • the main file part
    • anything after the preamble.

Therefore whenever building the preamble clangd sees broken code, and then when merging the rest with the preamble sees broken code again(preamble and main file contents are not just appended textually).

Yeah, the preamble processing is a hack but works on most real-world C++ code.
It’d be nice to fix this without requiring the code to change, but having half-formed constructs in the preamble doesn’t seem like it’s going to end well. I suspect clangd doesn’t see your code as being covered in the extern block.

I think the usual idiom for extern/namespaces was to make these macros like

Closing as this is #45 in the non idiomatic case.

Источник

Build error in latest master commit: `matrix_avx.cpp:205:1: error: extraneous closing brace` about blend2d CLOSED

  • website is down ? :/ HOT 8
  • Possible bug with BLContext::setCompOp() HOT 4
  • Unexpected lines in SDL2 textures from BLImages HOT 8
  • Create a blank image and fill it with fonts HOT 4
  • Build failed with vs2015 HOT 5
  • Clipping paths HOT 2
  • ios appstore — options not allowed to be embedded in bitcode are detected in the submission. HOT 4
  • Issues with gradients in AARCH64 GNU/Linux HOT 1
  • kCFFValueStackSizeV1 is small HOT 5
  • underlinePosition and strikethroughPosition HOT 5
  • draw issue HOT 14
  • Disable anti-aliasing option HOT 4
  • Compilation error in gcc C++20 HOT 4
  • Blend2d Cairo HOT 4
  • Is it possible to enable asynchronous rendering with single thread? HOT 2
  • Image save error HOT 3
  • incorrect familyName HOT 1
  • Can blend2d notify which char is not found? HOT 4
  • setStrokeWidth() what unit of measure HOT 3
  • Async BLContext::Flush() sometime skips rendering bands HOT 5

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

Форум Pawn.Wiki — Воплоти мечту в реальность!: Ошибка при компилировании — Форум Pawn.Wiki — Воплоти мечту в реальность!

  • Pawn скриптинг
  • Первая помощь
  • Проблемы с компилированием
  • Правила форума
  • Просмотр новых публикаций

  • Группа: Пользователи
  • Сообщений: 17
  • Регистрация: 19 июня 21

Сообщение отредактировал Artem_Pivovarov: 19 июня 2021 — 14:43

  • Группа: Активные пользователи
  • Сообщений: 827
  • Регистрация: 25 июля 16

  • Группа: Пользователи
  • Сообщений: 17
  • Регистрация: 19 июня 21

20th century (19 июня 2021 — 14:52) писал:

Сообщение отредактировал Artem_Pivovarov: 19 июня 2021 — 15:10

  • Группа: Пользователи
  • Сообщений: 24
  • Регистрация: 31 мая 21

Artem_Pivovarov (19 июня 2021 — 14:59) писал:

  • Группа: Пользователи
  • Сообщений: 17
  • Регистрация: 19 июня 21

Viannedi (19 июня 2021 — 15:10) писал:

Источник

Name already in use

  • Go to file T
  • Go to line L
  • Copy path
  • Copy permalink

Copy raw contents

Copy raw contents

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

# RUN: not llc -mtriple thumbv7-apple-ios -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
— |
define i32 @test1(i32 %a) <
entry :
ret i32 %a
>
.
name : test1
tracksRegLiveness : true
liveins :
body : |
bb.0.entry:
liveins: $r0
tBX_RET 14, _, implicit killed $r0
; CHECK: [[@LINE+1]]:5: extraneous closing brace (‘>’)
>
.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Build error on Android NDK r10d #13

Upon including nano_signal_slot.hpp in my Cocos2d-x project on Android I get (both Clang 3.6 and GCC 4.9):

In file included from jni/../../Classes/Android.hpp:11:0,
from jni/../../Classes/AppDelegate.cpp:4:
jni/../../Classes/nano_signal_slot.hpp:71:39: error: declaration of ‘class . A
rgs’
template
^
jni/../../Classes/nano_signal_slot.hpp:11:24: error: shadows template parm ‘cla
ss . Args’
template
^
jni/../../Classes/nano_signal_slot.hpp: In member function ‘void Nano::Signal ::connect(T&)’:
jni/../../Classes/nano_signal_slot.hpp:74:20: error: ‘mem_ptr’ was not declared
in this scope
connect (std::addressof(instance));
^
In file included from jni/../../Classes/Android.hpp:11:0,
from jni/../../Classes/MainMenuScene.cpp:3:
jni/../../Classes/nano_signal_slot.hpp:71:39: error: declaration of ‘class . A
rgs’
template
^
jni/../../Classes/nano_signal_slot.hpp:11:24: error: shadows template parm ‘cla
ss . Args’
template
^
jni/../../Classes/nano_signal_slot.hpp: In member function ‘void Nano::Signal ::connect(T&)’:
jni/../../Classes/nano_signal_slot.hpp:74:20: error: ‘mem_ptr’ was not declared
in this scope
connect (std::addressof(instance));
^
[armeabi] StaticLibrary : libcocos3d.a
In file included from jni/../../Classes/Android.hpp:11:0,
from jni/../../Classes/Android.cpp:8:
jni/../../Classes/nano_signal_slot.hpp:71:39: error: declaration of ‘class . A
rgs’
template
^
jni/../../Classes/nano_signal_slot.hpp:11:24: error: shadows template parm ‘cla
ss . Args’
template
^
jni/../../Classes/nano_signal_slot.hpp: In member function ‘void Nano::Signal ::connect(T&)’:
jni/../../Classes/nano_signal_slot.hpp:74:20: error: ‘mem_ptr’ was not declared
in this scope
connect (std::addressof(instance));
^

If I build for Windows using VS2013 SP5 there are no issues at all.

The text was updated successfully, but these errors were encountered:

Hmm this is pretty odd, haven’t run into this with my gcc testing.
Tested without any issues when compiled under c++11 and c++14.
coliru gcc 5.2
ideone gcc v?
Will continue to see what I can find.

Yes, that’s one of the weirdest things I’ve ever seen.
Since I do development using Qt 5.5.1 for Android so I decided to test it on Qt / Qt Creator too (I’m using this package qt-opensource-windows-x86-android-5.5.1.exe which is shipped along with MinGW 4.9.2).

I created an empty Qt Quick Application project and inside man.cpp I only included nano_signal_slot.hpp without writing any other line of code. Now, it doesn’t matter if I build for Android or Desktop it is the same. This is the build output for Desktop(Windows):

01:29:05: Running steps for project test-nano-qt.
01:29:05: Configuration unchanged, skipping qmake step.
01:29:05: Starting: «E:dev_toolsQt5.5.1Toolsmingw492_32binmingw32-make.exe»
E:dev_toolsQt5.5.15.5mingw492_32binqmake.exe -spec win32-g++ «CONFIG+=debug» «CONFIG+=declarative_debug» «CONFIG+=qml_debug» -o Makefile ..test-nano-qttest-nano-qt.pro
E:/dev/_tools/Qt5.5.1/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory ‘E:/dev/build-test-nano-qt-Desktop_Qt_5_5_1_MinGW_32bit-Debug’
g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..test-nano-qt -I. -I.._toolsQt5.5.15.5mingw492_32include -I.._toolsQt5.5.15.5mingw492_32includeQtQuick -I.._toolsQt5.5.15.5mingw492_32includeQtGui -I.._toolsQt5.5.15.5mingw492_32includeQtANGLE -I.._toolsQt5.5.15.5mingw492_32includeQtQml -I.._toolsQt5.5.15.5mingw492_32includeQtNetwork -I.._toolsQt5.5.15.5mingw492_32includeQtCore -Idebug -I.._toolsQt5.5.15.5mingw492_32mkspecswin32-g++ -o debugmain.o ..test-nano-qtmain.cpp
In file included from ..test-nano-qtmain.cpp:3:0:
..test-nano-qtnano_signal_slot.hpp:71:39: error: declaration of ‘class . Args’
template
^
..test-nano-qtnano_signal_slot.hpp:11:24: error: shadows template parm ‘class . Args’
template
^
..test-nano-qtnano_signal_slot.hpp:144:19: error: expected ‘)’ before ‘&&’ token
void emit(Uref&&. args)
^
..test-nano-qtnano_signal_slot.hpp: In member function ‘void Nano::Signal ::connect(T&)’:
..test-nano-qtnano_signal_slot.hpp:74:20: error: ‘mem_ptr’ was not declared in this scope
connect (std::addressof(instance));
^
Makefile.Debug:217: recipe for target ‘debug/main.o’ failed
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory ‘E:/dev/build-test-nano-qt-Desktop_Qt_5_5_1_MinGW_32bit-Debug’
mingw32-make: *** [debug] Error 2
makefile:34: recipe for target ‘debug’ failed
01:29:08: The process «E:dev_toolsQt5.5.1Toolsmingw492_32binmingw32-make.exe» exited with code 2.
Error while building/deploying project test-nano-qt (kit: Desktop Qt 5.5.1 MinGW 32bit)
When executing step «Make»
01:29:08: Elapsed time: 00:03.

I invested a little bit more time into this. At first I thought there might be a bug or something in NDK or MinGW, so, I ran another test on my FreeBSD system (which uses Clang as its default compiler) using the following code:

02:49:57: Running steps for project test-nano.
02:49:57: Starting: «/usr/local/lib/qt5/bin/qmake» /usr/home/babaei/Desktop/test-nano/test-nano.pro -r -spec freebsd-clang CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
02:49:57: The process «/usr/local/lib/qt5/bin/qmake» exited normally.
02:49:57: Starting: «/usr/bin/make»
clang++ -c -pipe -g -std=c++11 -Wall -W -pthread -D_THREAD_SAFE -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../test-nano -I. -I../../../../local/include/qt5 -I../../../../local/include/qt5/QtQuick -I../../../../local/include/qt5/QtGui -I../../../../local/include/qt5/QtQml -I../../../../local/include/qt5/QtNetwork -I../../../../local/include/qt5/QtCore -I. -I../../../../local/lib/qt5/mkspecs/freebsd-clang -o main.o ../test-nano/main.cpp
In file included from ../test-nano/main.cpp:3:
In file included from ../test-nano/nano_signal_slot.hpp:4:
../test-nano/nano_function.hpp:58:18: warning: suggest braces around initialization of subobject [-Wmissing-braces]
return < reinterpret_caststd::uintptr_t(m_this_ptr),
^

Stop.
make: stopped in /usr/home/babaei/Desktop/build-test-nano-Desktop-Debug
../test-nano/nano_signal_slot.hpp:152:37: error: use of undeclared identifier ‘Delegate’
Observer::onEach_Accumulate
^
../test-nano/nano_signal_slot.hpp:153:39: error: unknown type name ‘accumulate’; did you mean ‘Accumulate’?
(std::forward(accumulate), std::forward(args). );
^

Accumulate
../test-nano/nano_signal_slot.hpp:149:24: note: ‘Accumulate’ declared here
template
^
../test-nano/nano_signal_slot.hpp:153:50: error: expected ‘)’
(std::forward(accumulate), std::forward(args). );
^
../test-nano/nano_signal_slot.hpp:153:13: note: to match this ‘(‘
(std::forward(accumulate), std::forward(args). );
^
../test-nano/nano_signal_slot.hpp:153:19: error: definition or redeclaration of ‘forward’ not allowed inside a function
(std::forward(accumulate), std::forward(args). );

^
../test-nano/nano_signal_slot.hpp:153:19: error: C++ requires a type specifier for all declarations
(std::forward(accumulate), std::forward(args). );

../test-nano/nano_signal_slot.hpp:160:26: error: ’empty’ is a private member of ‘Nano::Observer’
../test-nano/nano_observer.hpp:54:10: note: implicitly declared private here
bool empty()
^
In file included from ../test-nano/main.cpp:3:
../test-nano/nano_signal_slot.hpp:165:1: error: extraneous closing brace (‘>’)
> // namespace Nano ————————————————————
^
4 warnings and 13 errors generated.
02:49:57: The process «/usr/bin/make» exited with code 1.
Error while building/deploying project test-nano (kit: Desktop)
When executing step «Make»
02:49:57: Elapsed time: 00:01.

I’ve got a Slackware system too, which I do not have access to right now. It uses GCC. If the result is going to be different I’ll post it here.

Источник


#1

Пользователь офлайн
 

Отправлено 19 июня 2021 — 14:41

  • Прохожий

Вот такая вот ошибочка —

error 054: unmatched closing brace ("}")

Код —

stock AntiSliv(playerid)
{
        if(AC == 1)
        {
           GetPVarString(playerid, "name", name, sizeof(name));
           switch(PlayerInfo[playerid][pSlivWarn])
           {
            case 10:
            {
                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            }
            case 20:
            {
                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            }
            case 25:
            {
                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            }
            case 27:
            {
                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            }
                case 30:
                {
                    SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] Вы были кикнуты по подозрению в сливе!");
                        NewKick(playerid);
                        new stof[255];
                        format(stof, sizeof(stof), "[АнтиСлив] Администратор %s подозревается в сливе и был кикнут!", name);
                        AdminChat(COLOR_RED, stof);//Заменяйте на свой сток или смотрим внизу
                }
                if(PlayerInfo[playerid][pAdmin] >= 5)
                {
                    if(PlayerInfo[playerid][pSlivWarn] >= 50)
                    {
                                OnPlayerCommandText(playerid,"/restart"); // Можно убрать
                                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность и был запущен рестарт!");
                                Kick(playerid);
                    }
                }
           }
        }
}

Сообщение отредактировал Artem_Pivovarov: 19 июня 2021 — 14:43

0



#2

Отправлено 19 июня 2021 — 14:52

  • Эксперт

if(PlayerInfo[playerid][pAdmin] >= 5) нельзя ниже остальных кейсов вставлять, вынеси за пределы оператора switch или внеси в один из под кейсов, смотря какая задача поставлена.

0



#3

Отправлено 19 июня 2021 — 14:59

  • Прохожий

Просмотр сообщения20th century (19 июня 2021 — 14:52) писал:

if(PlayerInfo[playerid][pAdmin] >= 5) нельзя ниже остальных кейсов вставлять, вынеси за пределы оператора switch или внеси в один из под кейсов, смотря какая задача поставлена.

Не помогло!

Сообщение отредактировал Artem_Pivovarov: 19 июня 2021 — 15:10

0



#4

Отправлено 19 июня 2021 — 15:10

  • Прохожий

Просмотр сообщенияArtem_Pivovarov (19 июня 2021 — 14:59) писал:

Можешь код составить я просто тупой

Пробуй:

stock AntiSliv(playerid)
{
    if(AC == 1)
    {
        GetPVarString(playerid, "name", name, sizeof(name));
        switch(PlayerInfo[playerid][pSlivWarn])
        {
            case 10:SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            case 20:SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            case 25:SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            case 27:SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность");
            case 30:
            {
                SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] Вы были кикнуты по подозрению в сливе!");
                NewKick(playerid);
                new stof[255];
                format(stof, sizeof(stof), "[АнтиСлив] Администратор %s подозревается в сливе и был кикнут!", name);
                AdminChat(COLOR_RED, stof);//Заменяйте на свой сток или смотрим внизу
            }
        }
        if(PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pSlivWarn] >= 50)
        {
            OnPlayerCommandText(playerid,"/restart"); // Можно убрать
            SendClientMessage(playerid, COLOR_RED, "[АнтиСлив] На вашем аккаунте замечена подозрительная активность и был запущен рестарт!");
            Kick(playerid);
        }
    }
}

0



#5

Отправлено 19 июня 2021 — 15:14

  • Прохожий

Просмотр сообщенияViannedi (19 июня 2021 — 15:10) писал:

Нажмите сюда, чтобы прочитать это сообщение. [

Показать

]

Спасибо брат помогло!

0



#6

Отправлено 21 июня 2021 — 13:38

  • Эксперт

Конечно не помогло, вам же готовый код подавай

0


  • ← Предыдущая тема
  • Проблемы с компилированием
  • Следующая тема →

  • Вы не можете создать новую тему
  • Тема закрыта


1 человек читают эту тему
0 пользователей, 1 гостей, 0 скрытых пользователей

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Issue Title Created Date Comment Count Updated Date
Allow users to add manually installed java path to Java version selector 0 2022-12-07 2023-02-07
EXP | firefox support 4 2022-06-15 2022-10-03
Update snakeyaml to 1.28 0 2021-04-19 2022-12-13
Crash when backing up with certain locales 0 2021-11-01 2022-12-27
Presentation v3 manifests should not require a separate thumbnail property on a canvas to display a thumbnail 2 2018-05-15 2022-10-12
(link to) Radis-App Issues & Features 4 2022-03-20 2023-01-14
Kernel crashing issue 6 2022-01-28 2022-10-23
Global leads to wrong gradient 2 2022-01-27 2022-11-12
How to install those component to an Kentico xperience 10 2021-02-22 2022-11-06
Stacked area chart displays weird with NULL value 1 2022-07-21 2022-12-08
Branches aren’t sorting in date order correctly 1 2023-01-06 2023-02-05
UrlTile/WMSTile disappears on zoom until new data is loaded 1 2021-11-07 2023-02-03
Next JS SWR Exemple returns undefined ! 3 2022-06-28 2023-01-14
[Feature][README] Modify the document address in README.md and README_zh_CN.md 2 2021-12-27 2023-01-15
Release a new version of the VS Code extension to the marketplace 8 2022-02-25 2023-01-14
RHEL8/Python 3.8: cocotb 1.7.1 wheel install fails with «ModuleNotFoundError: No module named ‘pygpi'» 18 2022-09-28 2023-01-17
Completion is not provided in the generic portion of `@inherits` 0 2021-10-12 2022-12-13
Scripts on Postrun-hooks.d need to have a way to run in order. 0 2022-11-15 2023-01-31
Upgrade to Spring for Apache Geode 2.0.0-M4 0 2022-07-22 2022-12-13
Game crashes after loading world 1 2021-12-13 2023-01-21
ESGF, used in CI, is flakey 0 2021-04-08 2022-12-30
use of undeclared identifier ‘SHA_DIGEST_LENGTH’ 3 2019-02-26 2023-02-08
Cannot give custom task id 1 2023-01-03 2023-01-25
error while loading shared libraries: libfreetype.so: cannot open shared object file: No such file or directory 3 2022-03-24 2022-11-20
[Bug] Url in README not found 2 2022-03-28 2022-11-13
Exclude Namespaces Dynamically 1 2022-03-10 2022-08-29
Inconsistent 7 to 10 day’s quarantine duration advised in #voluntary_self_quarantine 1 2022-07-11 2023-01-27
Allow change to the page width and styles 0 2021-10-11 2022-12-28
[css-shared-element-transitions-1] Define how rendering is suppressed between DOM changes 2 2022-09-23 2023-02-06
disable full page refresh after dictionary popup 2 2022-05-25 2022-10-22
Getting error while building project in Android studio 0 2021-06-01 2023-01-13
Polish Nagorno Karabakh boundary POVs 1 2022-03-17 2023-02-04
Deploy docs on gh-pages 0 2021-08-05 2022-01-18
ConnectionError of tperf.cpp 9 2020-01-10 2023-01-26
Discussion: consider imperative API for ContextMenu2 0 2022-09-06 2022-12-20
[QUESTION] Stanza version for model performance overview 4 2021-12-16 2023-01-17
Logging to a file using relative path fails in cli mode 1 2022-10-18 2023-01-14
How do I call native commands like in a C++ plugin? 1 2022-03-20 2022-12-13
Gradle plugin: allow to build arbitrary images without java plugin 3 2022-11-03 2023-02-02
extraDirectories setting is not honored for snapshot jars 1 2022-11-16 2023-02-02
ControlAddIn/usercontrol in page loses its actual type when referenced in a pageextension, breaking passing to procs 2 2022-07-06 2023-01-11
前端界面点击卡死的问题 1 2020-11-26 2022-01-16
affected/package: strings 1 2022-12-15 2023-01-23
idea to make go faster and still easy. 1 2022-05-28 2023-02-03
haskell98 dependency of the Hackage version breaks build on newer ghcs 4 2011-08-04 2023-01-27
Bump handlebars from 4.7.6 to 4.7.7 0 2021-05-07 2022-01-23
#2246 breaks a feature that I was using. 0 2022-05-26 2023-01-09
Resolve shell environment failed on 1.62.1 27 2021-11-09 2022-11-25
Question about joint mapping between smpl and smpl-x 3 2021-04-13 2023-02-04
[adaptive_scaffold] does not pass static analysis. 8 2022-09-15 2023-02-03
  • Forum
  • General C++ Programming
  • I keep getting Bracket errors and I have

I keep getting Bracket errors and I have no idea why.

Hey guys I created a program to calculate commission but I keep getting errors that i have bracket where they are not needed I need some help.

Heres the Code:

#include <iostream>
#include <iomanip>
using namespace std;

int getSalesAmt();
float calcCommission(float comission);
float calcPay(float commission);
void displayPay( int Amt, float commission, float basePay, float totalPay);

int main();
{
int Amt;
char answer = ‘Y’;
Amt = getSalesAm();

while (toupper(answer) == ‘Y’)
{
int display (int Amt, float commission, float basePay, float totalPay);
cout << «Dot it again (Y or N)»;
cin >> answer;

if (toupper(answer)== ‘Y’)
{
Amt = getSalesAmt();
}

}
return 0;
}
int getSalesAmt();
{ int Amt;
cout << «Please enter the sales amount: «;
cin >> Amt;
return Amt;
}

float calcCommission(double commission, int Amt)
{ if (Amt >= 50000)
{
commission = .02;
}
if (Amt >= 25000 and Amt <= 50000)
{
commission = .015;
}
else
{
commission = 0;
}
return commission;
}

float calcPay(float commission)
{
float totalPay;
float basePay;
basePay = 2500 * commission;
totalPay = basePay + commission;
return totalPay;
}
void displayPay( int Amt, float commission,float basePay, float totalPay);
{
cout << «Monthly Sales: $» << fixed << setprecision(2) << showpoint << Amt << endl;
cout << » Commission: $» << fixed << setprecision (2) << showpoint << commission << endl;
cout << » Base Pay: $» << fixed << setprecision (2) << showpoint << basePay << endl;
cout << » Total Pay: $» << fixed << setprecision (2) << showpoint << totalPay << endl; << endl;
}
}

===============================================================================
These are the bracket errors:

main.cpp:12:1: error: expected unqualified-id
{
^
main.cpp:32:1: error: expected unqualified-id
{ int Amt;
^
main.cpp:63:2: error: expected unqualified-id
{
^
main.cpp:69:1: error: extraneous closing brace (‘}’)
}
^

Check your function definitions — in a few cases you have a ; that shouldn’t be there, e.g.

int main(); // should be int main()

Also an extra endl and typo in function name.

1
2
3
cout << " Total Pay: $" << fixed << setprecision (2) << showpoint << totalPay << endl; << endl; // extra endl;

Amt = getSalesAm(); // typo on function name 

edit: and I think extra } at end.

Last edited on

Okay I adjusted the extra brace and the ; I am now getting these two errors that tell me that i need a ; after the Amt = getSalesAmt() and that i dont need a { before int Amt;

main.cpp:25:24: error: expected ‘;’ after expression
Amt = getSalesAmt()
^
;
main.cpp:32:1: error: expected unqualified-id
{ int Amt;
^
2 errors generated

Without syntax errors. Didn’t review it at all otherwise.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iomanip>
#include <iostream>
using namespace std;

int getSalesAmt();
float calcCommission(float comission);
float calcPay(float commission);
void displayPay(int Amt, float commission, float basePay, float totalPay);

int main() {
  int Amt;
  char answer = 'Y';
  Amt = getSalesAmt();

  while (toupper(answer) == 'Y') {
    int display(int Amt, float commission, float basePay, float totalPay);
    cout << "Dot it again (Y or N)";
    cin >> answer;

    if (toupper(answer) == 'Y') {
      Amt = getSalesAmt();
    }
  }
  return 0;
}
int getSalesAmt() {
  int Amt;
  cout << "Please enter the sales amount: ";
  cin >> Amt;
  return Amt;
}

float calcCommission(double commission, int Amt) {
  if (Amt >= 50000) {
    commission = .02;
  }
  if (Amt >= 25000 and Amt <= 50000) {
    commission = .015;
  } else {
    commission = 0;
  }
  return commission;
}

float calcPay(float commission) {
  float totalPay;
  float basePay;
  basePay = 2500 * commission;
  totalPay = basePay + commission;
  return totalPay;
}

void displayPay(int Amt, float commission, float basePay, float totalPay)
{
  cout << "Monthly Sales: $" << fixed << setprecision(2) << showpoint << Amt
       << endl;
  cout << " Commission: $" << fixed << setprecision(2) << showpoint
       << commission << endl;
  cout << " Base Pay: $" << fixed << setprecision(2) << showpoint << basePay
       << endl;
  cout << " Total Pay: $" << fixed << setprecision(2) << showpoint << totalPay
       << endl;
}

Last edited on

This is definitely not the best solution. But it gets the job done.
Things to remember:
1) Use double instead of float.
2) When you declare a function you don’t need to write variable names in:

1
2
void displayPay(int Amt, float commission, float basePay, float totalPay); // Ok.
void displayPay(int, float, float, float);                                 // Same as above. 

3) When you define a function don’t put a semicolon at the end.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void displayPay( int Amt, float commission,float basePay, float totalPay); // error.
{
        cout << "Monthly Sales: $" << fixed << setprecision(2) << showpoint << Amt << endl;
        cout << "Commission: $" << fixed << setprecision (2) << showpoint << commission << endl;
        cout << "Base Pay: $" << fixed << setprecision (2) << showpoint << basePay << endl;
        cout << "Total Pay: $" << fixed << setprecision (2) << showpoint << totalPay << endl;
}

void displayPay( int Amt, float commission,float basePay, float totalPay)  // Ok.
{
        cout << "Monthly Sales: $" << fixed << setprecision(2) << showpoint << Amt << endl;
        cout << "Commission: $" << fixed << setprecision (2) << showpoint << commission << endl;
        cout << "Base Pay: $" << fixed << setprecision (2) << showpoint << basePay << endl;
        cout << "Total Pay: $" << fixed << setprecision (2) << showpoint << totalPay << endl;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <iostream>
#include <iomanip>

using namespace std;

int getSalesAmt();
double calcCommission(int);
double calcBasePay(double);
double calcPay(double);
void displayPay(int, double, double, double);

int main()
{
        while (true)
	{
		int amt = getSalesAmt();
		cout << endl;
		double commission = calcCommission(amt);
		double base_pay = calcBasePay(commission);
		double pay = calcPay(commission);
		displayPay(amt, commission, base_pay, pay);
		cout << endl;

	repeat:
		cout << "Do it again (Y or N) ";
		char answer;
		cin >> answer;
		answer = toupper(answer);

		if (answer == 'Y')
		{
			system("CLS");
			continue;
		}
		else if (answer == 'N')
			return 0;
		else
		{
			system("CLS");
			goto repeat;
		}
	}
	return 0;
}

int getSalesAmt()
{
	cout << "Please enter the sales amount: ";
	int amt;
	cin >> amt;
	return amt;
}

double calcCommission(int amt)
{
	double commission = 0.0;

	if (amt >= 50000)
	{
		commission = .02;
	}
	else if (amt >= 25000 && amt <= 50000)
	{
		commission = .015;
	}
	else
	{
		commission = 0;
	}
	return commission;
}

double calcBasePay(double commission)
{
	double base = 2500 * commission;
	return base;
}

double calcPay(double commission)
{
	double totalPay;
	double base = 2500 * commission;
	totalPay = base + commission;
	return totalPay;
}

void displayPay(int amt, double commission, double basePay, double totalPay)
{
	cout << "Monthly Sales:tt$" << fixed << setprecision(2) << showpoint << amt << endl;
	cout << "Commission:tt$" << fixed << setprecision(2) << showpoint << commission << endl;
	cout << "Base Pay:tt$" << fixed << setprecision(2) << showpoint << basePay << endl;
	cout << "Total Pay:tt$" << fixed << setprecision(2) << showpoint << totalPay << endl;
}

Last edited on

Awesome made the corrections Appreciate the help ! Ran perfectly.

HandsomeJohn wrote:
2) When you declare a function you don’t need to write variable names in:

But the program is easier to understand if you do, so I recommend not doing that :+)

Topic archived. No new replies allowed.

Code:

#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <amxmisc> #include <nvault> #include <fun> #define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) ) //no weapon buy #define HIDE_HUD_FLASH (1<<1) // Flashlight #define PRIMARY_WEAPONS_BIT_SUM ((1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)) #define SECONDARY_WEAPONS_BIT_SUM ((2<<CSW_P228)|(2<<CSW_ELITE)|(2<<CSW_FIVESEVEN)|(CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)) #define SECONDARY_WEAPONS_BIT_USE (1<<CSW_USP|1<<CSW_DEAGLE|1<<CSW_P228|1<<CSW_DEAGLE|1<<CSW_GLOCK18|1<<CSW_ELITE) #define UsingSecondaryWeapon(%1) ((1<<get_user_weapon(%1)) & SECONDARY_WEAPONS_BIT_USE) // Ranks and skills #define maxlevel_sg 3 #define maxlevel_vm 5 #define maxlevel_hp 8 #define maxlevel_gh 3 #define maxlevel_ab 5 #define maxlevel_ap 5 #define maxlevel_sb 6 #define sg_perlevel 1 #define vm_perlevel 20 #define hp_perlevel 7 #define gh_perlevel 6 #define ab_perlevel 10 #define ap_perlevel 40 #define sb_perlevel 15 new BulletLevel[33] new ArmorLevel[33] new AbsorbLevel[33] new VampireLevel[33] new GhostLevel[33] new HealthLevel[33] new SgLevel[33] new bool:g_PlayerReseted[33] new PlayerHumanKills[33] new PlayerZombieKills[33] new PlayerHumanDeaths[33] new PlayerZombieDeaths[33] new PlayerHeadshots[33] new PlayerMedals[33] new PlayerXP[33] new PlayerLevel[33] new PlayerPoints[33] new xp_per_kill,xp_per_hs,points_per_level new const RANK[20][] = { "Eilinis", // 0 Level "Grandinis", // 1 Level "Kapralas", // 2 Level "Jaunesnysis Serzantas", // 3 Level "Burio Serzantas", // 4 Level "Puskarininkis", // 5 Level "Serzantas", // 6 Level "Vyresnysis Serzantas", // 7 Level "Vyresnysis Puskarinikis", // 8 Level "Serzantas Majoras", // 9 Level "Leitenantas", // 10 Level "Vyresnysis Leitenantas", // 11 Level "Kapitonas", // 12 Level "Majoras", // 13 Level "Pulkininkas Leitenantas", // 14 Level "Pulkininkas", // 15 Level "Brigados Generolas", // 16 Level "Generolas Majoras", // 17 Level "Generolas Leitenantas", // 18 Level "Generolas" // 19 Level } new const LEVELS[20] = { 900, // 0 level // Needed on level 1 1900, 2900, 3900, 4900, 5900, 6900, 7900, 8900, 9900, 10900, 12900, 15000, 17900, 20000, 22900, 25000, 27600, 30000, // Level 19 35000 } new const levelup[] = { "misc/levelup.wav" } // Sounds on Death new const music1[][] = { "misc/brains1.wav", "misc/brains2.wav", "misc/brains3.wav", "misc/brains4.wav" } new const music2[][] = { "misc/brains5.wav", "misc/brains6.wav", "misc/brains7.wav", "misc/brains8.wav", "misc/brains9.wav", "misc/brains10.wav", "misc/brains11.wav", "misc/brains12.wav" } // Flashlight new light_enable,light_r,light_g,light_b,light_radius new gmsg_hideweapon // Screen Fade new screen_fade_enable new screen_r,screen_g,screen_b // Glow on kill new glowonkilling_enable new glow_r,glow_g,glow_b,glow_time // Other new weapon_enable new death_msg_enable new blockbuyzone_enable new save_xp_by new g_maxplayers new sg_enable new vm_enable new hp_enable new gh_enable new ab_enable new ap_enable new sb_enable new iKills[33] public plugin_init() { register_plugin( "Zombie-Mod-Misc-Stuff", "1.3", "xbatista") weapon_enable = register_cvar("zmisc_weapons","1") // Enable weapons menu on spawn? 1 = Yes, 0 = No. death_msg_enable = register_cvar("zmisc_dmsg","1") // Enable Death messages and sounds? 1 = Yes, 0 = No. save_xp_by = register_cvar("zmisc_save_xp_by","1") // Save XP by? 1 = IP, 2 = SteamID. blockbuyzone_enable = register_cvar("zmisc_blockbuyzone","1") // Enable Block buyzone? 1 = Yes, 0 = No. light_enable = register_cvar("zmisc_light","1") // Enable light around player? 1 = Yes, 0 = No. light_radius = register_cvar("zmisc_light_radius","28") // Around player light radius. light_r = register_cvar("zmisc_light_red","255") // light color R light_g = register_cvar("zmisc_light_green","250") // light color G light_b = register_cvar("zmisc_light_blue","255") // light color B screen_fade_enable = register_cvar("zmisc_screen_fade","1") // Enable screen fade? 1 = Yes, 0 = No. screen_r = register_cvar("zmisc_screen_red","255") // Screen fade color R screen_g = register_cvar("zmisc_screen_green","0") // Screen fade color G screen_b = register_cvar("zmisc_screen_blue","0") // Screen fade color B glowonkilling_enable = register_cvar("zmisc_glow_kill","1") // Enable glow on you when you killed someone? 1 = Yes, 0 = No. glow_time = register_cvar("zmisc_glow_time","5.0") // How much time you will glow when you killed someone? glow_r = register_cvar("zmisc_glow_red","255") // glow color R glow_g = register_cvar("zmisc_glow_green","20") // glow color G glow_b = register_cvar("zmisc_glow_blue","0") // glow color B xp_per_kill = register_cvar("zmisc_xp","10") // How much xp gain per kill? xp_per_hs = register_cvar("zmisc_xp_hs","5") // How much bonus xp gain per hs? points_per_level = register_cvar("zmisc_pts_per_level","1") // How much points you gain when level up? sg_enable = register_cvar("zmisc_sg","1") // Enable SmokeGrenade Level? 1 = Yes, 0 = No. vm_enable = register_cvar("zmisc_vm","1") // Enable Vampire Level? 1 = Yes, 0 = No. hp_enable = register_cvar("zmisc_hp","1") // Enable Health Level? 1 = Yes, 0 = No. gh_enable = register_cvar("zmisc_gh","1") // Enable Ghost Level? 1 = Yes, 0 = No. ab_enable = register_cvar("zmisc_ab","1") // Enable Absorbation Level? 1 = Yes, 0 = No. ap_enable = register_cvar("zmisc_ap","1") // Enable Armor Level? 1 = Yes, 0 = No. sb_enable = register_cvar("zmisc_sb","1") // Enable SilverBullet Level? 1 = Yes, 0 = No. register_clcmd("say_team /zmrank", "showrank") register_clcmd("say_team zmrank", "showrank") register_clcmd("say /zmrank", "showrank") register_clcmd("say zmrank", "showrank") register_clcmd("say upct", "Upgrades") register_clcmd("say /upct", "Upgrades") register_clcmd("say_team upct", "Upgrades") register_clcmd("say_team /upct", "Upgrades") register_clcmd("say upt", "Upgrades2") register_clcmd("say /upt", "Upgrades2") register_clcmd("say_team upt", "Upgrades2") register_clcmd("say_team /upt", "Upgrades2") register_clcmd("say rp", "ResetPoints") register_clcmd("say /rp", "ResetPoints") //Events// register_event("DeathMsg", "event_deathmsg", "a") register_event("StatusValue", "StatusValue_on_alive", "be", "1=2") register_event("CurWeapon", "ev_CurWeapon", "be","1=1") register_event("HLTV", "ev_NewRound", "a", "1=0", "2=0"); register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon") RegisterHam(Ham_TakeDamage, "player", "TakeDamage", 1) RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1) //Forwards// register_forward(FM_CmdStart,"fwCmdStart" ) register_forward(FM_PlayerPreThink, "preThink") g_maxplayers = get_maxplayers() gmsg_hideweapon = get_user_msgid("HideWeapon") } public client_authorized(id) { LoadRank(id) } public client_disconnect(id) { iKills[id] = 0 SaveRank(id) } public stopglow(id) { fm_set_rendering(id) } public ev_NewRound() { for(new i = 1 ; i <= g_maxplayers ; i++) { if(is_user_connected(i)) { if (iKills[i] == random_num(4,7)) { PlayerMedals[i] += 1 static name[32] ; get_user_name(i, name, charsmax(name)); client_printcolor(0, "/g[/yZombie Misc/g] /ySurvivor /ctr%s /ygot /g%d /ya medal for a honor.", name, iKills[i]) } iKills[i] = 0 } } } public event_deathmsg() { new g_attacker = read_data(1) new g_victim = read_data(2) new g_headshot = read_data(3) new attacker_msg[32] new victim_msg[32] get_user_name(g_attacker, attacker_msg, 31) get_user_name(g_victim, victim_msg, 31) static iAtt ; iAtt = read_data(1) if(PlayerXP[g_attacker] >= LEVELS[PlayerLevel[g_attacker]]) { PlayerLevel[g_attacker] += 1 PlayerPoints[g_attacker] += get_pcvar_num(points_per_level) client_cmd(g_attacker, "spk %s", levelup) client_printcolor(g_attacker, "/g[/yZombie Misc/g] /yCongratulations! You gained level /g%i!", PlayerLevel[g_attacker]) SaveRank(g_attacker) } if(g_attacker != g_victim) { if (get_pcvar_num(glowonkilling_enable) == 1) { fm_set_rendering(g_attacker, kRenderFxGlowShell, get_pcvar_num(glow_r), get_pcvar_num(glow_g), get_pcvar_num(glow_b), kRenderNormal,25) set_task(get_pcvar_float(glow_time), "stopglow", g_attacker) if (get_pcvar_num(gh_enable) == 1) { set_task(get_pcvar_float(glow_time) + 1.0, "GhostLvL", g_attacker) } } if(PlayerXP[g_attacker] <= 34980) { PlayerXP[g_attacker] += get_pcvar_num(xp_per_kill) } if (get_user_team(g_attacker) == 2) // ct killed t { if((1 <= iAtt <= g_maxplayers)) { iKills[iAtt]++; } if(get_pcvar_num(death_msg_enable) == 1) { set_hudmessage(0, 5, 255, 0.01, 0.31, 1, 0.01, 3.0, 0.01, 0.01, 2) show_hudmessage(0, "%s has been owned by %s!", victim_msg, attacker_msg) client_cmd( 0, "spk %s", music2[random_num(0,sizeof music2 - 1)]) } PlayerZombieDeaths[g_victim] += 1 PlayerZombieKills[g_attacker] += 1 } if (get_user_team(g_attacker) == 1) // t killed ct { if(get_pcvar_num(death_msg_enable) == 1) { set_hudmessage(255, 0, 10, 0.01, 0.21, 1, 0.01, 3.0, 0.01, 0.01, 3) show_hudmessage(0, "%s's brains has been eaten by %s!", victim_msg, attacker_msg) client_cmd( 0, "spk %s", music1[random_num(0,sizeof music1 - 1)]) } PlayerHumanDeaths[g_victim] += 1 PlayerHumanKills[g_attacker] += 1 } if(g_headshot) { if(PlayerXP[g_attacker] <= 34980) { PlayerXP[g_attacker] += get_pcvar_num(xp_per_hs) } PlayerHeadshots[g_attacker] += 1 } } } public skill(id) { if(PlayerLevel[id] == 1) // Checks level. { give_item(id,"weapon_glock18"); // Give yourself glock18 at level 1 client_cmd (id, "slot2; drop") } if(PlayerLevel[id] == 2) // Checks level. { give_item(id,"weapon_usp"); // Give yourself usp at level 2 client_cmd (id, "slot2; drop") } if(PlayerLevel[id] == 3) // Checks level. { give_item(id,"weapon_p228"); // Give yourself p228 at level 3 client_cmd (id, "slot2; drop") } if(PlayerLevel[id] == 4) // Checks level. { give_item(id,"weapon_fiveseven"); // Give yourself fiveseven at level 4 client_cmd (id, "slot2; drop") } if(PlayerLevel[id] == 5) // Checks level. { give_item(id,"weapon_tmp"); // Give yourself tmp at level 5 client_cmd (id, "slot1; drop") } if(PlayerLevel[id] == 6) // Checks level. { give_item(id,"weapon_mp5"); // Give yourself mp5 at level 6 client_cmd (id, "slot1; drop") } } public Message_StatusIcon(iMsgId, MSG_DEST, id) { static szIcon[5] get_msg_arg_string(2, szIcon, 4) if( szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z' ) { if( get_msg_arg_int(1) && get_pcvar_num(blockbuyzone_enable) == 1 ) { fm_cs_set_user_nobuy(id) return PLUGIN_HANDLED } } return PLUGIN_CONTINUE } public Upgrades(id) { if (!is_user_alive(id)) return new menu = menu_create("yUpgrades for Survivors:", "upgrades_handle") if (get_pcvar_num(sg_enable) == 1) { new sgmsg[60] format(sgmsg, 59, "wSmokeGrenade Level (%d/%d)", SgLevel[id], maxlevel_sg) menu_additem(menu, sgmsg, "1", 0) } if (get_pcvar_num(hp_enable) == 1) { new hpmsg[60] format(hpmsg, 59, "wHealth Level (%d/%d)", HealthLevel[id], maxlevel_hp) menu_additem(menu, hpmsg, "2", 0) } if (get_pcvar_num(sb_enable) == 1) { new sbmsg[60] format(sbmsg, 59, "wSilver Bullet Level (%d/%d)", BulletLevel[id], maxlevel_sb) menu_additem(menu, sbmsg, "3", 0) } if(PlayerLevel[id] >= 7 && get_pcvar_num(ab_enable) == 1) { new abmsg[60] format(abmsg, 59, "wAbsorbation Level (%d/%d)", AbsorbLevel[id], maxlevel_ab) menu_additem(menu, abmsg, "4", 0) } if(PlayerLevel[id] >= 4 && get_pcvar_num(ap_enable) == 1) { new apmsg[60] format(apmsg, 59, "wArmor Level (%d/%d)", ArmorLevel[id], maxlevel_ap) menu_additem(menu, apmsg, "5", 0) } menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu, 0) } public upgrades_handle(id, menu, item) { if (item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED } new data[6], iName[64] new access, callback menu_item_getinfo(menu, item, access, data,5, iName, 63, callback) new key = str_to_num(data) switch(key) { case 1:{ if(PlayerPoints[id] > 0) { if(SgLevel[id] >= maxlevel_sg) { return PLUGIN_HANDLED } SgLevel[id] += 1 client_printcolor(id, "/g+1 /yto SmokeGrenades Level") PlayerPoints[id] -= 1 Upgrades(id) } } case 2:{ if(PlayerPoints[id] > 0) { if(HealthLevel[id] >= maxlevel_hp) { return PLUGIN_HANDLED } HealthLevel[id] += 1 client_printcolor(id, "/g+1 /yto Health Level") PlayerPoints[id] -= 1 Upgrades(id) } } case 3:{ if(PlayerPoints[id] > 0) { if(BulletLevel[id] >= maxlevel_sb) { return PLUGIN_HANDLED } BulletLevel[id] += 1 client_printcolor(id, "/g+1 /yto Silver Bullet Level") PlayerPoints[id] -= 1 Upgrades(id) } } case 4:{ if(PlayerPoints[id] > 0) { if(AbsorbLevel[id] >= maxlevel_ab) { return PLUGIN_HANDLED } AbsorbLevel[id] += 1 client_printcolor(id, "/g+1 /yto Absorbation Level") PlayerPoints[id] -= 1 Upgrades(id) } } case 5:{ if(PlayerPoints[id] > 0) { if(ArmorLevel[id] >= maxlevel_ap) { return PLUGIN_HANDLED } ArmorLevel[id] += 1 client_printcolor(id, "/g+1 /yto Armor Level") PlayerPoints[id] -= 1 Upgrades(id) } } } menu_destroy(menu) return PLUGIN_HANDLED } public Upgrades2(id) { if (!is_user_alive(id)) return new menu = menu_create("yUpgrades for Monsters:", "upgrades_handle2") if (get_pcvar_num(vm_enable) == 1) { new vmmsg[60] format(vmmsg, 59, "wVampire Level (%d/%d)", VampireLevel[id], maxlevel_vm) menu_additem(menu, vmmsg, "1", 0) } if (get_pcvar_num(gh_enable) == 1) { new ghmsg[60] format(ghmsg, 59, "wGhost Level (%d/%d)", GhostLevel[id], maxlevel_gh) menu_additem(menu, ghmsg, "2", 0) } menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, menu, 0) } public upgrades_handle2(id, menu, item) { if (item == MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED } new data[6], iName[64] new access, callback menu_item_getinfo(menu, item, access, data,5, iName, 63, callback) new key = str_to_num(data) switch(key) { case 1:{ if(PlayerPoints[id] > 0) { if(VampireLevel[id] >= maxlevel_vm) { return PLUGIN_HANDLED } VampireLevel[id] += 1 client_printcolor(id, "/g+1 /yto Vampire Level") PlayerPoints[id] -= 1 Upgrades2(id) } } case 2:{ if(PlayerPoints[id] > 0) { if(GhostLevel[id] >= maxlevel_gh) { return PLUGIN_HANDLED } GhostLevel[id] += 1 client_printcolor(id, "/g+1 /yto Ghost Level") PlayerPoints[id] -= 1 Upgrades2(id) } } } menu_destroy(menu) return PLUGIN_HANDLED } public ResetPoints(id) { g_PlayerReseted[id] = true client_printcolor(id, "/ctrYour points will be reseted next time when you spawn!") } public GhostLvL(id) { if (GhostLevel[id] > 0 && get_pcvar_num(gh_enable) == 1) { fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 100 - GhostLevel[id] * gh_perlevel) } } public fw_PlayerSpawn(id) { if (is_user_alive(id)) { set_task(0.2, "show_level1", id, "", 0, "b") set_task(0.2, "show_level2", id, "", 0, "b") if(g_PlayerReseted[id]) { new iPoints = SgLevel[id] + VampireLevel[id] + GhostLevel[id] + HealthLevel[id] + AbsorbLevel[id] + ArmorLevel[id] + BulletLevel[id] PlayerPoints[id] += iPoints SgLevel[id] = 0 VampireLevel[id] = 0 GhostLevel[id] = 0 HealthLevel[id] = 0 AbsorbLevel[id] = 0 ArmorLevel[id] = 0 BulletLevel[id] = 0 client_printcolor(id, "/ctrYour Points has been reseted!") g_PlayerReseted[id] = false } if (user_has_weapon(id,CSW_USP)) { ham_strip_weapon(id,"weapon_usp") } if (GhostLevel[id] == 0 && get_pcvar_num(gh_enable) == 1) { fm_set_rendering(id) } if (get_user_team(id) == 1) { if (GhostLevel[id] > 0 && get_pcvar_num(gh_enable) == 1) { fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 100 - GhostLevel[id] * gh_perlevel) } } if (get_user_team(id) == 2) { engclient_cmd(id, "weapon_knife") if (ArmorLevel[id] > 0 && get_pcvar_num(ap_enable) == 1) { new iArmor = get_user_armor(id) fm_set_user_armor(id, iArmor + ArmorLevel[id] * ap_perlevel) } if (HealthLevel[id] > 0 && get_pcvar_num(hp_enable) == 1) { new get_health = get_user_health(id) fm_set_user_health(id, get_health + HealthLevel[id] * hp_perlevel) } if (get_pcvar_num(weapon_enable) == 1) { set_task(1.0, "Primary", id) } } } } public ev_CurWeapon(id) { if (!is_user_alive(id)) return if(get_pcvar_num(light_enable) == 1 && get_user_team(id) == 2) { message_begin(MSG_ONE, gmsg_hideweapon, _ , id) write_byte(HIDE_HUD_FLASH) message_end() } } public fwCmdStart( id, uc_handle, seed ) { if( get_uc( uc_handle, UC_Impulse ) == 100 ) { if(get_pcvar_num(light_enable) == 1) { set_uc( uc_handle, UC_Impulse, 0 ); return FMRES_HANDLED } } return FMRES_IGNORED } public preThink(id) { if(get_pcvar_num(light_enable) == 1) { if(is_user_alive(id) && get_user_team(id) == 2) { static Float:light_origin[3] // get origin pev(id,pev_origin,light_origin) message_begin(MSG_BROADCAST,SVC_TEMPENTITY) write_byte(27) // TE_DLIGHT Dinamic light engfunc(EngFunc_WriteCoord,light_origin[0]) // X engfunc(EngFunc_WriteCoord,light_origin[1]) // Y engfunc(EngFunc_WriteCoord,light_origin[2]) // Z write_byte(get_pcvar_num(light_radius)) // radius write_byte(get_pcvar_num(light_r)) // R write_byte(get_pcvar_num(light_g)) // G write_byte(get_pcvar_num(light_b)) // B write_byte(1) // life write_byte(0) // decay rate message_end() } } } public Fadex(index,red,green,blue,alpha) { message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{0,0,0},index); write_short(6<<10) write_short(5<<10) write_short(1<<12) write_byte(red) write_byte(green) write_byte(blue) write_byte(alpha) message_end() } public TakeDamage(i_Victim, i_Inflictor, i_Attacker, Float:damage) { new get_health_a = get_user_health(i_Attacker) new get_health_v = get_user_health(i_Victim) new ateam = get_user_team(i_Attacker) if(VampireLevel[i_Attacker] > 0 && is_user_connected(i_Attacker) && get_user_team ( i_Victim ) != get_user_team ( i_Attacker ) && get_user_team(i_Attacker) == 1 && get_pcvar_num(vm_enable) == 1) { fm_set_user_health(i_Attacker, get_health_a + VampireLevel[i_Attacker] * vm_perlevel) } if(AbsorbLevel[i_Victim] > 0 && is_user_connected(i_Victim) && get_user_team ( i_Victim ) != get_user_team ( i_Attacker ) && get_user_team(i_Attacker) == 1 && get_pcvar_num(ab_enable) == 1 && PlayerLevel[i_Victim] >= 7) { fm_set_user_health(i_Victim, get_health_v + floatround(((damage / 100) * (AbsorbLevel[i_Victim] * ab_perlevel)))) } if(BulletLevel[i_Attacker] > 0 && is_user_connected(i_Attacker) && get_user_team(i_Victim) != ateam || ateam == 2 && get_pcvar_num(sb_enable) == 1 && UsingSecondaryWeapon(i_Attacker)) { if (get_health_v >= 750) { fm_set_user_health(i_Victim, get_health_v - floatround(((damage / 100) * (BulletLevel[i_Attacker] * sb_perlevel)))) } } if ( ( 1 <= i_Victim <= g_maxplayers) && get_user_team ( i_Victim ) != get_user_team ( i_Attacker ) && get_pcvar_num(screen_fade_enable) == 1 ) { if(is_user_connected(i_Victim)) { Fadex(i_Victim,get_pcvar_num(screen_r),get_pcvar_num(screen_g),get_pcvar_num(screen_b),170) } } } public showrank(id) { new szMotd[2048], szTitle[64], iPos = 0 format(szTitle, 63, "Zombie Mod Misc Stats") iPos += format(szMotd[iPos], 2047-iPos, "<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>") iPos += format(szMotd[iPos], 2047-iPos, "^n^n<b>Your Stats:</b>^n^n") iPos += format(szMotd[iPos], 2047-iPos, "Humans killed - <b>%i</b>^n", PlayerHumanKills[id]) iPos += format(szMotd[iPos], 2047-iPos, "Zombies killed - <b>%i</b>^n", PlayerZombieKills[id]) iPos += format(szMotd[iPos], 2047-iPos, "Total Kills - <b>%i</b>^n", PlayerHumanKills[id] + PlayerZombieKills[id]) iPos += format(szMotd[iPos], 2047-iPos, "Deaths being Human - <b>%i</b>^n", PlayerHumanDeaths[id]) iPos += format(szMotd[iPos], 2047-iPos, "Deaths being Zombie - <b>%i</b>^n", PlayerZombieDeaths[id]) iPos += format(szMotd[iPos], 2047-iPos, "Total deaths - <b>%i</b>^n", PlayerHumanDeaths[id] + PlayerZombieDeaths[id]) iPos += format(szMotd[iPos], 2047-iPos, "Headshots done - <b>%i</b>^n", PlayerHeadshots[id]) iPos += format(szMotd[iPos], 2047-iPos, "Medals for honor - <b>%i</b>", PlayerMedals[id]) show_motd(id, szMotd, szTitle) return PLUGIN_HANDLED } public show_level1(id) { if (is_user_alive(id)) { if (get_user_team(id) == 1) { set_hudmessage(0, 255, 0, 0.17, 0.05, 0, 0.01, 3.0, 0.01, 0.01, 10) show_hudmessage(id, "[XP:%i/%i]^n[Points:%i]", PlayerXP[id], LEVELS[PlayerLevel[id]], PlayerPoints[id]) } } } public show_level2(id) { if (is_user_alive(id)) { if (get_user_team(id) == 2) { set_hudmessage(0, 255, 0, 0.17, 0.05, 0, 0.01, 3.0, 0.01, 0.01, 10) show_hudmessage(id, "[Rank:%s]^n[XP:%i/%i]^n[Points:%i]", RANK[PlayerLevel[id]], PlayerXP[id], LEVELS[PlayerLevel[id]], PlayerPoints[id]) } } } public StatusValue_on_alive(id) { new target, body; get_user_aiming(id, target, body); if( (1 <= target <= g_maxplayers) && get_pdata_int(id, 114) == get_pdata_int(target, 114) ) { new sName[32] new target = read_data(2) get_user_name(target, sName, 31) if (get_user_team(target) == 2) { set_hudmessage(0, 40, 255, -1.0, 0.60, 1, 0.01, 1.5, 0.01, 0.01, 11) show_hudmessage(id, "%s is %s", sName, RANK[PlayerLevel[target]]) } } } ///Save ranks/// SaveRank(id) { if(get_pcvar_num(save_xp_by) == 1) { new authip[32] get_user_ip(id,authip,31,1) new vaultkey[64], vaultdata[64] format(vaultkey, 63, "UserIP:%s-HumansKills", authip) format(vaultdata, 63, "%d", PlayerHumanKills[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-ZombieKills", authip) format(vaultdata, 63, "%d", PlayerZombieKills[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-HumanDeaths", authip) format(vaultdata, 63, "%d", PlayerHumanDeaths[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-ZombieDeaths", authip) format(vaultdata, 63, "%d", PlayerZombieDeaths[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-Headshots", authip) format(vaultdata, 63, "%d", PlayerHeadshots[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-XP", authip) format(vaultdata, 63, "%d", PlayerXP[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-Level", authip) format(vaultdata, 63, "%d", PlayerLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-Points", authip) format(vaultdata, 63, "%d", PlayerPoints[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-SgLevel", authip) format(vaultdata, 63, "%d", SgLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-VampireLevel", authip) format(vaultdata, 63, "%d", VampireLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-HealthLevel", authip) format(vaultdata, 63, "%d", HealthLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-GhostLevel", authip) format(vaultdata, 63, "%d", GhostLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-MedalsLevel", authip) format(vaultdata, 63, "%d", PlayerMedals[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-AbsorbationLevel", authip) format(vaultdata, 63, "%d", AbsorbLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-ArmorLevel", authip) format(vaultdata, 63, "%d", ArmorLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserIP:%s-BulletLevel", authip) format(vaultdata, 63, "%d", BulletLevel[id]) set_vaultdata(vaultkey, vaultdata) } if(get_pcvar_num(save_xp_by) == 2) { new authid[32] get_user_authid(id, authid, 31) new vaultkey[64], vaultdata[64] format(vaultkey, 63, "UserID:%s-HumansKills", authid) format(vaultdata, 63, "%d", PlayerHumanKills[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-ZombieKills", authid) format(vaultdata, 63, "%d", PlayerZombieKills[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-HumanDeaths", authid) format(vaultdata, 63, "%d", PlayerHumanDeaths[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-ZombieDeaths", authid) format(vaultdata, 63, "%d", PlayerZombieDeaths[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-Headshots", authid) format(vaultdata, 63, "%d", PlayerHeadshots[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-XP", authid) format(vaultdata, 63, "%d", PlayerXP[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-Level", authid) format(vaultdata, 63, "%d", PlayerLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-Points", authid) format(vaultdata, 63, "%d", PlayerPoints[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-SgLevel", authid) format(vaultdata, 63, "%d", SgLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-VampireLevel", authid) format(vaultdata, 63, "%d", VampireLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-HealthLevel", authid) format(vaultdata, 63, "%d", HealthLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-GhostLevel", authid) format(vaultdata, 63, "%d", GhostLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-MedalsLevel", authid) format(vaultdata, 63, "%d", PlayerMedals[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-AbsorbationLevel", authid) format(vaultdata, 63, "%d", AbsorbLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-ArmorLevel", authid) format(vaultdata, 63, "%d", ArmorLevel[id]) set_vaultdata(vaultkey, vaultdata) format(vaultkey, 63, "UserID:%s-BulletLevel", authid) format(vaultdata, 63, "%d", BulletLevel[id]) set_vaultdata(vaultkey, vaultdata) } } ///Load Ranks/// LoadRank(id) { if(get_pcvar_num(save_xp_by) == 1) { new authip[32] get_user_ip(id,authip,31,1) new vaultkey[64], vaultdata[64] format(vaultkey, 63, "UserIP:%s-HumansKills", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerHumanKills[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-ZombieKills", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerZombieKills[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-HumanDeaths", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerHumanDeaths[id] = str_to_num(vaultdata)   format(vaultkey, 63, "UserIP:%s-ZombieDeaths", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerZombieDeaths[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-Headshots", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerHeadshots[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-XP", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerXP[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-Level", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-Points", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerPoints[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-SgLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) SgLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-VampireLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) VampireLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-HealthLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) HealthLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-GhostLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) GhostLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-MedalsLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) PlayerMedals[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-AbsorbationLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) AbsorbLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-ArmorLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) ArmorLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserIP:%s-BulletLevel", authip) get_vaultdata(vaultkey, vaultdata, 63) BulletLevel[id] = str_to_num(vaultdata) } if(get_pcvar_num(save_xp_by) == 2) { new authid[32] get_user_authid(id, authid, 31) new vaultkey[64], vaultdata[64] format(vaultkey, 63, "UserID:%s-HumansKills", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerHumanKills[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-ZombieKills", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerZombieKills[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-HumanDeaths", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerHumanDeaths[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-ZombieDeaths", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerZombieDeaths[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-Headshots", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerHeadshots[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-XP", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerXP[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-Level", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-Points", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerPoints[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-SgLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) SgLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-VampireLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) VampireLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-HealthLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) HealthLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-GhostLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) GhostLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-MedalsLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) PlayerMedals[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-AbsorbationLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) AbsorbLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-ArmorLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) ArmorLevel[id] = str_to_num(vaultdata) format(vaultkey, 63, "UserID:%s-BulletLevel", authid) get_vaultdata(vaultkey, vaultdata, 63) BulletLevel[id] = str_to_num(vaultdata) } } public plugin_precache() { precache_sound("misc/brains1.wav") precache_sound("misc/brains2.wav") precache_sound("misc/brains3.wav") precache_sound("misc/brains4.wav") precache_sound("misc/brains5.wav") precache_sound("misc/brains6.wav") precache_sound("misc/brains7.wav") precache_sound("misc/brains8.wav") precache_sound("misc/brains9.wav") precache_sound("misc/brains10.wav") precache_sound("misc/brains11.wav") precache_sound("misc/brains12.wav") precache_sound(levelup) } // ============================================================// // [ Stocks ] // // ============================================================// stock client_printcolor(const id, const input[], any:...) { new msg[191], players[32], count = 1; vformat(msg,190,input,3); replace_all(msg,190,"/g","^4");// green clr replace_all(msg,190,"/y","^1");// orange clr replace_all(msg,190,"/ctr","^3");// team clr if (id) players[0] = id; else get_players(players,count,"ch"); for (new i=0;i<count;i++) if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, 76, _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } stock fm_give_item(index, const item[]) { if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10)) return 0 new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return 0 new Float:origin[3] pev(index, pev_origin, origin) set_pev(ent, pev_origin, origin) set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN) dllfunc(DLLFunc_Spawn, ent) new save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, index) if (pev(ent, pev_solid) != save) return ent engfunc(EngFunc_RemoveEntity, ent) return -1 } stock fm_set_user_bpammo(id, iWeapon, iAmount) { new iOffset; switch(iWeapon) { case CSW_AWP: iOffset = 377; case CSW_SCOUT, CSW_AK47, CSW_G3SG1: iOffset = 378; case CSW_M249: iOffset = 379; case CSW_FAMAS, CSW_M4A1, CSW_AUG, CSW_SG550, CSW_GALI, CSW_SG552: iOffset = 380; case CSW_M3, CSW_XM1014: iOffset = 381; case CSW_USP, CSW_UMP45, CSW_MAC10: iOffset = 382; case CSW_FIVESEVEN, CSW_P90: iOffset = 383; case CSW_DEAGLE: iOffset = 384; case CSW_P228: iOffset = 385; case CSW_GLOCK18, CSW_MP5NAVY, CSW_TMP, CSW_ELITE: iOffset = 386; case CSW_FLASHBANG: iOffset = 387; case CSW_HEGRENADE: iOffset = 388; case CSW_SMOKEGRENADE: iOffset = 389; case CSW_C4: iOffset = 390; default:return; } set_pdata_int(id, iOffset, iAmount); } stock ham_strip_weapon(id,weapon[]) { if(!equal(weapon,"weapon_",7)) return 0; new wId = get_weaponid(weapon); if(!wId) return 0; new wEnt; while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {} if(!wEnt) return 0; if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt); if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0; ExecuteHamB(Ham_Item_Kill,wEnt); set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId)); // this block should be used for Counter-Strike: /*if(wId == CSW_C4) { cs_set_user_plant(id,0,0); cs_set_user_bpammo(id,CSW_C4,0); } else if(wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE) cs_set_user_bpammo(id,wId,0);*/ return 1; } stock drop_secondary(id) { new weapons[32], num get_user_weapons(id, weapons, num) for (new i = 0; i < num; i++) { if (SECONDARY_WEAPONS_BIT_SUM & (2<<weapons[i])) { static wname[32] get_weaponname(weapons[i], wname, sizeof wname - 1) engclient_cmd(id, "drop", wname) } } } stock drop_primary(id) { new weapons[32], num get_user_weapons(id, weapons, num) for (new i = 0; i < num; i++) { if (PRIMARY_WEAPONS_BIT_SUM & (1<<weapons[i])) { static wname[32] get_weaponname(weapons[i], wname, sizeof wname - 1) engclient_cmd(id, "drop", wname) } } } stock fm_set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16) { set_pev(index, pev_renderfx, fx); new Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(index, pev_rendercolor, RenderColor); set_pev(index, pev_rendermode, render); set_pev(index, pev_renderamt, float(amount)); return 1; } stock fm_set_user_health(index, health) { health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index); return 1; } stock fm_set_user_armor(index, armor) { set_pev(index, pev_armorvalue, float(armor)); return 1; }

Compiles without errors and warnings
But I don’t know if this will work. Didn’t tested it.


Closed

Bug 1497377


Opened 4 years ago
Closed 4 years ago

Categories

(MailNews Core :: Security: S/MIME, enhancement)

Tracking

(thunderbird63 wontfix, thunderbird64 fixed)

Tracking Status
thunderbird63 wontfix
thunderbird64 fixed

People

(Reporter: jsbruner, Assigned: jsbruner)

Details

Attachments

(1 file)

The port of bug 1468225 in bug 1483403 accidentally added an extra '}' in msgReadSecurityInfo.js's viewCertHelper().
Removes the extraneous brace.
Actually, was it still working and the extra brace "only" caused a JS error but was essentially ignored?

Target Milestone: — → Thunderbird 64.0

You need to log in
before you can comment on or make changes to this bug.

Понравилась статья? Поделить с друзьями:
  • Error extracting msi 32
  • Error extra qualification on member
  • Error extension manager init failed status 193 zxp installer
  • Error expression or statement is incorrect possibly unbalanced or
  • Error expression must have pointer to object type