SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 26/07/2017, 06:44 PM   #391
Bussyman
Big Clucker
 
Join Date: Apr 2017
Posts: 178
Reputation: 0
Default Re: Pawn.CMD - the fastest and most functional command processor

In Command: i can use any return?
Bussyman is offline   Reply With Quote
Old 26/07/2017, 11:56 PM   #392
R4nd4ll
Huge Clucker
 
R4nd4ll's Avatar
 
Join Date: Jul 2017
Location: Los Santos, The Federal Bureau of Investigation HQ
Posts: 214
Reputation: 70
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by SmileJack View Post
Nice men! Grest Job
Man *, Great *
__________________
A mapper

Is looking for a job

And i am a good Public Relations member too (if given the right powers)
I worked once for
Crystallize and brought his server to 20 players in 2 days only
R4nd4ll is offline   Reply With Quote
Old 27/07/2017, 03:36 AM   #393
Bussyman
Big Clucker
 
Join Date: Apr 2017
Posts: 178
Reputation: 0
Default Re: Pawn.CMD - the fastest and most functional command processor

Code:
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags) 
{ 
    if(result == -1) 
    { 
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command."); 
        return 0; 
    } 

    return 1; 
}
result only returns -1 ?
Bussyman is offline   Reply With Quote
Old 29/07/2017, 08:09 AM   #394
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Next to Oblivion (Kalcor's place)
Posts: 1,219
Reputation: 171
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by Bussyman View Post
Code:
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 Code:
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.
__________________
Chaos Cops and Robbers [Website]
Call of Duty: Black Ops 3 [Website] - Former developer

SA-MP, G-MOD and Web hosting @ https://www.prestigesteve.com.
Logic_ is offline   Reply With Quote
Old 29/07/2017, 07:52 PM   #395
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 111
Reputation: 174
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by Logic_ View Post
Is PC_EmulateCommand supposed not to call "OnPlayerCommandPerformed"? Because it doesn't calls for me.
"OnPlayerCommandPerformed" is called if the public exists.

Last edited by YourShadow; 30/07/2017 at 02:38 PM.
YourShadow is online now   Reply With Quote
Old 01/08/2017, 06:49 PM   #396
Bussyman
Big Clucker
 
Join Date: Apr 2017
Posts: 178
Reputation: 0
Default Re: Pawn.CMD - the fastest and most functional command processor

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?
Bussyman is offline   Reply With Quote
Old 02/08/2017, 06:01 PM   #397
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 111
Reputation: 174
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by Bussyman View Post
What if in command return -1;? so in callback if(result == -1) will do check?
Yes.
Quote:
Originally Posted by Bussyman View Post
Why need return 0;? is there effect anything?
return 1 => stop iterating over scripts queue.
YourShadow is online now   Reply With Quote
Old 18/08/2017, 11:38 PM   #398
HydraHumza
Gangsta
 
HydraHumza's Avatar
 
Join Date: Oct 2014
Posts: 639
Reputation: 110
Default Re: Pawn.CMD - the fastest and most functional command processor

Code:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)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]    (c) 2012 Alex "Y_Less" 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 "Y_Less" 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?
__________________
Owner of Call of Duty 4 Modern Warfare.

HydraHumza is offline   Reply With Quote
Old 18/08/2017, 11:42 PM   #399
HoussemGaming
Banned
 
Join Date: Jun 2017
Location: France
Posts: 206
Reputation: 10
Default Re: Pawn.CMD - the fastest and most functional command processor

Show the base CMD
HoussemGaming is offline   Reply With Quote
Old 28/08/2017, 03:06 PM   #400
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,045
Reputation: 2647
Default Re: Pawn.CMD - the fastest and most functional command processor

My issue with this plugin is that it stops commands in other scripts that use traditional methods from working. For example if I load fs_debug then the commands in that script won't work at all. There is no output whatsoever. Converting that script took all of ten minutes because thankfully it uses at least dcmd but it's still annoying.
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [I-ZCMD]Improved ZCMD - Fastest Command Processor Yashas Includes 99 23/07/2017 05:23 PM
[Tutorial] PAWN Pre-Processor (Updated 22/04/13) Misiur Tutorials 6 10/07/2016 03:33 PM
[Include] y_commands - Most flexible and fastest command processor, now on the YSI wiki corne Includes 19 03/12/2015 02:41 AM
[Tutorial] PAWN Pre-Processor - Pre-processor alternatives - Part 5/7 Misiur Tutorials 0 14/04/2015 10:13 PM


All times are GMT. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.