SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/07/2017, 10:56 PM   #391
R4nd4ll
Huge Clucker
 
R4nd4ll's Avatar
 
Join Date: Jul 2017
Location: Los Santos
Posts: 218
Reputation: 100
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by SmileJack View Post
Nice men! Grest Job
Man *, Great *
__________________
Known as Randall Vincre in Lawless roleplay.
General Administrator
IP : samp.lawlessrp.com
Website : www.lawlessrp.com
TS3 : ts.lawlessrp.com:9987
R4nd4ll is offline   Reply With Quote
Old 27/07/2017, 02:36 AM   #392
Bussyman
Big Clucker
 
Join Date: Apr 2017
Posts: 161
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, 07:09 AM   #393
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Next to Oblivion (Kalcor's place)
Posts: 1,338
Reputation: 236
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.
__________________

Current projects
Roleplay scripts and San Andreas Battle Royale
Providing SA-MP, G-MOD, Web hosting and Hosted tab listing for cheap @ www.prestigesteve.com.
Logic_ is offline   Reply With Quote
Old 29/07/2017, 06:52 PM   #394
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 117
Reputation: 225
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 01:38 PM.
YourShadow is offline   Reply With Quote
Old 01/08/2017, 05:49 PM   #395
Bussyman
Big Clucker
 
Join Date: Apr 2017
Posts: 161
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, 05:01 PM   #396
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 117
Reputation: 225
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 offline   Reply With Quote
Old 18/08/2017, 10:38 PM   #397
HydraHumza
Gangsta
 
HydraHumza's Avatar
 
Join Date: Oct 2014
Posts: 652
Reputation: 126
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?
__________________
Quote:
Originally Posted by Kalcor View Post
The fact is, I am right. And if you think I'm wrong, you are wrong.
HydraHumza is online now   Reply With Quote
Old 18/08/2017, 10:42 PM   #398
HoussemGaming
Banned
 
Join Date: Jun 2017
Location: France
Posts: 203
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, 02:06 PM   #399
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,009
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
Old 06/09/2017, 05:02 AM   #400
Debjit
Huge Clucker
 
Debjit's Avatar
 
Join Date: Feb 2017
Location: India
Posts: 429
Reputation: 64
Default Re: Pawn.CMD - the fastest and most functional command processor

Quote:
Originally Posted by Vince View Post
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.
Yea Same here, I just switched back to ZCMD because of its incompatibilty to work with other command plugins such as dcmd and strcmp which are being used as filterscripts( and the fs are really needed when the gamemode is in development stages.).
Hope this incompatibility problem will be fixed soon.
__________________

Experience Roleplay in Las Venturas

Last edited by Debjit; 06/09/2017 at 09:07 AM.
Debjit 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
[Plugin] Vectoral Pawn - STL Data containers for pawn Rancho Plugin Development 70 03/05/2017 07:41 PM
Forum bug with [pawn][/pawn] BBCODE Yuripe Everything and Nothing 4 06/10/2012 12:58 PM
[Tool/Web/Other] PAWN Scanner - Scan PAWN files for information. Slice Tools and Files 10 15/07/2012 07:09 PM
[Help With Pawn] Pawn and compiler is not working..... D_Less Client Support 3 09/03/2012 04:49 AM


All times are GMT. The time now is 06:06 AM.


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