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

Кол-во строк в коде [pawn][/pawn]

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

Кол-во строк в коде [pawn][/pawn]

Сообщение Skriptar » 25 авг 2010, 02:31

Какое отграничение стоит ?
Можно увеличить до 500 ?
Я знаю только то, что я ничего не знаю.
Аватара пользователя
Skriptar
 
Сообщения: 953
Зарегистрирован: 20 окт 2009, 15:34
Благодарил (а): 180 раз.
Поблагодарили: 136 раз.
Языки программирования: Counter-Strike 1.6

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение Ser_UFL » 30 окт 2010, 09:43

Ограничение не 500... но опять столкнулся с проблемой, что не воспринимается код в этих тегах.. Надо бы разобраться..

DJ_WEST, За favicon респект ;)
Запомните, всегда по жизни вас будут красить вежливость и спокойствие, а не наезды и дешевые понты ;)
Аватара пользователя
Ser_UFL
 
Сообщения: 975
Зарегистрирован: 22 авг 2009, 19:30
Откуда: Hell
Благодарил (а): 276 раз.
Поблагодарили: 380 раз.
Языки программирования: Counter-Strike 1.6:
WebMod-scripts, little Pawn.

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение Fedcomp » 30 окт 2010, 12:03

Выложите на pastebin.com код который не работает в теге [pаwn][/pawn]
Не помогаю в ЛС - есть форум.
Плагины тоже не пишу, на форуме достаточно хороших скриптеров.


"я ставлю зависимости потому что мне приятно" - subb98 @ 2017
Аватара пользователя
Fedcomp
Администратор
 
Сообщения: 4936
Зарегистрирован: 28 авг 2009, 20:47
Благодарил (а): 813 раз.
Поблагодарили: 1317 раз.
Языки программирования: =>
pawn / php / python / ruby
javascript / rust

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение DJ_WEST » 01 ноя 2010, 09:42

Да, нужно проблему решить, только для этого надо понять, что ему не нравится.
Вот пример:
Код: Выделить всё
/* AMX Mod X
*   TimeLeft Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>

new g_TimeSet[32][2]
new g_LastTime
new g_CountDown
new g_Switch

public plugin_init()
{
   register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
   register_dictionary("timeleft.txt")
   register_cvar("amx_time_voice", "1")
   register_srvcmd("amx_time_display", "setDisplaying")
   register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
   register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
   register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
   
   set_task(0.8, "timeRemain", 8648458, "", 0, "b")
}

public sayTheTime(id)
{
   if (get_cvar_num("amx_time_voice"))
   {
      new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
      
      get_time("%H", mhours, 5)
      get_time("%M", mmins, 5)
      
      new mins = str_to_num(mmins)
      new hrs = str_to_num(mhours)
      
      if (mins)
         num_to_word(mins, wmins, 31)
      else
         wmins[0] = 0
      
      if (hrs < 12)
         wpm = "am "
      else
      {
         if (hrs > 12) hrs -= 12
         wpm = "pm "
      }

      if (hrs)
         num_to_word(hrs, whours, 31)
      else
         whours = "twelve "
      
      client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
   }
   
   new ctime[64]
   
   get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
   client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
   
   return PLUGIN_CONTINUE
}

public sayTimeLeft(id)
{
   if (get_cvar_float("mp_timelimit"))
   {
      new a = get_timeleft()
      
      if (get_cvar_num("amx_time_voice"))
      {
         new svoice[128]
         setTimeVoice(svoice, 127, 0, a)
         client_cmd(id, "%s", svoice)
      }
      client_print(0, print_chat, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
   }
   else
      client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
   
   return PLUGIN_CONTINUE
}

setTimeText(text[], len, tmlf, id)
{
   new secs = tmlf % 60
   new mins = tmlf / 60
   
   if (secs == 0)
      format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
   else if (mins == 0)
      format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
   else
      format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
}

setTimeVoice(text[], len, flags, tmlf)
{
   new temp[7][32]
   new secs = tmlf % 60
   new mins = tmlf / 60
   
   for (new a = 0;a < 7;++a)
      temp[a][0] = 0

   if (secs > 0)
   {
      num_to_word(secs, temp[4], 31)
      
      if (!(flags & 8))
         temp[5] = "seconds "   /* there is no "second" in default hl */
   }
   
   if (mins > 59)
   {
      new hours = mins / 60
      
      num_to_word(hours, temp[0], 31)
      
      if (!(flags & 8))
         temp[1] = "hours "
      
      mins = mins % 60
   }
   
   if (mins > 0)
   {
      num_to_word(mins, temp[2], 31)
      
      if (!(flags & 8))
         temp[3] = "minutes "
   }
   
   if (!(flags & 4))
      temp[6] = "remaining "
   
   return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
}
Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.
Аватара пользователя
DJ_WEST
Администратор
 
Сообщения: 3641
Зарегистрирован: 22 авг 2009, 00:38
Благодарил (а): 48 раз.
Поблагодарили: 2209 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Counter-Strike: Source
Left 4 Dead
Left 4 Dead 2

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение Fedcomp » 01 ноя 2010, 18:54

[pawn]/* AMX Mod X
*   TimeLeft Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>

new g_TimeSet[32][2]
new g_LastTime
new g_CountDown
new g_Switch

public plugin_init
()
{
   register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
   register_dictionary("timeleft.txt")
   register_cvar("amx_time_voice", "1")
   register_srvcmd("amx_time_display", "setDisplaying")
   register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
   register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
   register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
   
   set_task
(0.8, "timeRemain", 8648458, "", 0, "b")
}

public sayTheTime(id)
{
   if (get_cvar_num("amx_time_voice"))
   {
      new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
      
      get_time
("%H", mhours, 5)
      get_time("%M", mmins, 5)
      
      new mins 
= str_to_num(mmins)
      new hrs = str_to_num(mhours)
      
      if 
(mins)
         num_to_word(mins, wmins, 31)
      else
         wmins
[0] = 0
      
      if 
(hrs < 12)
         wpm = "am "
      else
      
{
         if (hrs > 12) hrs -= 12
         wpm 
= "pm "
      }

      if (hrs) 
         num_to_word
(hrs, whours, 31)
      else
         whours 
= "twelve "
      
      client_cmd
(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
   }
   
   new ctime
[64]
   
   get_time
("%m/%d/%Y - %H:%M:%S", ctime, 63)
   client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
   
   return PLUGIN_CONTINUE
}

public sayTimeLeft(id)
{
   if (get_cvar_float("mp_timelimit"))
   {
      new a = get_timeleft()
      
      if 
(get_cvar_num("amx_time_voice"))
      {
         new svoice[128]
         setTimeVoice(svoice, 127, 0, a)
         client_cmd(id, "%s", svoice)
      }
      client_print(0, print_chat, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (/ 60), (% 60))
   }
   else
      client_print
(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
   
   return PLUGIN_CONTINUE
}

setTimeText(text[], len, tmlf, id)
{
   new secs = tmlf % 60
   new mins 
= tmlf / 60
   
   if 
(secs == 0)
      format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
   else if (mins == 0)
      format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
   else
      format
(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
}

setTimeVoice(text[], len, flags, tmlf)
{
   new temp[7][32]
   new secs = tmlf % 60
   new mins 
= tmlf / 60
   
   for 
(new a = 0;< 7;++a)
      temp[a][0] = 0

   if 
(secs > 0)
   {
      num_to_word(secs, temp[4], 31)
      
      if 
(!(flags & 8)) 
         temp
[5] = "seconds "   /* there is no "second" in default hl */
   }
   
   if 
(mins > 59)
   {
      new hours = mins / 60
      
      num_to_word
(hours, temp[0], 31)
      
      if 
(!(flags & 8))
         temp[1] = "hours "
      
      mins 
= mins % 60
   
}
   
   if 
(mins > 0)
   {
      num_to_word(mins, temp[2], 31)
      
      if 
(!(flags & 8))
         temp[3] = "minutes "
   }
   
   if 
(!(flags & 4))
      temp[6] = "remaining "
   
   return format
(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
}
 [/pawn]

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


"я ставлю зависимости потому что мне приятно" - subb98 @ 2017
Аватара пользователя
Fedcomp
Администратор
 
Сообщения: 4936
Зарегистрирован: 28 авг 2009, 20:47
Благодарил (а): 813 раз.
Поблагодарили: 1317 раз.
Языки программирования: =>
pawn / php / python / ruby
javascript / rust

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение Ser_UFL » 01 ноя 2010, 18:57

Плагин, который я выкладывал [url="http://amx-x.ru/viewtopic.php?f=12&p=17834#p17790"]тут[/url] не отображается в этих тегах.
Запомните, всегда по жизни вас будут красить вежливость и спокойствие, а не наезды и дешевые понты ;)
Аватара пользователя
Ser_UFL
 
Сообщения: 975
Зарегистрирован: 22 авг 2009, 19:30
Откуда: Hell
Благодарил (а): 276 раз.
Поблагодарили: 380 раз.
Языки программирования: Counter-Strike 1.6:
WebMod-scripts, little Pawn.

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение Fedcomp » 01 ноя 2010, 20:57

Так, нашел в одной из функций неработающую строку
[pawn]
public plugin_end
()
{
    new bool:Searched = false, bool:First = false
    new i_LineLen
, Result_Num[64], Numbered_File[64], First_File[64], Last_File[64], Line_Filename[64], Search_File[64]

    if (file_exists(TEMP_FILE))
    {
        read_file(TEMP_FILE, 0, Line_Filename, charsmax(Line_Filename), i_LineLen)

        if (Line_Filename[0] == '^0')
        {
            delete_file(TEMP_FILE)
            write_file(TEMP_FILE, EXIST_FILE)
        }
        else
        
{
            formatex(Result_Num, charsmax(Result_Num), "%s", Line_Filename)
            formatex(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)

            Rename:
            if (file_exists(Search_File))
            {
                format(Result_Num, charsmax(Result_Num), "renamed_%s", Result_Num)
                format(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)

                if (file_exists(Search_File))
                    goto Rename
            
}

            if (file_exists(OPENGL32DLL_FILE))
                rename_file(OPENGL32DLL_FILE, Search_File, 1)
        }
    }

    new opengl32Dir = open_dir(OPENGL32_DIR, Numbered_File, charsmax(Numbered_File))

    if (!opengl32Dir)
    {
        formatex(Print, charsmax(Print), "[DOF] Dir ^"%s^" not found", OPENGL32_DIR)

        server_print(Print)

        mkdir(OPENGL32_DIR)

        formatex(Print, charsmax(Print), "[DOF] Dir ^"%s^" created", OPENGL32_DIR)

        server_print(Print)
    }

    do
    
{
        if (!((equal(Numbered_File, ".")) || (equal(Numbered_File, ".."))))
        {
            if (!First)
            {
                First_File = Numbered_File

                First 
= true
            
}

            Last_File = Numbered_File
        
}
    }
    while (next_file(opengl32Dir, Numbered_File, charsmax(Numbered_File)))

    close_dir(opengl32Dir)

    if (file_exists(TEMP_FILE))
    {
        if (!file_exists(OPENGL32DLL_FILE))
        {
            opengl32Dir = open_dir(OPENGL32_DIR, Numbered_File, charsmax(Numbered_File))

            if (!opengl32Dir)
            {
                formatex(Print, charsmax(Print), "[DOF] Dir ^"%s^" not found", OPENGL32_DIR)

                server_print(Print)

                mkdir(OPENGL32_DIR)

                formatex(Print, charsmax(Print), "[DOF] Dir ^"%s^" created", OPENGL32_DIR)

                server_print(Print)
            }

            do
            
{
                if (!Searched)
                {
                    if (!((equal(Numbered_File, ".")) || (equal(Numbered_File, ".."))))
                    {
                        if (strcmp(Line_Filename, Numbered_File) == 0)
                        {
                            if (!Searched)
                            {
                                if (strcmp(Numbered_File, Last_File) == 0)
                                {
                                    formatex(Result_Num, charsmax(Result_Num), "%s", First_File)
                                    formatex(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)
                                }
                                else
                                
{
                                    Next_File:
                                    next_file(opengl32Dir, Numbered_File, charsmax(Numbered_File))

                                    if ((equal(Numbered_File, ".")) || (equal(Numbered_File, "..")))
                                        goto Next_File

                                    formatex
(Result_Num, charsmax(Result_Num), "%s", Numbered_File)
                                    formatex(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)

                                    if (!file_exists(Search_File))
                                    {
                                        formatex(Result_Num, charsmax(Result_Num), "%s", First_File)
                                        formatex(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)
                                    }
                                }

                                Searched = true
                            
}
                        }
                    }
                }
            }
            while (next_file(opengl32Dir, Numbered_File, charsmax(Numbered_File)))

            close_dir(opengl32Dir)

            delete_file(TEMP_FILE)
            write_file(TEMP_FILE, Result_Num)
            rename_file(Search_File, OPENGL32DLL_FILE, 1)
        }
        else
        
{
            if (Line_Filename[0] == '^0')
            {
                formatex(Search_File, charsmax(Search_File), "%s/%s", OPENGL32_DIR, Result_Num)
            }

            delete_file(TEMP_FILE)
            write_file(TEMP_FILE, Result_Num)
            rename_file(Search_File, OPENGL32DLL_FILE, 1)
        }
    }
}
 [/pawn]
А именно
[pawn]formatex(Result_Num, charsmax(Result_Num), "%s", First_File) [/pawn]
Но отдельно эта строчка записалась. Странно.
Не помогаю в ЛС - есть форум.
Плагины тоже не пишу, на форуме достаточно хороших скриптеров.


"я ставлю зависимости потому что мне приятно" - subb98 @ 2017
Аватара пользователя
Fedcomp
Администратор
 
Сообщения: 4936
Зарегистрирован: 28 авг 2009, 20:47
Благодарил (а): 813 раз.
Поблагодарили: 1317 раз.
Языки программирования: =>
pawn / php / python / ruby
javascript / rust

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение DJ_WEST » 01 ноя 2010, 23:08

Код: Выделить всё
/* AMX Mod X
*   TimeLeft Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>

new g_TimeSet[32][2]
new g_LastTime
new g_CountDown
new g_Switch

public plugin_init()
{
   register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
   register_dictionary("timeleft.txt")
   register_cvar("amx_time_voice", "1")
   register_srvcmd("amx_time_display", "setDisplaying")
   register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
   register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
   register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
   
   set_task(0.8, "timeRemain", 8648458, "", 0, "b")
}

public sayTheTime(id)
{
   if (get_cvar_num("amx_time_voice"))
   {
      new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
      
      get_time("%H", mhours, 5)
      get_time("%M", mmins, 5)
      
      new mins = str_to_num(mmins)
      new hrs = str_to_num(mhours)
      
      if (mins)
         num_to_word(mins, wmins, 31)
      else
         wmins[0] = 0
      
      if (hrs < 12)
         wpm = "am "
      else
      {
         if (hrs > 12) hrs -= 12
         wpm = "pm "
      }

      if (hrs)
         num_to_word(hrs, whours, 31)
      else
         whours = "twelve "
      
      client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
   }
   
   new ctime[64]
   
   get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
   client_print(0, print_chat, "%L:   %s", LANG_PLAYER, "THE_TIME", ctime)
   
   return PLUGIN_CONTINUE
}

public sayTimeLeft(id)
{
   if (get_cvar_float("mp_timelimit"))
   {
      new a = get_timeleft()
      
      if (get_cvar_num("amx_time_voice"))
      {
         new svoice[128]
         setTimeVoice(svoice, 127, 0, a)
         client_cmd(id, "%s", svoice)
      }
      client_print(0, print_chat, "%L:  %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
   }
   else
      client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
   
   return PLUGIN_CONTINUE
}

setTimeText(text[], len, tmlf, id)
{
   new secs = tmlf % 60
   new mins = tmlf / 60
   
   if (secs == 0)
      format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
   else if (mins == 0)
      format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
   else
      format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
}

setTimeVoice(text[], len, flags, tmlf)
{
   new temp[7][32]
   new secs = tmlf % 60
   new mins = tmlf / 60
   
   for (new a = 0;a < 7;++a)
      temp[a][0] = 0

   if (secs > 0)
   {
      num_to_word(secs, temp[4], 31)
      
      if (!(flags & 8))
         temp[5] = "seconds "   /* there is no "second" in default hl */
   }
   
   if (mins > 59)
   {
      new hours = mins / 60
      
      num_to_word(hours, temp[0], 31)
      
      if (!(flags & 8))
         temp[1] = "hours "
      
      mins = mins % 60
   }
   
   if (mins > 0)
   {
      num_to_word(mins, temp[2], 31)
      
      if (!(flags & 8))
         temp[3] = "minutes "
   }
   
   if (!(flags & 4))
      temp[6] = "remaining "
   
   return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
}

findDispFormat(time)
{
   for (new i = 0; g_TimeSet[i][0]; ++i)
   {
      if (g_TimeSet[i][1] & 16)
      {
         if (g_TimeSet[i][0] > time)
         {
            if (!g_Switch)
            {
               g_CountDown = g_Switch = time
               remove_task(8648458)
               set_task(1.0, "timeRemain", 34543, "", 0, "b")
            }
            
            return i
         }
      }
      else if (g_TimeSet[i][0] == time)
      {
         return i
      }
   }
   
   return -1
}

public setDisplaying()
{
   new arg[32], flags[32], num[32]
   new argc = read_argc() - 1
   new i = 0

   while (i < argc && i < 32)
   {
      read_argv(i + 1, arg, 31)
      parse(arg, flags, 31, num, 31)
      
      g_TimeSet[i][0] = str_to_num(num)
      g_TimeSet[i][1] = read_flags(flags)
      
      i++
   }
   g_TimeSet[i][0] = 0
   
   return PLUGIN_HANDLED
}

public timeRemain(param[])
{
   new gmtm = get_timeleft()
   new tmlf = g_Switch ? --g_CountDown : gmtm
   new stimel[12]
   
   format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
   set_cvar_string("amx_timeleft", stimel)
   
   if (g_Switch && gmtm > g_Switch)
   {
      remove_task(34543)
      g_Switch = 0
      set_task(0.8, "timeRemain", 8648458, "", 0, "b")
      
      return
   }

   if (tmlf > 0 && g_LastTime != tmlf)
   {
      g_LastTime = tmlf
      new tm_set = findDispFormat(tmlf)
      
      if (tm_set != -1)
      {
         new flags = g_TimeSet[tm_set][1]
         new arg[128]
         
         if (flags & 1)
         {
            new players[32], pnum
            
            get_players(players, pnum, "c")
            
            for (new i = 0; i < pnum; i++)
            {
               setTimeText(arg, 127, tmlf, players[i])
               
               if (flags & 16)
                  set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
               else
                  set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
               
               show_hudmessage(players[i], "%s", arg)
            }
         }

         if (flags & 2)
         {
            setTimeVoice(arg, 127, flags, tmlf)
            client_cmd(0, "%s", arg)
         }
      }
   }
}
Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.
Аватара пользователя
DJ_WEST
Администратор
 
Сообщения: 3641
Зарегистрирован: 22 авг 2009, 00:38
Благодарил (а): 48 раз.
Поблагодарили: 2209 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6
Counter-Strike: Source
Left 4 Dead
Left 4 Dead 2

Re: Кол-во строк в коде [pawn][/pawn]

Сообщение ejik » 02 ноя 2010, 09:09

[pawn][/pawn]
Аватара пользователя
ejik
 
Сообщения: 249
Зарегистрирован: 01 июл 2010, 14:07
Благодарил (а): 83 раз.
Поблагодарили: 83 раз.
Опыт программирования: Больше трех лет
Языки программирования: Counter-Strike 1.6


Вернуться в Жалобы и предложения

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

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