[Plugin] Pawn.CMD

Someone will help? When I'm in the arena and wants to go out with the command / aexit writes "you are in the arena enter / aexit"

if(BlockArena[playerid] >= 1)
{
if(strfind(params,"/aexit",true) == 0) return 1;
SendClientMessage(playerid,COLOR_RED2, "›› |błąd| Jesteś na arenie wpisz /aexit.");
return 0;
}
Reply

I'll resume this in one word:
Amaaaazing.

їYou will develope more versions/updates?
Reply

Can we deactivate commands per player?
Reply

Quote:
Originally Posted by Dayrion
View Post
Can we deactivate commands per player?
Code:
new bool: actived[MAX_PLAYERS] = true;

CMD:example(id, params[]) {
if (!actived[id]) return 1;
//.......
return 1;
}
This?
Reply

Quote:
Originally Posted by RakeDW
Посмотреть сообщение
Код:
new bool: actived[MAX_PLAYERS] = true;

CMD:example(id, params[]) {
if (!actived[id]) return 1;
//.......
return 1;
}
This?
Nop... It's better via callback OnPlayerCommandReceived

Код:
new bool:active[MAX_PLAYERS];

public OnPlayerCommandReceived(...)
{
     if(!active[playerid]) return (false);
    // REST OF THE CODE
}
Reply

[13/05/2017 20:55:57] Error: Function not registered: 'PC_EmulateCommand'

Код:
CMD:fakecmd(playerid, params[])
{
    //[...]
    new sCMD[30];

    if(sscanf(params, "ds[30]", id, sCMD)) return SendClientMessage(playerid, COLOR_ERRO, "[ x ] Uso correto: /FakeCMD [ ID ] [ Comando ]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ERRO, "[ x ] Ninguйm online com esse ID!");  

    PC_EmulateCommand(id, sCMD); 
    return 1;
}
Reply

Server doesn't need fast command processing...
Developer needs a command processor that is simple and fast to develop not fast to process.
Reply

Thank you.

I would like to know how PAWN.CMD used for irregular use.

Here is my code with strcmp

Resume

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
HelpCMD[20];
    
format(HelpCMDsizeof(HelpCMD), "/aide");
    if(
strcmp(HelpCMDcmdtexttrue10) == 0
    {
        
// My Code
        
return 1;
    }
    return 
1;

With PWN.CMD

PHP код:
cmd:HelpCMD(playeridparam[]) return 1
No put my irregular variable.

Thanks.. (Bad English)
Reply

Bump pls
Reply

Quote:
Originally Posted by Chris53340
Посмотреть сообщение
Thank you.

I would like to know how PAWN.CMD used for irregular use.

Here is my code with strcmp

Resume

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
HelpCMD[20];
    
format(HelpCMDsizeof(HelpCMD), "/aide");
    if(
strcmp(HelpCMDcmdtexttrue10) == 0
    {
        
// My Code
        
return 1;
    }
    return 
1;

With PWN.CMD

PHP код:
cmd:HelpCMD(playeridparam[]) return 1
No put my irregular variable.

Thanks.. (Bad English)
What are you trying to do?please explain it again..
Reply

How can I create a command? I know only ZCMD style.
Reply

Quote:
Originally Posted by Chris53340
Посмотреть сообщение
Bump pls
PHP код:
CMD:aide(playeridparams[])
{
    
// ton code... / your code ...
    
return 1;

Also, "params[]" can be removed since you don't need any parameters. I mean, if you have only "/aide" and nothing more, remove "params[]".
Tu peux retirer "params[]" si tu n'as pas besoin de mettre de paramиtre. Si ta commande est juste "/aide" sans paramиtre (ex: "/aide 1" oщ 1 est un paramиtre de la commande), tu peux retirer "params[]".
Reply

I've replaced ZCMD with this one in linux, and it works like a charm, fast AF.
but in Windows...
Код:
[00:26:55]----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[00:26:50] 
[00:26:50] Server Plugins
[00:26:50] --------------
[00:26:50]  Loading plugin: crashdetect
[00:26:50]   CrashDetect v4.13.1 is OK.
[00:26:50]   Loaded.
[00:26:50]  Loading plugin: mysql_static
[00:26:50]   Failed.
[00:26:50]  Loading plugin: mysql
[00:26:50]  >> plugin.mysql: R39-3 successfully loaded.
[00:26:50]   Loaded.
[00:26:50]  Loading plugin: sscanf
[00:26:50] 

[00:26:50]  ===============================

[00:26:50]       sscanf plugin loaded.     

[00:26:50]          Version:  2.8.1        

[00:26:50]    © 2012 Alex "Y_Less" Cole  

[00:26:50]  ===============================

[00:26:50]   Loaded.
[00:26:50]  Loading plugin: streamer
[00:26:50]   Failed.
[00:26:50]  Loading plugin: pawncmd
[00:26:50] Pawn.CMD plugin v3.1.2 by urShadow loaded
[00:26:50]   Loaded.
[00:26:50]  Loading plugin: nativechecker
[00:26:50]   Loaded.
[00:26:50]  Loaded 5 plugins.

[00:26:50] 
[00:26:50] Filterscripts
[00:26:50] ---------------
[00:26:50]   Loaded 0 filterscripts.

[00:26:55] [debug] Server crashed due to an unknown error
[00:26:56] [debug] Native backtrace:
[00:26:56] [debug] #0 012922f7 in ?? () from plugins\pawncmd.dll
[00:26:56] [debug] #1 012945fb in ?? () from plugins\pawncmd.dll
[00:26:56] [debug] #2 00469ab5 in ?? () from samp-server.exe
[00:26:56] [debug] #3 65646f6d in ?? () from samp-server.exe
( Off topic, don't ask for time in debug, it's real. I try to stay awake these days to focus on coding lol )
Reply

Quote:
Originally Posted by Dice_
Посмотреть сообщение
What are you trying to do?please explain it again..
Quote:
Originally Posted by Yuri8
Посмотреть сообщение
How can I create a command? I know only ZCMD style.
Quote:
Originally Posted by Dayrion
Посмотреть сообщение
PHP код:
CMD:aide(playeridparams[])
{
    
// ton code... / your code ...
    
return 1;

Also, "params[]" can be removed since you don't need any parameters. I mean, if you have only "/aide" and nothing more, remove "params[]".
Tu peux retirer "params[]" si tu n'as pas besoin de mettre de paramиtre. Si ta commande est juste "/aide" sans paramиtre (ex: "/aide 1" oщ 1 est un paramиtre de la commande), tu peux retirer "params[]".
My commands are translated into MySQL, for example /aide (FR) /help (EN) /ayuda (ES) ...

The commands are loaded with the player's language. My order is not in the script but in the database. My question is, how called the command built from the database.



Thanks to reply. (****** traduction)
Reply

Quote:
Originally Posted by Bussyman
Посмотреть сообщение
Код:
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags) 
{ 
    if(result == -1) 
    { 
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command."); 
        return 0; 
    } 

    return 1; 
}
result only returns -1 ?
No, the result returns whatever the value is returned from the command. For example, if you want to make something like this...

PHP код:
CMD:ajetpack(playerid)
{
    if(
pInfo[playerid][AdminLvl] < 2) return 0// this will send result value as 0.
    
if(!AdmDuty{playerid}) return SendClientMessage(playeridCOLOR_RED"ERROR: "COL_GREY"You must be on admin duty to use this command."), 0// this will send result value as 0 as well.
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
    
SendClientMessage(playeridCOLOR_PINK"* Spawned Jetpack.");
    return 
1// this will send result value as 1.
}
public 
OnPlayerCommandPerformed(playeridcmd[], params[], resultflags)
{
    if(!
result// if result is zero
        
return SendClientMessage(playeridCOLOR_RED"ERROR: You're not permitted to use this command.");
    return 
1;

Result value can be important, and if you use flags along with it, it might make your code better (This is just an example.) Result only comes up as -1 when the command doesn't exist, otherwise as said it'll return the result passed in the command.

--------

Is PC_EmulateCommand supposed not to call "OnPlayerCommandPerformed"? Because it doesn't calls for me.
Reply

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Is PC_EmulateCommand supposed not to call "OnPlayerCommandPerformed"? Because it doesn't calls for me.
"OnPlayerCommandPerformed" is called if the public exists.
Reply

What if in command return -1;? so in callback if(result == -1) will do check? and why

public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{

return 0;
}
return 1;
}

Why need return 0;? is there effect anything?
Reply

Quote:
Originally Posted by Bussyman
Посмотреть сообщение
What if in command return -1;? so in callback if(result == -1) will do check?
Yes.
Quote:
Originally Posted by Bussyman
Посмотреть сообщение
Why need return 0;? is there effect anything?
return 1 => stop iterating over scripts queue.
Reply

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[22:17:36] filterscripts = ""  (string)
[22:17:36] 
[22:17:36] Server Plugins
[22:17:36] --------------
[22:17:36]  Loading plugin: crashdetect.so
[22:17:36]   CrashDetect v4.18.1 is OK.
[22:17:36]   Loaded.
[22:17:36]  Loading plugin: streamer.so
[22:17:36] 

*** Streamer Plugin v2.9.1 by Incognito loaded ***

[22:17:36]   Loaded.
[22:17:36]  Loading plugin: sscanf.so
[22:17:36] 

[22:17:36]  ===============================

[22:17:36]       sscanf plugin loaded.     

[22:17:36]          Version:  2.8.2        

[22:17:36]    © 2012 Alex "******" Cole  

[22:17:36]  ===============================

[22:17:36]   Loaded.
[22:17:36]  Loading plugin: mysql.so
[22:17:36]  >> plugin.mysql: R41-3 successfully loaded.
[22:17:36]   Loaded.
[22:17:36]  Loading plugin: MapAndreas.so
[22:17:36]   Loaded.
[22:17:36]  Loading plugin: SKY.so
[22:17:36]   Loaded.
[22:17:36]  Loading plugin: pawncmd.so
[22:17:36] Pawn.CMD plugin v3.1.3 by urShadow loaded
[22:17:36]   Loaded.
[22:17:36]  Loaded 7 plugins.

[22:17:36] 
[22:17:36] Filterscripts
[22:17:36] ---------------
[22:17:36]   Loaded 0 filterscripts.

[22:17:36]  
[22:17:36]  
[22:17:36]  
[22:17:36]  ======================================= 
[22:17:36]  |                                     | 
[22:17:36]  |        YSI version 4.00.0001        | 
[22:17:36]  |        By Alex "******" Cole        | 
[22:17:36]  |                                     | 
[22:17:36]  ======================================= 
[22:17:36]  
[22:17:37] Succesfully connected.
[22:17:37] Number of vehicle models: 12
[22:18:03] [join] Hydra has joined the server
[22:23:47] [chat] [Hydra]:  /base
[22:23:49] [debug] Server crashed while executing Test.amx
[22:23:49] [debug] AMX backtrace:
[22:23:49] [debug] #0 00000074 in ?? (... <28 arguments>) at <unknown file>:0
[22:23:49] [debug] #1 00000074 in public pc_cmd_base () at <unknown file>:0
Any idea?
Reply

Show the base CMD
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)