Server unknown command как исправить samp

Здравствуйте форумчане У меня проблема не с командой а с SERVER:Unknown command. Я лазил по форуму искал, искал и нашел, но не то, что мне нужно. Ве...


#1

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

Отправлено 08 декабря 2012 — 16:07

  • ДЭЭМ, БООЙ

Здравствуйте форумчане

У меня проблема не с командой а с SERVER:Unknown command. Я лазил по форуму искал, искал и нашел, но не то, что мне нужно. Везде было только чтобы поменять эту надпись и «Команда работает но пишет SERVER:Unknown command.»

Проблема в том, что команда даже не работает. Просто напримерр ввожу /test и вылезает этот «паразит» Server: unknown command :biggrin: :biggrin: . Как это исправить? вот код>

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd, "/test", true))
	{
	    SetPlayerPos(playerid, 1412.0902,-1699.6783,13.5395);
		return 1;
	}
	return SendClientMessage(playerid,0xFFFFFFFF,"Команды не существует");
}

Помогите ув.Пользователи

1



#2

Отправлено 08 декабря 2012 — 17:58

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

p.s. если что я новичек
зачем «команды не существует»? может быть там надо вставить else?
и почему там ретурн так рано стоит?

0



#3

Отправлено 08 декабря 2012 — 18:04

  • Banned

SERVER:Unknown command. — ТАКОЙ КОМАНДЫ НЕСУЩЕСТВУЕТ !

1) Найди у себя в моде public OnPlayerCommandText

2) И туда в самый низ паблика, поставить вместо return 0; вот это:
return SendClientMessage(playerid,COLOR_WHITE,»Свой текст»);
Чтобы ничего непрописывалось , убери надпись в кавычках «Свой текст»


Если помог ставь +



#4

Отправлено 08 декабря 2012 — 18:07

  • ДЭЭМ, БООЙ

0



#5

Отправлено 08 декабря 2012 — 18:08

  • Banned

Просмотр сообщенияBiGGY (08 декабря 2012 — 17:58) писал:

p.s. если что я новичек
зачем «команды не существует»? может быть там надо вставить else?
и почему там ретурн так рано стоит?

Он написал «У меня проблема не с командой а с SERVER:Unknown command. «



#6

Отправлено 08 декабря 2012 — 18:10

  • ДЭЭМ, БООЙ

BiGGY, братан, return возвращает функцию. Этот return стоит как раз для public’a там не имеет разницы поставить 1 или SendClient… Функция все равно вернется.

Lev_Popov, Ну… Если бы была проблема с командой, я бы написал что с командой. А у меня ни одна команда не работает, и еще пишет эту херню.

0



#7

Отправлено 08 декабря 2012 — 19:42

  • ДЭЭМ, БООЙ

0



#8

Отправлено 08 декабря 2012 — 23:45

  • Знаток
public OnPlayerCommandText(playerid, cmdtext[])
{
        if(strcmp(cmdtext, "/test", true)) // cmdtext
        {
            SetPlayerPos(playerid, 1412.0902,-1699.6783,13.5395);
                return 1;
        }
        return SendClientMessage(playerid,0xFFFFFFFF,"Команды не существует");
}

1



#9

Отправлено 08 декабря 2012 — 23:51

  • ДЭЭМ, БООЙ

Просмотр сообщенияLittle (08 декабря 2012 — 23:45) писал:

public OnPlayerCommandText(playerid, cmdtext[])
{
        if(strcmp(cmdtext, "/test", true)) // cmdtext
        {
            SetPlayerPos(playerid, 1412.0902,-1699.6783,13.5395);
                return 1;
        }
        return SendClientMessage(playerid,0xFFFFFFFF,"Команды не существует");
}

ок, после проверю

0



#10

Отправлено 09 декабря 2012 — 09:20

  • Эксперт
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/text", cmdtext, true) == 0)
 	{
                // Тело команды
  		return 1;
	}
	
	return SendClientMessage(playerid, COLOR_RED, "x {FFFFFF}Команды не существует.");
}

1


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

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


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

Krutihine


  • #1

Многие знают что если пишешь неправильную команду в чат то пишет «SERVER:Unknown command». Сейчас я покажу как её убрать или заменить на свою

Идем в public OnPlayerCommandText, и он закрывается:

return 0;
}
И вместо этого ставим это:

return 1;
}
Вписали? Компилируем. И если нет ошибок то всё правильно.

Ах да, а вот если заменить на свою надпись

return SendClientMessage(playerid, 0xC3C3C3FF, «* Команды не существует, введите /help для просмотра доступных команд.»);
}

Всё очень просто…

Автор: **_**

Последнее редактирование модератором: 21.11.2014

LHTTD

LHTTD

Темная сторона Форума


  • #3

Лучше давно уже перейти на ZCMD,он более проще и быстрее работает чем strtok!!!

Mirex

Mirex

Руководитель проекта


  • #4

Лучше давно уже перейти на ZCMD,он более проще и быстрее работает чем strtok!!!

Если переходить с одного командного процессора на другой, так лучше уж нынче использовать dc_cmd. 

LHTTD

LHTTD

Темная сторона Форума


  • #5

Если переходить с одного командного процессора на другой, так лучше уж нынче использовать dc_cmd. 

dc_cmd слабоват тем более еще плагин нужен…

Mirex

Mirex

Руководитель проекта


  • #6

dc_cmd слабоват тем более еще плагин нужен…

Слабоват? Вы тесты скорости смотрели? DC_CMD у ZCMD во много выигрывает.

SCRIPTMAN


  • #7

Слушай, у меня если вводишь не верную команду, он просто ничего не делает, а как сделать чтобы он писал, что неверная команда?

  • #9

@SHOROOP, OnPlayerCommandPerformed, если быть точнее.

SCRIPTMAN


  • #10

OnPlayerCommandRecieved()

Нет такого

SHOROOP


  • #11

@JoKeR2020, OnPlayerCommandPerformed() вызывается сразу после выполнения команды. OnPlayerCommandRecieved() — до выполнения. Зачем лишний раз гонять командный процессор проверять наличие несуществующей команды, особенно если здесь же можно вернуть 0 и запретить выполнение?

@Дима Рок, доки по DC_CMD почитайте. Это нативная функция плагина.

Последнее редактирование модератором: 03.02.2016

  • #12

@SHOROOP, ты хочешь что ли проверять наличие команды в Recieved? Ну тогда ещё нормально.

singam


Iliya_Stift

Регистрация
26 Янв 2012
Сообщения
243
Лучшие ответы
0
Репутация
46
Адрес

СБГ

  • #1

Всем привет! Долго искал решение проблемы связанной с SERVER: Unknown Command, пока не нашел решение на wiki.sa-mp.com (Не реклама)Вот решил выложить его сюда, так-ка много было вопросов связанных именно с этой темой
Начнем пожалуй

Параметры:

PHP:

(playerid,cmdtext[])
playerid	ID игрока, набравшего команду.
cmdtext[]	Набранная команда(включая '/').

PHP:

Возвращает	 Возвращает 0 когда набранная команда не была найдена; В случае если команда не была найдена ни в моде ни в скрипте, игроку будет выслано сообщение белым цветом 'SERVER: Unknown command'

Пример:

PHP:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: This is the /help command!");
        return 1;
        /* Возврат '1' использован чтобы дать серверу понять что команда найдена
        и работает исправно. Если вы не поставите эту строчку, то игроку будет
        выслано сообщение 'SERVER: Unknown Command.' после выполнения команды. 
        */
    }
    return 0;
/* Возврат '0' использован чтобы дать серверу понять что команда не найдена
и не работает, и указывает серверу что этой команды нет ни в моде ни в скрипте.
*/
}

Вот и все, мб кому-нибудь пригодится. Похожих тем на портале не обнаружил, ну а если такие темы и существую, то простите(

Posts: 61
Threads: 8
Joined: Jan 2013

Reputation:

0

04.07.2014, 01:26

(

Last edited by Timeless; 04/07/2014 at 09:48 AM.

)

I’m gonna show you guys a tutorial on how to turn off or change the «Server Unknown Command» text when using ZCMD

First of all if you’re not sure on which command processor is ZCMD then this is ZCMD https://sampforum.blast.hk/showthread.php?tid=91354 thats the processor i’m going to explain

some usage of ZCMD and this feature can work for all of them

Example of some usage:

PHP Code:



COMMAND:mycommand(playeridparams[]) // or CMD:mycommand(playerid, params[]) 

{

  
// Do something

  
return 1






or

PHP Code:



command(mycommandplayeridparams[]) // or cmd(mycommand, playerid, params[])

{

  
// Do something

  
return 1






or

PHP Code:



CMD:mycommand(playeridparams[])

{

//Do something 

   
return 1;






normally to change the «Server:Unknown Command» text is using

PHP Code:



public OnPlayerCommandText(playeridcmdtext[])

{

    if (
strcmp("/mycommand"cmdtexttrue10) == 0)

    {

        
// Do something here

        
return 1;

    }

    return 
0;






however thats not needed when using ZCMD this is much faster and easier.
To change the message we have to use a callback called

PHP Code:



 public OnPlayerCommandPerformedplayeridcmdtext[ ], success 




we will add these lines to our callback

PHP Code:





 
if (!success)

    {

       
//----- your invalid command text to show would go here 

    





so now it would look like this

PHP Code:



public OnPlayerCommandPerformed(playeridcmdtext[], success)

{

    if (!
success)

    {

       /<---- 
your invalid command text to show would go here

    
}

    return 
0;






now we add our invalid command text to the callback

PHP Code:



public OnPlayerCommandPerformed(playeridcmdtext[], success)

{

    if (!
success)

    {

       
SendClientMessage(playerid,COLOR_RED,"Hey you enterred a wrong command");

    }

    return 
0;






now if you don’t to have «Server:Unknown Command» being spammed everytime you succesfully did a command? we simple locate the return value in the callback and instead of having 0 we change it to 1 and voila!

PHP Code:



public OnPlayerCommandPerformed(playeridcmdtext[], success)

{

    if (!
success)

    {

       
SendClientMessage(playerid,COLOR_RED,"Hey you enterred a wrong command");

    }

    return 
1;






and thats it your «Server:Unknown Command» is changed

COMMON ERRORS:
i’ve seen a few statements like this

1.

PHP Code:



public OnPlayerCommandPerformed(playeridcmdtext[], success)

{

    return 
SendClientMessage(playerid,COLOR_RED,"Hey you typed a wrong command"); // you can change the text to whatever you want to suit your server 




However this would work but the invalid command text would be spammed everytime you do a command.

2.

PHP Code:



public OnPlayerCommandPerformedplayeridcmdtext[ ], success )

{

    if( 
success == )

        return 
SendClientMessageplayeridCOLOR"Your new unknown command text" );






that won’t work as the pawno compiler will give you a warning like this

PHP Code:



warning 209: function "OnPlayerCommandPerformed" should return a value 




and if you try correcting this warning by creating a return value like this it would give you an unreachable code warning

PHP Code:



public OnPlayerCommandPerformedplayeridcmdtext[ ], success )

{

    if( 
success == )

    {

       
     }

     return 

SendClientMessageplayeridCOLOR"Your new unknown command text" );

     return 
0;






and if you have something like this it won’t work either
3.

PHP Code:



public OnPlayerCommandPerformedplayeridcmdtext[ ], success )

{

    if( 
success == )

    {

        
     }

     return 

SendClientMessageplayeridCOLOR"Your new unknown command text" );






cause your just basically telling the server to spam «your new unknown command text» every time a command is performed

now if you want to get rid of this text completely without displaying any message? we simply go back to the return value and instead of displaying a message we simply change the «0» to a «1»

like this

PHP Code:



public OnPlayerCommandPerformed(playeridcmdtext[], success)

{

    return 
1;//If player writes command wrong this will still return it as a true and the message will not be displayed






so now the no text will be displayed if a player types an invalid command

I hoped you understood the tutorial and i hoped it helped someone out there cause i haven’t found any tutorials with this so i just thought i should create one

Posts: 678
Threads: 16
Joined: Apr 2014

Reputation:

0

Nice

Posts: 61
Threads: 8
Joined: Jan 2013

Reputation:

0

Quote:

Originally Posted by SturtIndia
View Post

Nice

Thank you hope it helped

Posts: 584
Threads: 51
Joined: Jan 2014

Reputation:

0

I like to use the cmdtext[] parameter. Format the message in a string, for example:

pawn Code:

format(string, sizeof(string), "Hey! %s isn't a valid command!", cmdtext);

But nice for people who don’t know how to do this

Posts: 605
Threads: 83
Joined: Apr 2014

Reputation:

0

Posts: 168
Threads: 9
Joined: Feb 2013

Reputation:

0

You can do this, too (untested, but compiles):

pawn Code:

public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
    return ( !success ) ? ( SendClientMessage( playerid, -1, ">> That command doesn't exist! (/cmds)" ), 1 ) : ( 1 );

Anyways, my suggestion is, rename the topic (ask a moderator) to OnPlayerCommandPerformed tutorial, and add everything you know, like:
>> Player must spawn before using any commands
>> Player must be logged in before using any commands
>> etcetera.

Posts: 864
Threads: 57
Joined: Jan 2013

Reputation:

0

@Greentarch : This one looks clearer :

PHP Code:





public OnPlayerCommandPerformedplayeridcmdtext[ ], success )

{

      return 
success SendClientMessage(playerid, -1">> That command doesn't exist! (/cmds)");






The wiki says that «SendClientMessage» returns 1 if the function executes successful. This way, returning 1 just after that would be a bit useless.

@Author : Some parts of your «COMMON ERRORS» are very bad coded.

I take this code as an example :

pawn Code:

public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {

             }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
     return 0;
}

It won’t work as a solution ! You’ll even get an error during the compilation !

This one would work :

pawn Code:

public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if(!success) return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
    return 1;
}

Because as Zeex said :

Quote:

Originally Posted by Zeex

pawn Code:

OnPlayerCommandPerformed(playerid, cmdtext[], success)

And this one gets called after command execution,

here if you do «return 0» the player will see standard «Unknown command» message

. The «success» parameter is equal to value returned by command function returns (if it doesn’t exist success will be 0).

Correct your whole tutorial please.

Posts: 61
Threads: 8
Joined: Jan 2013

Reputation:

0

Quote:

Originally Posted by S4t3K
View Post

@Author : Some parts of your «COMMON ERRORS» are very bad coded.

I take this code as an example :

pawn Code:

public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {

             }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
     return 0;
}

It won’t work as a solution ! You’ll even get an error during the compilation !

This one would work :

pawn Code:

public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if(!success) return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
    return 1;
}

Correct your whole tutorial please.

FYI the errors i have there are common mistakes i picked up from other help request threads not my codes. meaning people make common mistakes duh every code i placed there was tested before placing, its my method of coding that works, i share my work.if u test it the way i said it wud turn out exactly as i said in conclusion everything is placed the way it should be.

Posts: 864
Threads: 57
Joined: Jan 2013

Reputation:

0

Well, tell me how this is supposed to work and translate it step-to-step for a newbie like me.

PHP Code:




public OnPlayerCommandPerformedplayeridcmdtext[ ], success 

    if( 
success == 
    { 

             } 
     return 

SendClientMessageplayeridCOLOR"Your new unknown command text" ); 
     return 
0





Because the way I have understood it is :

PHP Code:




public OnPlayerCommandPerformedplayeridcmdtext[ ], success )  // Entering the callback

    if( 
success == // If the command doesn't exist
    

        
// Do...nothing ?
     

     return 
SendClientMessageplayeridCOLOR"Your new unknown command text" ); // In any case, we have to return a message and to get a "warning : unrecheable code" for the return 0 placed just below.
     
return 0





Posts: 61
Threads: 8
Joined: Jan 2013

Reputation:

0

Quote:

Originally Posted by S4t3K
View Post

Well, tell me how this is supposed to work and translate it step-to-step for a newbie like me.

PHP Code:





public OnPlayerCommandPerformedplayeridcmdtext[ ], success 



    if( 
success == 

    { 

        
     } 

     return 

SendClientMessageplayeridCOLOR"Your new unknown command text" ); 

     return 
0






Because the way I have understood it is :

PHP Code:





public OnPlayerCommandPerformedplayeridcmdtext[ ], success )  // Entering the callback



    if( 
success == // If the command doesn't exist

    


        
// Do...nothing ?

     


     return 
SendClientMessageplayeridCOLOR"Your new unknown command text" ); // In any case, we have to return a message and to get a "warning : unrecheable code" for the return 0 placed just below.

     
return 0






lol thats one the common erors btw not the working code thats if the person try to correct the warning «onplayercommandperformed should have a return vale» i said so in the tutorial because it wud be expected however wrong..»COMMON ERROS», are you trying to say i didn’t explain it good enough?

[Урок] Решение Мод «Unknown»

Голубь Дата: Понедельник, 30.04.2012, 18:10 | Сообщение # 1

Авторитет

Статус: Offline

У некоторых есть проблема, мод не грузит, пишет «Unknown»
Как исправить:
1. Загрузить в plugins файл «streamer.dll» (Win), или «streamer.so» (Linux обычно хосты не нем все)
2. В server.cfg — строка «plugins streamer»
3. Включить сервер
4. Проблема исправлена


двач
https://vk.com/povargek

Сообщение отредактировал [CM]MaddysonСреда, 02.05.2012, 13:30

McDonald777 Дата: Воскресенье, 17.11.2013, 12:46 | Сообщение # 2

Блин я не могу разобраться.


Саня

L0ney Дата: Понедельник, 18.11.2013, 12:30 | Сообщение # 3

McDonald777, в чем именно напиши в ля или сюда помогу


Ни чего не продаю/покупаю.

С деньгами можешь купить положение, но не уважение

Donny[CM] Дата: Понедельник, 18.11.2013, 18:56 | Сообщение # 4

Cпасибо :3


Мои пожелания :

Набить 100 репы[✔]
Набить 300 репы[✔]
Набить 500 репы[ — ]

Набить 50 сообщений[✔]
Набить 100 сообщений[✔]
Набить 200 сообщений[ — ]
Быть на СМ 20 дней[✔]
Быть на СМ 50 дней[ — ]

MiseG Дата: Понедельник, 23.12.2013, 09:40 | Сообщение # 5

Не помогло :С


— Набрать 50+ репутации[ ✔ ]
— Набрать 100+ репутации[ ✔ ]
— Набрать 250+ репутации[ ✔ ]
— Набрать 500+ репутации[ ✔ ]
— Набрать 1000+ репутации[ ✖ ]
______
— Набрать 50+ сообщение [ ✔ ]
— Набрать 100+ сообщений [ ✖ ]
— Набрать 500+ сообщений [ ✖ ]
— Набрать 1000+ сообщений [ ✖ ]
_______
— Стать «Cheater [CM]» [ ✖ ]
— Ставь «Клан [CM]» [ ✖ ]
— Стать модератором. [ ✖ ]

SeX-PrO-AdReNaLiN Дата: Понедельник, 23.12.2013, 18:33 | Сообщение # 6

Авторитет

Статус: Offline

Во многих случаев это происходит не из за стримера,нужно прописать все нужные плагины в server.cfg


user N over 99999

[CM]Sam1337 Дата: Вторник, 24.12.2013, 15:16 | Сообщение # 7

Прикольно

[CM]Sony228 Дата: Понедельник, 03.02.2014, 21:19 | Сообщение # 8

Не помогло :с


Помогаю новичкам. Писать в ЛС

DrumKee Дата: Среда, 05.02.2014, 18:35 | Сообщение # 9

Урок бредовый скажу я это, потому-что не только из-за стримера происходит эта ошибка.

main() { } в начало скрипта PAWN

или же как тебе понравится

main()
{
printf(«text»);
}

Сообщение отредактировал DrumKeeСреда, 05.02.2014, 18:35

CM_ACTronafT Дата: Четверг, 06.02.2014, 19:11 | Сообщение # 10

I ♥ КОСМОС

Статус: Offline

о, давно искал, спасибо.


Связь со мной:
SKYPE: vadimkech5758
VK: vk.com/neko_m1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
МОИ РЕКВЕЗИТЫ WMR/WMU
Russia: R422373773053
Ukraina: U132103362304
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Saint[yl] Дата: Четверг, 06.02.2014, 20:19 | Сообщение # 11

^^SвYтый YлЬка

Статус: Offline

В основном данная проблема появляется из-за перечисленных тут причин:
1. Не загружаются нужные плагины (В инклюдах стример, сканф, мускул и т.д.): выходом является простое решение, ввести в server.cfg в строке plugins нужный плагин, закинуть плагин в папку ‘plugins’, если есть то лучше обновить их и обновить инклюды в папке pawno.
2. Удален main(): В этом случае мод может работать стабильно, но выдает ошибку.
3. Нестабильность мода: В этом случае нужно заняться оптимизацией мода, в 90% случаев скриптер находит свою ошибку именно при оптимизации, все может начинаться с огромных ошибок с распределению памяти, заканчивая огромной кипой маленьких ошибок, которые могут в последствии просто выкинуть сервер на котором стоит мод на полку мусора. (Бывает даже то, что вы делите на ноль, но это могут избранные)


==========================
[+] Skype: saint.yl
[+] ВКонтакте: vk.com/saintyl
==========================

Ничего Не покупаю / Не продаю

[CM]Logotipo Дата: Среда, 19.02.2014, 22:40 | Сообщение # 12

Авторитет

Статус: Offline

В windows нужно без «.dll» писать.


Скуп
ВК
RakDroid — прокачка аккаунтов с телефона
VKMusic — вк музыка без браузера
Делаю сайты/софт/стимботов на заказ

[CM]Montano Дата: Пятница, 21.02.2014, 01:48 | Сообщение # 13

TOP SELLER

Статус: Offline

Во,спасибо автор.


Самые дешевые и жирные аккаунты у меня в шопе. Успей купить!

JockerMD Дата: Среда, 09.04.2014, 13:25 | Сообщение # 14

Не один мод на MSQL не работает.. все время Uknown! Плагины скачивал с форума самп обновлял. Но этот uknow С*КА до сих пор сидит…

iBreezy Дата: Среда, 09.04.2014, 20:20 | Сообщение # 15

Для новичкой очень полезно!!!

  • Страница 1 из 2
  • 1
  • 2
  • »

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Server terminated with error 1 closing log file
  • Server side error перевод
  • Server side error handling
  • Server sent disconnect message type 2 protocol error the connection is closed by ssh server
  • Server selection error server selection timeout current topology

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии