Warning 217 loose indentation как исправить

else if(pickupid == lspic[0]) { SetPlayerInterior(playerid,0); SetPlayerPos(playerid,1658.2383,-1693.4553,15.6094); SetPlayerFacingAn...


#1

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

Отправлено 24 июня 2013 — 03:50

  • Новичок
	else if(pickupid == lspic[0])
	{
		SetPlayerInterior(playerid,0);
		SetPlayerPos(playerid,1658.2383,-1693.4553,15.6094);
		SetPlayerFacingAngle(playerid,175.8234);
		SetPlayerVirtualWorld(playerid,0);
	}

Проблема, собственно, в строке:

else if(pickupid == lspic[0])

Как только не выравнивал, все равно варнинг. И по примеру других модов и по мануалам, не помогает. Да и выровнено вроде правильно, не пойму в чем проблема. Варнинг вроде и один и не очень важный, но хотелось бы понять почему не исправляется и исправить.

Ну и скрин еще:

0



#2

Отправлено 24 июня 2013 — 16:17

  • Профессионал

Табуляция отсутствует.

Выровняй код лесенкой.

И ещё смотри чтобы выше было так же выровнено или наоборот ниже по примеру что выше…

1



#3

Отправлено 24 июня 2013 — 17:16

  • Новичок

Просмотр сообщенияiRusel (24 июня 2013 — 16:17) писал:

Табуляция отсутствует.

Выровняй код лесенкой.

И ещё смотри чтобы выше было так же выровнено или наоборот ниже по примеру что выше…

Отредактируй тогда, пожалуйста, как правильно, выше и ниже, в подобных кодах, такая же табуляция. И я же говорю, с других модов брал этот код, где нет варнингов, все равно не убирается варн

0



#4

Отправлено 24 июня 2013 — 17:21

  • Профессионал

В других модах может присутствовать #pragma tabsize 0

0



#5

Отправлено 24 июня 2013 — 18:30

  • Новичок

iRusel, вот только что проверил на моде без tabsize 0, нету варнингов, вот код оттуда:

	else if(pickupid == lspic[0])
	{
		SetPlayerInterior(playerid,0);
		SetPlayerPosAc(playerid, 1658.2383, -1693.4553, 15.6094);
		SetPlayerFacingAngle(playerid, 175.8234);
		SetPlayerVirtualWorld(playerid, 0);
	}

0



#6

Отправлено 24 июня 2013 — 21:51

  • Илья

Да просто #pragma tabsize 0 после инклюдов и пофиг будет на лесенку моду.

Сообщение отредактировал Killix: 24 июня 2013 — 21:53

0



#7

Отправлено 24 июня 2013 — 21:58

  • Профессионал

Просмотр сообщенияKillix (24 июня 2013 — 21:51) писал:

Да просто #pragma tabsize 0 после инклюдов и пофиг будет на лесенку моду.

Ну не скажи, прагма лишь скрывает сообщения о варнингах а так…
Это аналогично тому что прикрыть бесконечно кровоточащую рану подорожником и говорить что кровь остановлена…

0



#8

Отправлено 24 июня 2013 — 22:03

  • Илья

Просмотр сообщенияiRusel (24 июня 2013 — 21:58) писал:

Ну не скажи, прагма лишь скрывает сообщения о варнингах а так…
Это аналогично тому что прикрыть бесконечно кровоточащую рану подорожником и говорить что кровь остановлена…

Не стоит недооценивать мощь подорожника.

0



#9

Отправлено 25 июня 2013 — 16:02

  • Новичок

Ну #pragma tabsize 0 я б и сам поставил, но хочется разобраться, почему так. Что, нету никого, кто мог бы подсказать в чем проблема?

0



#10

Отправлено 25 июня 2013 — 16:11

  • Пользователь

Просмотр сообщенияDinho (25 июня 2013 — 16:02) писал:

Ну #pragma tabsize 0 я б и сам поставил, но хочется разобраться, почему так. Что, нету никого, кто мог бы подсказать в чем проблема?

Тебе же сказали что ты код криво сделал он должен быть лесенкой
#pragma tabsize 0 — не ставь это,или будет лагать жестко.У тебя будут варнинги и ты их видить не будешь из-за нее.

Сообщение отредактировал Nazi: 25 июня 2013 — 16:12

0


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

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


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

Hosse

Hosse

Заблокирован

Регистрация
17 Ноя 2011
Сообщения
613
Лучшие ответы
0
Репутация
224

  • #1

Начинающие осваивать pawno задавали не однократно вопрос «как исправить warning 217?».Пишу это для вас
Сам варнинг выглядит так:

HTML:

warning 217: loose indentation

Давайте разберём что тут написано:

HTML:

warning 217: loose indentation - невыровненная строка (return должен быть строго под телом функции по левому краю, либо можно добавить в начало мода строку #pragma tabsize 0, но это не рекомендуется, так как иногда может не понимать и не прочитывать скобки "{" и "}");

Теперь объясняю примерно (у меня было так):
Вот мой варнинг:

HTML:

pwn(6247) : warning 217: loose indentation

Вот сами строки с варнингом:

HTML:

{
             PutPlayerInVehicle(playerid, marshrutka, 0); // Зажаем NPC В созданую для него машину
              SetPlayerSkin(playerid, 253);
               PlayerInfo[playerid][pCarLic] = 1;//даем лицензию
               return 1;
        }

Теперь будем исправлять.Нужно выровнять данную лесенку:

HTML:

        {
        PutPlayerInVehicle(playerid, marshrutka, 0); // Зажаем NPC В созданую для него машину
        SetPlayerSkin(playerid, 253);
        PlayerInfo[playerid][pCarLic] = 1;//даем лицензию
        return 1;
        }

Варнинг исправлен)

Posts: 2,726
Threads: 85
Joined: Jul 2010

Reputation:

0

23.05.2011, 08:51

(

Последний раз редактировалось Mean; 20.06.2013 в 12:23.

)

How to fix warning 217: loose indentation

Introduction

Recently, I saw A LOT of people asking WHY do they get the warning 217, well, I always had to write examples, and I got sick of wasting my time in doing that, so now I’ll just write a tutorial and post the thread link if someone asks.

Why do we get warning 217?

If your code is not properly indented, your compiler will tell you. To fix the warning, all you have to do is properly indent your code.
I have had problems with this in my scripting beginnings. I couldn’t see some obvious errors in my code, but once I indented them, I could easily spot issues.
Good indentation is important. If you want some scripter to help you and you give him messy code, don’t be surprised if he ignores you.

To indent your code, all you need to do is press the tab key few times, or only one time, depends.

After every «{» (if we open a statement), you need to go one tab forward, by the standards, and if we do «}» (if we close a statement), then we go one tab back. The default tab size in a_samp is 4 spaces (so tab is equal to 4 spaces).

So, here’s an example of

GOOD indentation:

pawn Код:

if( !strcmp( cmdtext, "/lol", true ) )
{
    // There's a "{" so we moved 4 spaces (one tab) forward.
    if( !strcmp( cmdtext[ 5 ], "rofl", true ) )
    {
        //ANOTHER "{" so we move 4 spaces (one tab) forward
        SendClientMessage( playerid, -1, "Your parameter after the /lol command is 'rofl'." );
    }
    //We closed the bracket, so we go 4 spaces (one tab) back.
    return 1;
}

Now, I hope you’ve understood it, if not, I’ll give an example of BAD indentation:

pawn Код:

if( !strcmp( cmdtext, "/lol", true ) )
{
  if( !strcmp( cmdtext[ 5 ], "rofl", true ) )
     {
   SendClientMessage( playerid, -1, "Your parameter after the /lol command is 'rofl'." );
        }
return 1;
}

Also, here’s what alot of people do:

pawn Код:

if( !strcmp( cmdtext, "/lol", true ) )
{
if( !strcmp( cmdtext[ 5 ], "rofl", true ) )
{
SendClientMessage( playerid, -1, "Your parameter after the /lol command is 'rofl'." );
}
return 1;
}

Now that’s really unreadable…

That’s about it.

Posts: 2,726
Threads: 85
Joined: Jul 2010

Reputation:

0

Posts: 176
Threads: 21
Joined: Jan 2011

Reputation:

0

Quote:


Once, myself loose indentation caused some problems, my dialog response wasn’t working well because of faily indenting

I don’t think that has to do with indentation. At least, I used to code with really bad indentation and everything just worked fine. But it does look ugly.

Posts: 649
Threads: 4
Joined: Jul 2010

Nice tutorials and many, many EASY.

you like this: https://sampforum.blast.hk/showthread.php?tid=252966
the first post.

Posts: 2,726
Threads: 85
Joined: Jul 2010

Reputation:

0

25.05.2011, 09:16

(

Последний раз редактировалось Mean; 17.01.2013 в 17:44.

)

Thank you.

Posts: 1,341
Threads: 17
Joined: Aug 2009

Reputation:

0

Nice Tutorial Mean .

Posts: 3,793
Threads: 196
Joined: Jan 2010

Reputation:

0

One thing to do is just ignore them, i get tons of pms from people sending crap about this to me, hopefully this taught them.

Posts: 1,496
Threads: 78
Joined: Jun 2008

Reputation:

0

Nice tutorial.
I did the third method years ago

Actually I think you may add some more explanation on why a good indentation is required,
just like better reading, easy to find the missing brackets, etc..

Posts: 1,768
Threads: 91
Joined: Dec 2010

Reputation:

0

Good I use tabs … it’s easier x)

Posts: 451
Threads: 31
Joined: May 2012

Reputation:

0

Now i understand it. So #pragma is only for ignoring things? because i have:
#pragma Tabsize 0
#pragma Unused Check

Posts: 15,941
Threads: 0
Joined: Jun 2008

No, prgama is for passing special instructions to the compiler. Some of those instructions tell the compiler to ignore certain warnings or unused symbols; some can tell users information; some can adjust compiler flags like string type defaults and heap size. Most of them have legitimate uses — even «unused» and «tabsize», sometimes you have a symbol defined and you know that you don’t use it but can’t make it «stock» for some reason — then «unused» is useful, and both a_samp and YSI use «tabsize» to set it to 4 (YSI uses this to override the warning in some cases where the compiler is wrong without resorting to using 0). For more information check pawn-lang.pdf:

https://sampforum.blast.hk/showthread.php?tid=289258

Posts: 451
Threads: 31
Joined: May 2012

Reputation:

0

Quote:

Originally Posted by Y_Less
View Post

No, prgama is for passing special instructions to the compiler. Some of those instructions tell the compiler to ignore certain warnings or unused symbols; some can tell users information; some can adjust compiler flags like string type defaults and heap size. Most of them have legitimate uses — even «unused» and «tabsize», sometimes you have a symbol defined and you know that you don’t use it but can’t make it «stock» for some reason — then «unused» is useful, and both a_samp and YSI use «tabsize» to set it to 4 (YSI uses this to override the warning in some cases where the compiler is wrong without resorting to using 0). For more information check pawn-lang.pdf:

https://sampforum.blast.hk/showthread.php?tid=289258

oh thx for the pawn-lang.pdf, this will help me learning the pawno language

Posts: 26
Threads: 0
Joined: Jan 2013

Reputation:

0

In my PAWNO experience, i can just use #pragma to give specific instructions to the compiler to miss out the errors or it will creep me out by showing me loose indentations, or too many errors on one line. This is also helpful, but not complete enough for me :

Posts: 15,941
Threads: 0
Joined: Jun 2008

Quote:

Originally Posted by Superdude
View Post

In my PAWNO experience, i can just use #pragma to give specific instructions to the compiler to miss out the errors or it will creep me out by showing me loose indentations, or too many errors on one line. This is also helpful, but not complete enough for me :

Yes, that’s called ignoring the problems instead of fixing them. If your indentation wasn’t bad you wouldn’t need to tell the compiler to ignore the badness.

Posts: 451
Threads: 31
Joined: May 2012

Reputation:

0

I fixed all my identitations thx to this tutorial now, thx . +rep

and: Thx Y_Less for explaining me #pragma tabsize 0 only ignores the warnings.

Posts: 58
Threads: 0
Joined: Mar 2012

Reputation:

0

The one important thing you gain with good indentation is easily avoidable dangling-else problem.(Interestingly this reason is explicitly stated in compiler sources)

Posts: 56
Threads: 10
Joined: Apr 2012

Reputation:

0

you can use
#pragma tabsize 0

Posts: 66
Threads: 9
Joined: Jul 2011

Reputation:

0

i in this problem use #pragma tabsize 0 and solved problems with Loose identation

Posts: 7,801
Threads: 187
Joined: Feb 2010

Reputation:

0

You people just don’t understand the proper usage of #pragma tabsize, do you?

If you’re compiler is returning indentation warnings, it means you need to INDENT YOUR CODE. Using #pragma tabsize 0 is a stupid idea and it just shows how lazy you are. If you’re going to write code, do it correctly.

warning 217: loose indentation

Модераторы: Subb98, liFe iS GoOD

  • Список форумов AMX Mod X Скриптинг

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

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

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

warning 217: loose indentation

При компиляции выдаёт ошибки:

Код: Выделить всё
Admin_menus.sma(43) : warning 217: loose indentation
Admin_menus.sma(47) : warning 217: loose indentation
Admin_menus.sma(96) : warning 217: loose indentation
Admin_menus.sma(100) : warning 217: loose indentation
Admin_menus.sma(120) : warning 217: loose indentation
Admin_menus.sma(126) : warning 217: loose indentation
Admin_menus.sma(132) : warning 217: loose indentation
Admin_menus.sma(139) : warning 217: loose indentation
Admin_menus.sma(146) : warning 217: loose indentation
Admin_menus.sma(168) : warning 217: loose indentation
Admin_menus.sma(172) : warning 217: loose indentation
Admin_menus.sma(198) : warning 217: loose indentation
Admin_menus.sma(204) : warning 217: loose indentation
Admin_menus.sma(211) : warning 217: loose indentation
Admin_menus.sma(232) : warning 217: loose indentation
Admin_menus.sma(236) : warning 217: loose indentation

я отметил ошибки, которые, мешают работать меню, есть какой-то вариант их исправить?

Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
native get_m79(id);
native give_weapon_thompson(id);
native Ak47_DarkHunter(id);
native get_user_inviz(id);
native set_user_inviz(id, amount);
native give_weapon_pkm(id);
native give_weapon_infinir(id)#define plugin_name "Admin_menus"
#define version "1.0"
#define author "Nikita"

#define VIP ADMIN_IMMUNITY
#define ADMIN_L2 ADMIN_CFG
#define ADMIN_L3 ADMIN_CVAR
#define ADMIN_L4 ADMIN_BAN

new one_map[33];public plugin_init(){
    register_plugin(plugin_name, version, author);
    register_clcmd("vipmenu", "vipmenu");
    register_clcmd("adml2", "adml2_menu");
    register_clcmd("adml3", "adml3_menu");
    register_clcmd("adml4", "adml4_menu");
}
public vipmenu(id){
    if(!(get_user_flags(id) & VIP)){
        return PLUGIN_HANDLED;
    }
    new formatted_str[4][64];
    format(formatted_str[0], charsmax(formatted_str[]), "yВип-Меню^nd[rУровень: L6d]");
    format(formatted_str[1], charsmax(formatted_str[]), "wВзятьr 255APw +r 255HP");
    format(formatted_str[2], charsmax(formatted_str[]), "wВзятьr $10000");
    format(formatted_str[3], charsmax(formatted_str[]), "wВзятьw Инфинити d[rКрасныйd]");
    new VIPMENU = menu_create(formatted_str[0], "vip_handlermenu");
    for(new il = 1; il < sizeof(formatted_str); il++){
        menu_additem(VIPMENU, formatted_str[il]);
    }
    
    menu_setprop
(VIPMENU, MPROP_NEXTNAME, "Дальше");
    menu_setprop(VIPMENU, MPROP_BACKNAME, "Назад");
    menu_setprop(VIPMENU, MPROP_EXITNAME, "Выход");
    menu_setprop(VIPMENU, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, VIPMENU, 0);
    return PLUGIN_HANDLED;
}
public vip_handlermenu(id, menu, key){
    switch(key+1){
        case 1:{
            if(one_map[id]>7){
                set_user_health(id, 255);
                set_user_armor(id, 255);
                one_map[id]++
            }
        }
        case 2:{
            if(one_map[id]>7){
                cs_set_user_money(id, cs_get_user_money(id) + 10000);
                one_map[id]++
            }
        }
        case 3:{
            if(one_map[id]>5){
                give_weapon_infinir(id);
                one_map[id]++
            }
        }
        case MENU_EXIT:{
            return menu_destroy(menu);
        }
    }
    return menu_destroy(menu);
}
public adml2_menu(id){
    if(!(get_user_flags(id) & ADMIN_L2)){
        return PLUGIN_HANDLED;
    }
    new formatted_str[7][64];
    format(formatted_str[0], charsmax(formatted_str[]), "yАдмин-Менюnd[rУровень: L2]");
    format(formatted_str[1], charsmax(formatted_str[]), "wВзятьr 400APw +r 400HP");
    format(formatted_str[2], charsmax(formatted_str[]), "wВзятьr $30000");
    format(formatted_str[3], charsmax(formatted_str[]), "wВзятьr Пулемёт PKM(ЭрКаЭм)");
    format(formatted_str[4], charsmax(formatted_str[]), "wВзятьr Гранатомёт");
    format(formatted_str[5], charsmax(formatted_str[]), "wВзятьr Скорость+Инвиз");
    format(formatted_str[6], charsmax(formatted_str[]), "wВзятьr +500АР + 500HP");
    new L2MENU = menu_create(formatted_str[0], "l2_handlermenu");
    for(new il = 1; il < sizeof(formatted_str); il++){
        menu_additem(L2MENU, formatted_str[il]);
    }
    
    menu_setprop
(L2MENU, MPROP_NEXTNAME, "Дальше");
    menu_setprop(L2MENU, MPROP_BACKNAME, "Назад");
    menu_setprop(L2MENU, MPROP_EXITNAME, "Выход");
    menu_setprop(L2MENU, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, L2MENU, 0);
    return PLUGIN_HANDLED;
}
public l2_handlermenu(id, menu, key){
    switch(key+1){
        case 1:{
            if(one_map[id]>7){
                set_user_health(id, 400);
                set_user_armor(id, 400);
                one_map[id]++
        }
    }
        case 2:{
            if(one_map[id]>7){
                cs_set_user_money(id, cs_get_user_money(id) + 30000);
            one_map[id]++//тут
        }
    }
        case 3:{
            if(one_map[id]>5){
                give_weapon_pkm(id);
            one_map[id]++//тут
        }
    }
        case 4:{
            if(one_map[id]>10){
                get_m79(id);
            one_map[id]++//тут
        }
    }
        case 5:{
            if(one_map[id]>5){
                set_user_maxspeed(id, 999.0);
                set_user_inviz(id, 15);
            one_map[id]++//тут
        }
    }
        case 6:{
            if(one_map[id]>6){
                set_user_health(id, get_user_health(id) + 500);
                set_user_armor(id, get_user_armor(id) + 500);
            one_map[id]++ //тут
        }
    }
    case MENU_EXIT:{
        return menu_destroy(menu);
        }
    }
    return menu_destroy(menu);
}
    
public adml3_menu
(id){
    if(!(get_user_flags(id) & ADMIN_L3)){
        return PLUGIN_HANDLED;
    }
    new formatted_str[6][64];
    format(formatted_str[0], charsmax(formatted_str[]), "yАдмин-меню^nd[rУровень: L3d]");
    format(formatted_str[1], charsmax(formatted_str[]), "wВзятьr 350APw +r 350HP");
    format(formatted_str[2], charsmax(formatted_str[]), "wВзятьr $22000");
    format(formatted_str[3], charsmax(formatted_str[]), "wВзятьr автомат AK47 Dark Hunter");
    format(formatted_str[4], charsmax(formatted_str[]), "wВзятьr Гранатомёт");
    format(formatted_str[5], charsmax(formatted_str[]), "wВзятьr +300APw +r +300HP");
    new L3MENU = menu_create(formatted_str[0], "l3_handlermenu");
    for(new il = 1; il < sizeof(formatted_str); il++){
        menu_additem(L3MENU, formatted_str[il]);
    }
    
    menu_setprop
(L3MENU, MPROP_NEXTNAME, "Дальше");
    menu_setprop(L3MENU, MPROP_BACKNAME, "Назад");
    menu_setprop(L3MENU, MPROP_EXITNAME, "Выход");
    menu_setprop(L3MENU, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, L3MENU, 0);
    return PLUGIN_HANDLED;
}
public l3_handlermenu(id, menu, key){
    switch(key+1){
        case 1:{
        if(one_map[id]<7){
            set_user_health(id, 350);
            set_user_armor(id, 350);
            one_map[id]++
            }
        }
        case 2:{
        if(one_map[id]<7){
            cs_set_user_money(id, cs_get_user_money(id) + 22000);
            one_map[id]++
        }
    }
        case 3:{
            if(one_map[id]>5){
                Ak47_DarkHunter(id)
            one_map[id]++//тут
        }
    }
        case 4:{
        if(one_map[id]>5){
            get_m79(id);
        one_map[id]++//тут
        }
    }
        case 5:{
            if(one_map[id]>6){
                set_user_health(id, get_user_health(id) + 300);
                set_user_armor(id, get_user_armor(id) + 300);
            one_map[id]++ //Тут
        }
    }
        case MENU_EXIT:{
            return menu_destroy(menu);
        }
    }
    return menu_destroy(menu);
}
public adml4_menu(id){
    if(get_user_flags(id) & ADMIN_L4){
        return PLUGIN_HANDLED
    
}
    new formatted_str[5][64];
    format(formatted_str[0], charsmax(formatted_str[]), "yАдмин-меню^nd[rУровень: L4d]");
    format(formatted_str[1], charsmax(formatted_str[]), "wВзятьr 300APw +r 300HP");
    format(formatted_str[2], charsmax(formatted_str[]), "wВзятьr $22000");
    format(formatted_str[3], charsmax(formatted_str[]), "wВзятьr автомат Томпсона");
    format(formatted_str[4], charsmax(formatted_str[]), "wВзятьr Гранатомёт");
    new L4MENU = menu_create(formatted_str[0], "l4_handlermenu");
    for(new il = 1; il < sizeof(formatted_str); il++){
        menu_additem(L4MENU, formatted_str[il]);
    }
    
    menu_setprop
(L4MENU, MPROP_NEXTNAME, "Дальше");
    menu_setprop(L4MENU, MPROP_BACKNAME, "Назад");
    menu_setprop(L4MENU, MPROP_EXITNAME, "Выход");
    menu_setprop(L4MENU, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, L4MENU, 0);
    return PLUGIN_HANDLED;
}
public l4_handlermenu(id, menu, key){
    switch(key+1){
        case 1:{
        if(one_map[id]<7){
            set_user_health(id, 300);
            set_user_armor(id, 300);
            one_map[id]++
        }
    }
        case 2:{
        if(one_map[id]<7){
            cs_set_user_money(id, cs_get_user_money(id) + 16000);
            one_map[id]++
        }
    }
        case 3:{
            if(one_map[id]>5){
                Ak47_DarkHunter(id)
                one_map[id]++
        }
    }
        case 4:{
        if(one_map[id]>1){
            get_m79(id);
            one_map[id]++
        }
    }
        case MENU_EXIT:{
            return menu_destroy(menu);
        }
    }
    return menu_destroy(menu);
}

Название темы скорректировано // Subb98

Аватара пользователя

Nick2001

 
Сообщения: 31
Зарегистрирован: 02 мар 2016, 19:43
Благодарил (а): 17 раз.
Поблагодарили: 1 раз.
Языки программирования: Counter-Strike 1.6

Re: warning 217: loose indentation

Сообщение L4D2 » 23 мар 2016, 02:31

Табуляция…
Никакой ошибки здесь нету, он лишь предупреждает.
Научитесь расставлять правильно табуляцию.

Аватара пользователя

L4D2

 
Сообщения: 792
Зарегистрирован: 25 июн 2011, 19:26
Благодарил (а): 240 раз.
Поблагодарили: 100 раз.
Языки программирования: Counter-Strike 1.6

Re: warning 217: loose indentation

Сообщение Nick2001 » 23 мар 2016, 02:37

Ещё, он не выполняет своих функции.
Всё раставил ошибок нет, но всё равно не выполняет

Добавлено спустя 20 секунд:
Только одну, выдаёт 22000 долларов

Аватара пользователя

Nick2001

 
Сообщения: 31
Зарегистрирован: 02 мар 2016, 19:43
Благодарил (а): 17 раз.
Поблагодарили: 1 раз.
Языки программирования: Counter-Strike 1.6

Re: warning 217: loose indentation

Сообщение Fedcomp » 23 мар 2016, 09:26

Если плагин скомпилировался (или если вы обратите внимание на слово warning) то это предупреждения.
В предупреждении у вас сказано что неправильно расставлены отступы, поправьте отступы и предупреждение уйдет. За сим закрываю.

Не помогаю в ЛС — есть форум.
Плагины тоже не пишу, на форуме достаточно хороших скриптеров.

«я ставлю зависимости потому что мне приятно» — subb98 @ 2017

Аватара пользователя

Fedcomp

Администратор
 
Сообщения: 4910
Зарегистрирован: 28 авг 2009, 20:47
Благодарил (а): 790 раз.
Поблагодарили: 1302 раз.
Языки программирования: =>
pawn / php / python / ruby
javascript / rust


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

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

Сейчас этот форум просматривают: Bing [Bot] и гости: 2

Помогите с кодом, команда /afly, Все вроде правильно написал, но не понимаю, что за ошибки: warning 217: loose indentation и как их убрать

Вот что выходит при компилировании: 
C:UsersFelixDesktopServer DMgamemodesserver.pwn(4598) : warning 217: loose indentation
C:UsersFelixDesktopServer DMgamemodesserver.pwn(4831) : warning 217: loose indentation
C:UsersFelixDesktopServer DMgamemodesserver.pwn(4864) : warning 217: loose indentation
C:UsersFelixDesktopServer DMgamemodesserver.pwn(6548) : warning 211: possibly unintended assignment
C:UsersFelixDesktopServer DMgamemodesserver.pwn(6555) : warning 202: number of arguments does not match definition

Строчка 4598 жалуется, код:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/afly", true))
{
if(GetPVarType(playerid, "FlyMode")) CancelFlyMode(playerid);
else FlyMode(playerid);
return true;
}
4598 return true;
}

Строчка 4831 и 4864 жалуется, код:
4831 if(noclipdata[playerid][cameramode] == CAMERA_MODE_FLY)
{
new keys,ud,lr;
GetPlayerKeys(playerid,keys,ud,lr);

if(noclipdata[playerid][mode] && (GetTickCount() - noclipdata[playerid][lastmove] > 100))
{
// If the last move was > 100ms ago, process moving the object the players camera is attached to
MoveCamera(playerid);
}

// Is the players current key state different than their last keystate?
if(noclipdata[playerid][udold] != ud || noclipdata[playerid][lrold] != lr)
{
if((noclipdata[playerid][udold] != 0 || noclipdata[playerid][lrold] != 0) && ud == 0 && lr == 0)
{ // All keys have been released, stop the object the camera is attached to and reset the acceleration multiplier
StopPlayerObject(playerid, noclipdata[playerid][flyobject]);
noclipdata[playerid][mode] = 0;
noclipdata[playerid][accelmul] = 0.0;
}
else
{ // Indicates a new key has been pressed

// Get the direction the player wants to move as indicated by the keys
noclipdata[playerid][mode] = GetMoveDirectionFromKeys(ud, lr);

// Process moving the object the players camera is attached to
MoveCamera(playerid);
}
}
noclipdata[playerid][udold] = ud; noclipdata[playerid][lrold] = lr; // Store current keys pressed for comparison next update
return 0;
}
4864 return true;
}

Строчка 6548 и 6555 жалуется, код:
CMD:afly(playerid,params[])
{
6548 if(dostup[playerid] = 0) return true;
if(PlayerInfo[playerid][pAdmin] < 1) return true;
SetPVarInt(playerid,"spawn_ac",1);

if(GetPVarType(playerid, "FlyMode"))
{
new inter, world, Float:X, Float:Y, Float:Z, Float:FA;
6555 GetPlayerHealth(PlayerInfo[playerid][pHealth]);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, FA);
inter = GetPlayerInterior(playerid);
world = GetPlayerVirtualWorld(playerid);
SetPVarFloat(playerid, "SpecX", X);
SetPVarFloat(playerid, "SpecY", Y);
SetPVarFloat(playerid, "SpecZ", Z);
SetPVarFloat(playerid, "SpecFA", FA);
SetPVarInt(playerid, "SpecInt", inter);
SetPVarInt(playerid, "SpecWorld", world);

CancelFlyMode(playerid);
}
else
{
SetPVarInt(playerid, "SpecBool", 1);
FlyMode(playerid);
}
return true;
}

Просьба, кто знает в чем проблемы, помогите, буду очень благодарен

Отредактировано 15 апреля, 2018 пользователем MuhammadPawn


Причина: Убрал код под спойлер

Заметка от

Гость
, создано 15 апреля, 2018

Ошибки желательно тоже под код

  • Команда форума
  • #121

Re: Где находятся переменные sourcemod.cfg

cfg/sourcemod/

  • #122

Всё с офф сайта,последние версии закинул DM все как надо, в консоли пишет что детматч failed. Что делать

  • #123

Ребят,помогите пожалуйста скомпилировать!

  • sourcebans.rar

    11.4 КБ

    · Просмотры: 11

  • Команда форума
  • #124

Nikolay Smagin, лови

  • sourcebans.smx

    29.4 КБ

    · Просмотры: 4

  • #125

Как ты компилировал,ото меня ошибку выдаёт
/home/groups/sourcemod/upload_tmp/phpFl5OCY.sp(14) : fatal error 120: cannot read from file: «sourcebans»

  • Команда форума
  • #126

Nikolay Smagin, sourcebans.inc закинь в include рядом с компилятором

  • #127

Можешь дать ссылку на программу для smx. плагинов
Ото я с сайта соурсмода делал

  • Команда форума
  • #128

Nikolay Smagin, скачиваешь sourcemod для windows и распаковываешь папку scripting. В неё потом закидываешь что нужно скомпилировать, а дальше

Инструкция по компиляции плагинов:
Windows
Скопируйте файл с расширением sp в папку SRCDS/<MOD>/addons/sourcemod/scripting и переместите скопированный файл на compile.exe с помощью перетаскивания.
Вы увидите такое окно:

sourcemodcompile.png

Далее нажмите Enter, окно должно закрыться. Готовый скомпилированный плагин будет в папке SRCDS/orangebox/cstrike/addons/sourcemod/scripting/compiled
Для компиляции некоторых плагинов нужны *.inc файлы которые нужно копировать в папку addons/sourcemod/scripting/include и затем компилировать плагин.

  • #129

Спасибо,разобрался.
Вот ещё,пишет
cannot read from file: «autoupdater»
Где его взять?

  • Команда форума
  • #130

  • #131

Я компилирую плагин пишет /home/groups/sourcemod/upload_tmp/phpuY9hxa.sp(10) : fatal error 120: cannot read from file: «ipcompil»

Compilation aborted.
1 Error.

  • Команда форума
  • #132

Кирилл Спиридонов, удали это

#define IPCOMPILED_MODE 1
#define IPCOMPILED «83.222.97.211»

#include <ipcompil>

И это

#if IPCOMPILED_MODE > 0
CheckTheIP();
#endif

  • Команда форума
  • #134

Кирилл Спиридонов, из исходника

  • #135

Удалил теперь пишет chat.sp <178> warning 217: loose indentation
chat.sp <180> warning 217: loose indentation

  • Команда форума
  • #136

Кирилл Спиридонов, это просто предупреждения, не обращай на них внимания. Плагин скомпилировался.

AlmazON

AlmazON

Не путать с самим yand3xmail


  • #137

warning 217: loose indentation

«Предупреждение 217: свободный (неправильный) отступ»; код не табулирован (не построен лесенкой).
По факту ни на что не влияет, а теоретически может чуток нагружать сервер.
Если хочешь, скинь сюда свой скрипт — «Notepad++» разровняет.

  • Команда форума
  • #138

а теоретически может чуток нагружать сервер.

Откуда инфа?

AlmazON

AlmazON

Не путать с самим yand3xmail


  • #139

«обьясню чем он опасен этот: warning 217: loose indentation.

Всё с самого начало про программирование:
Бывают низкий уровень программного кода: ну скомпилированный обьект на понятном компу языке
И бывает высокий уровень програмного кода: Pawn например или его большой брат C/C++.

Теперь рассмотрим что такое компиляция:
Компиляция — преобразование программой-компилятором исходного текста какой-либо программы, написанного на языке программирования высокого уровня, в язык, близкий к машинному, или в объектный код.

Варнинг 217, это нарушение табуляции — тоесть при компиляции получается куча из байтов( Байт — 1 буква или символ)
И он приводит к нарушению чтения кода компом хоста/ващего… ну к ничему серьёзному это не приводит компилятор в павно сам его исправляет но даёт нам понять что его надо исправить что вы люди не хотите делать…» — тык
Чисто про теорию нагрузки уже давал где-то ссылку, не помню.

  • Команда форума
  • #140

AlmazON, я всегда исправляю но всё же компилятор при преобразовании кода должен её исправлять

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta_util>
#include <colorchat>

#define PLUGIN  "ServerMenu_CSDM"
#define VERSION "0.1"
#define AUTHOR  "Bitter"

new keys6 = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_8|MENU_KEY_0

new iMoney,iShop[7];

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_menu("menu_6", keys6, "menus6")
    register_concmd("nightvision", "menu6")
    register_clcmd("menu", "menu6")
    register_clcmd("say /menu", "menu6")
    register_clcmd("say_team /menu", "menu6")

    register_event( "HLTV", "RoundStart", "a", "1=0", "2=0" );    // Событие старта раунда
}

public RoundStart()
{
    for(new r = 0; r <= 7; r++)
    {
        iShop[r] = 0;
    }
}

public menu6(id)
{
    iMoney = cs_get_user_money(id);
    static menu[650], keys, iLen;
    iLen = 0, keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_8|MENU_KEY_0
    iLen = formatex(menu[iLen], charsmax(menu) - iLen, "wМеню yАвтоматов^nwДеньгиd: y%d$^n^n",iMoney);
    if(iShop[1] == 0)
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y1. wКупить yGuitar r| d(y1000$d)^n")
        keys |= MENU_KEY_1
    }
    else
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y1. dКупить yGuitar r| d(y1000$d)^n")
        keys |= MENU_KEY_1
    }
    if(iShop[2] == 0)
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y2. wКупить yScar r| d(y1000$d)^n")
        keys |= MENU_KEY_2
    }
    else
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y2. dКупить yScar r| d(y1000$d)^n")
        keys |= MENU_KEY_2
    }
    if(iShop[3] == 0)
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y3. wКупить yF2000 r| d(y1000$d)^n^n")
        keys |= MENU_KEY_3
    }
    else
    {
        iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y3. dКупить yF2000 r| d(y1000$d)^n^n")
        keys |= MENU_KEY_3
    }
   
    iLen += formatex(menu[iLen], charsmax(menu) - iLen, "y0. wВыход :)^n")
    keys |= MENU_KEY_0

    return show_menu(id, keys6, menu, -1, "menu_6")
}

public menus6(id, key)
{
    new name[32],UserMoney[33];
    get_user_name(id,name,charsmax(name));
    UserMoney[id] = cs_get_user_money(id);
    switch(key)
    {
        case 0:
        {
            if(iShop[1] == 0)
            {
                if(UserMoney[id] >= 1000)
                {
                    cs_set_user_money(id,UserMoney[id] - 1000);
                    ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Вы ^1купил ^3Guitar ^1в ^1магазине CSO");
                    fm_strip_user_gun( id, CSW_M249 ) ;
                    fm_strip_user_gun( id, CSW_SCOUT ) ;
                    fm_strip_user_gun( id, CSW_M4A1 ) ;
                    fm_strip_user_gun( id, CSW_FAMAS ) ;
                    fm_strip_user_gun( id, CSW_GALIL ) ;
                    fm_strip_user_gun( id, CSW_AK47 ) ;
                    fm_strip_user_gun( id, CSW_AWP ) ;
                    fm_strip_user_gun( id, CSW_P90 ) ;
                    fm_strip_user_gun( id, CSW_M3 ) ;
                    client_cmd(id, "guitarsp")
                    return menu6(id)
                }
                else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Игрок ^3%s^1 у вас недостаточно ^3средств.",name);
            }else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Можно купить ^41 раз.");
        }
        case 1:
        {
            if(iShop[2] == 0)
            {
                if(UserMoney[id] >= 1000)
                {
                    cs_set_user_money(id,UserMoney[id] - 1000);
                    ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Вы ^1купил ^3Scarsp ^1в ^1магазине CSO");
                    fm_strip_user_gun( id, CSW_M249 ) ;
                    fm_strip_user_gun( id, CSW_SCOUT ) ;
                    fm_strip_user_gun( id, CSW_M4A1 ) ;
                    fm_strip_user_gun( id, CSW_FAMAS ) ;
                    fm_strip_user_gun( id, CSW_GALIL ) ;
                    fm_strip_user_gun( id, CSW_AK47 ) ;
                    fm_strip_user_gun( id, CSW_AWP ) ;
                    fm_strip_user_gun( id, CSW_P90 ) ;
                    fm_strip_user_gun( id, CSW_M3 ) ;
                    client_cmd(id, "scarsp")
                    return menu6(id)
                }
                else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Игрок ^3%s^1 у вас недостаточно ^3средств.",name);
            }else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Можно купить ^41 раз.");
        }
        case 2:
        {
            if(iShop[3] == 0)
            {
                if(UserMoney[id] >= 1000)
                {
                    cs_set_user_money(id,UserMoney[id] - 1000);
                    ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Вы ^1купил ^3F2000 ^1в ^1магазине CSO");
                    fm_strip_user_gun( id, CSW_M249 ) ;
                    fm_strip_user_gun( id, CSW_SCOUT ) ;
                    fm_strip_user_gun( id, CSW_M4A1 ) ;
                    fm_strip_user_gun( id, CSW_FAMAS ) ;
                    fm_strip_user_gun( id, CSW_GALIL ) ;
                    fm_strip_user_gun( id, CSW_AK47 ) ;
                    fm_strip_user_gun( id, CSW_AWP ) ;
                    fm_strip_user_gun( id, CSW_P90 ) ;
                    fm_strip_user_gun( id, CSW_M3 ) ;
                    client_cmd(id, "f2000sp")
                    return menu6(id)
                }
                else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Игрок ^3%s^1 у вас недостаточно ^3средств.",name);
            }else ColorChat(id,GREEN,"^1[^4Магазин^1] ^1Можно купить ^41 раз.");
        }
    }
    return PLUGIN_HANDLED
}

Author

Message

AlliedModders Donor

Join Date: Nov 2014

Location: India

Old

12-17-2014

, 03:27

 

warning 217: loose indentation

Reply With Quote

#1


Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler. Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team  
knifeitup.sma(63) : warning 217: loose indentation 
knifeitup.sma(64) : warning 217: loose indentation 
knifeitup.sma(67) : warning 217: loose indentation 
knifeitup.sma(70) : warning 217: loose indentation 
knifeitup.sma(71) : warning 217: loose indentation 
Header size:736 bytes 
Code size:3616 bytes 
Data size: 1504 bytes 
Stack/heap size: 16384 bytes; 
estimated max. usage=778 cells (3112 bytes) 
Total requirements:   22240 bytes  
5 Warnings. 
Done.

PHP Code:



/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "knifeitup"
#define VERSION "3.0"
#define AUTHOR "Gullu Bhai"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("knifeitup_hp""25")
    
register_cvar("knifeitup_adminhp""100")
    
register_cvar("knifeitup_frags""5")
    
register_event("DeathMsg""Event_DeathMsg_knife""a")
}

new 

CustomSound[][] =  
{
    
"misc/knife1.wav",
    
"misc/knife2.wav",
    
"misc/knife3.wav",
    
"misc/knife4.wav",
    
"misc/knife5.wav"
}

public 

plugin_precache()
{
    for ( new 
isizeof CustomSoundi++ )
        {
            
precache_soundCustomSound]);
        }
}   

public 

Event_DeathMsg_knife()
{
    new 
Killer read_data(1)
    new 
Victim read_data(2)

        if (!

is_user_alive(Killer) || (Killer == Victim))
        return;

        new 

szName[32], szName2[32]
    
get_user_name(KillerszNamecharsmax(szName)) 
    
get_user_name(VictimszName2charsmax(szName2)) 

        new 

CheckWeapon[6];
    
read_data(4CheckWeapon5);

        if (

equal(CheckWeapon"knife"))
    {
        new 
php get_cvar_num("knifeitup_hp")
        new 
ahp get_cvar_num("knifeitup_adminhp")
        new 
frags get_cvar_num("knifeitup_frags")

                        if(

get_user_flags(Killer) & ADMIN_KICK
        {
            
client_print_color(0print_chat"%s Got %d Frags %d hp For Knifing Admin %s"szNamefragsahpszName2)
             
client_cmd0"spk %s"CustomSoundrandom_num0sizeof CustomSound ) ] ); //by Arkshine
            
set_user_health(Killerget_user_health(Killer) + ahp)
            
set_user_frags(Killerget_user_frags(Killer) + frags)
        }
       else
        {
        
client_print_color(0print_chat"%s Got %d Frags %d hp For Knifing %s"szNamefragsphpszName2)
         
client_cmd0"spk %s"CustomSoundrandom_num0sizeof CustomSound ) ] );  //by Arkshine
        
set_user_health(Killerget_user_health(Killer) + php)
        
set_user_frags(Killerget_user_frags(Killer) + frags)
       }
    } 
}  
stock client_print_color(idtype, const text[], any:...)
{
 if(
type == print_chat)
 {
  new 
g_iMsgidSayText;
  
g_iMsgidSayText get_user_msgid("SayText");

  new 

szMsg[191], iPlayers[32], iCount 1;
  
vformat(szMsgcharsmax(szMsg), text3);replace_all(szMsgcharsmax(szMsg), "!g","^x04");
  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");
  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(

id)
   
iPlayers[0] = id;
  else
   
get_players(iPlayersiCount"ch");

  for(new 

iCount i++)
  {
   if(!
is_user_connected(iPlayers[i]))
    continue;
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
   
write_byte(iPlayers[i]);
   
write_string(szMsg);
   
message_end();
  }
 }






Last edited by tousif; 12-17-2014 at 03:28.

tousif is offline

Veteran Member

zmd94's Avatar

Join Date: Nov 2013

Location: Malaysia (9w2zow).

Old

12-17-2014

, 03:49

 

Re: warning 217: loose indentation

Reply With Quote

#2


It will not effect your gameplay. The warning is indicate that your code is not being arranged properly.

zmd94 is offline

AlliedModders Donor

Join Date: Nov 2014

Location: India

Old

12-17-2014

, 03:56

 

Re: warning 217: loose indentation

Reply With Quote

#3


ok

tousif is offline

Senior Member

popeye10's Avatar

Join Date: May 2014

Location: Navi Mumbai (India)

Old

12-17-2014

, 04:25

 

Re: warning 217: loose indentation

Reply With Quote

#4


Try this

PHP Code:



#include <amxmodx>

#include <amxmisc>

#include <fun>

#define PLUGIN "knifeitup"

#define VERSION "3.0"

#define AUTHOR "Gullu Bhai"

new php ,ahpfrags
public plugin_init() {

    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_cvar("knifeitup_hp""25")

    
register_cvar("knifeitup_adminhp""100")

    
register_cvar("knifeitup_frags""5")

    
register_event("DeathMsg""Event_DeathMsg_knife""a")

}

new 

CustomSound[][] =  

{

    
"misc/knife1.wav",

    
"misc/knife2.wav",

    
"misc/knife3.wav",

    
"misc/knife4.wav",

    
"misc/knife5.wav"

}

public 

plugin_precache() 



    for ( new 
isizeof CustomSoundi++ ) 

        { 

            
precache_soundCustomSound]); 

        } 

}  

public 

Event_DeathMsg_knife()

{

    new 
Killer read_data(1)

    new 
Victim read_data(2)

    
    if (!

is_user_alive(Killer) || (Killer == Victim))

    return 
PLUGIN_HANDLED;

        
    new 

CheckWeapon[6]

    
read_data(4CheckWeaponcharsmax(CheckWeapon))

    
    if (

equal(CheckWeapon"knife"))

    {

        new 
szName[32], szName2[32]

        
get_user_name(KillerszNamecharsmax(szName))

        
get_user_name(VictimszName2charsmax(szName2))

        
        if(

get_user_flags(Killer) & ADMIN_KICK)

        {

            
client_print_color(0print_chat"!g%s !tGot !g%d !tFrags !g%d !thp For Knifing Admin !g%s"szNamefragsahpszName2);

            
client_cmd0"spk %s",CustomSoundrandom_num0sizeof CustomSound ) ] );//by Arkshine 

            
set_user_health(Killerget_user_health(Killer) + get_pcvar_num(ahp))

            
set_user_frags(Killerget_user_frags(Killer) + get_pcvar_num(frags))

        }

        else

        {

            
client_print_color(0print_chat"!g%s !tGot !g%d !tFrags !g%d !thp For Knifing !g%s"szNamefragsphpszName2);

            
client_cmd0"spk %s",CustomSoundrandom_num0sizeof CustomSound ) ] );//by Arkshine 

            
set_user_health(Killerget_user_health(Killer) + get_pcvar_num(php))

            
set_user_frags(Killerget_user_frags(Killer) + get_pcvar_num(frags))

        }

    }

    return 
PLUGIN_CONTINUE;

}
stock client_print_color(idtype, const text[], any:...)

{

 if(
type == print_chat)

 {

  new 
g_iMsgidSayText;

  
g_iMsgidSayText get_user_msgid("SayText");

  new 

szMsg[191], iPlayers[32], iCount 1;

  
vformat(szMsgcharsmax(szMsg), text3);
replace_all(szMsgcharsmax(szMsg), "!g","^x04");

  
replace_all(szMsgcharsmax(szMsg), "!n","^x01");

  
replace_all(szMsgcharsmax(szMsg), "!t","^x03");

  if(

id)

   
iPlayers[0] = id;

  else

   
get_players(iPlayersiCount"ch");

  for(new 

iCount i++)

  {

   if(!
is_user_connected(iPlayers[i]))

    continue;
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);

   
write_byte(iPlayers[i]);

   
write_string(szMsg);

   
message_end();

  }

 }






__________________

popeye10 is offline

AlliedModders Donor

Join Date: Nov 2014

Location: India

Old

12-17-2014

, 04:27

 

Re: warning 217: loose indentation

Reply With Quote

#5


ty

tousif is offline

Member

GX_JazZ's Avatar

Old

12-17-2014

, 11:29

 

Re: warning 217: loose indentation

Reply With Quote

#6


Try this :

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "knifeitup"
#define VERSION "3.0"
#define AUTHOR "Gullu Bhai"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("knifeitup_hp", "25")
register_cvar("knifeitup_adminhp", "100")
register_cvar("knifeitup_frags", "5")
register_event("DeathMsg", "Event_DeathMsg_knife", "a")
}

new CustomSound[][] =  
{
"misc/knife1.wav",
"misc/knife2.wav",
"misc/knife3.wav",
"misc/knife4.wav",
"misc/knife5.wav"
}

public plugin_precache()
{
for ( new i; i < sizeof CustomSound; i++ )
{
precache_sound( CustomSound[ i ]);
}
}   


public Event_DeathMsg_knife()
{
new Killer = read_data(1)
new Victim = read_data(2)

if (!is_user_alive(Killer) || (Killer == Victim))
return;

new szName[32], szName2[32]
get_user_name(Killer, szName, charsmax(szName)) 
get_user_name(Victim, szName2, charsmax(szName2)) 

new CheckWeapon[6];
read_data(4, CheckWeapon, 5);

if (equal(CheckWeapon, "knife"))
{
new php = get_cvar_num("knifeitup_hp")
new ahp = get_cvar_num("knifeitup_adminhp")
new frags = get_cvar_num("knifeitup_frags")


if(get_user_flags(Killer) & ADMIN_KICK) 
{
client_print_color(0, print_chat, "%s Got %d Frags %d hp For Knifing Admin %s", szName, frags, ahp, szName2)
client_cmd( 0, "spk %s", CustomSound[ random_num( 0, sizeof CustomSound - 1 ) ] ); //by Arkshine
set_user_health(Killer, get_user_health(Killer) + ahp)
set_user_frags(Killer, get_user_frags(Killer) + frags)
}
else
{
client_print_color(0, print_chat, "%s Got %d Frags %d hp For Knifing %s", szName, frags, php, szName2)
client_cmd( 0, "spk %s", CustomSound[ random_num( 0, sizeof CustomSound - 1 ) ] );  //by Arkshine
set_user_health(Killer, get_user_health(Killer) + php)
set_user_frags(Killer, get_user_frags(Killer) + frags)
}
} 
}  

stock client_print_color(id, type, const text[], any:...)
{
if(type == print_chat)
{
new g_iMsgidSayText;
g_iMsgidSayText = get_user_msgid("SayText");

new szMsg[191], iPlayers[32], iCount = 1;
vformat(szMsg, charsmax(szMsg), text, 3);

replace_all(szMsg, charsmax(szMsg), "!g","^x04");
replace_all(szMsg, charsmax(szMsg), "!n","^x01");
replace_all(szMsg, charsmax(szMsg), "!t","^x03");

if(id)
iPlayers[0] = id;
else
get_players(iPlayers, iCount, "ch");

for(new i = 0 ; i < iCount ; i++)
{
if(!is_user_connected(iPlayers[i]))
continue;

message_begin(MSG_ONE_UNRELIABLE, g_iMsgidSayText, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}
}

GX_JazZ is offline

Send a message via Skype™ to GX_JazZ

AlliedModders Donor

Join Date: Nov 2014

Location: India

Old

12-17-2014

, 11:46

 

Re: warning 217: loose indentation

Reply With Quote

#7


Plugin is not working the name of killer is comming but not victim and not giving the frags and hp and are also not according to cvars
Sounds not playing if plugin at 1st round only

Plzz help in fixing this ^^

tousif is offline

Has a lovely bunch of coconuts

YamiKaitou's Avatar

Join Date: Apr 2006

Location: Texas

Old

12-17-2014

, 13:06

 

Re: warning 217: loose indentation

Reply With Quote

#8


Quote:

Originally Posted by GX_JazZ
View Post

Try this :

That code looks like crap. Where is the indentation? How can you see which scope ends where?

__________________

ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

YamiKaitou is offline

Veteran Member

Old

12-17-2014

, 15:12

 

Re: warning 217: loose indentation

Reply With Quote

#9


Quote:

Originally Posted by YamiKaitou
View Post

That code looks like crap. Where is the indentation? How can you see which scope ends where?

Why does everything always have to end?
Why won’t somethings last forever?

.Dare Devil. is offline

Veteran Member

Eagle07's Avatar

Join Date: May 2014

Location: Morocco :D

Old

12-17-2014

, 17:16

 

Re: warning 217: loose indentation

Reply With Quote

#10


you can fix loose indentation just with ctrl + i (if you use AMXX_STUDIO )

__________________

Eagle07 is offline

Понравилась статья? Поделить с друзьями:
  • Warning 215 expression has no effect как исправить
  • Warning 1027 nemesis как исправить
  • Warn unexpected idcode 0x2ba01477 error expected 1 of 1 0x1ba01477
  • Warn generationtarget encountered exception accepting command error executing ddl
  • Warmos qx ошибка pl как исправить