Author Topic: [Include] GreenCMD - Greentarch's Command Processor  (Read 306 times)

greentarch

  • Global Moderator
  • Newbie
  • ********
  • Posts: 16
  • Reputation: 0
    • View Profile
[Include] GreenCMD - Greentarch's Command Processor
« on: April 24, 2013, 10:32:38 pm »
Download link:
greencmd.inc


How to use?
Code: [Select]
CMD:cmdname(playerid, params[])

The speed is almost the same as zcmd, sometimes slower and sometimes faster.

Code: [Select]
#include <greencmd>

CMD:me( playerid, params[ ] )
{
    if ( params[ 0 ] == '\1' )
    return SendClientMessage( playerid, 0xFF0000AA, "Syntax - /me1 <action>" );

new
    szStr[ 128 ], name[ 24 ];
GetPlayerName( playerid, name, 24 );

format( szStr, sizeof szStr, "* %s %s", name, params );
SendClientMessageToAll( -1, szStr );
return 1;
}

Example command with sscanf used
Code: [Select]
CMD:money( playerid, params[ ] )
{
new
    id,
    amount;

if ( sscanf( params, "ri", id, amount ) )
    return SendClientMessage( playerid, 0xFF0000AA, "Syntax - /money <id> <amount> (gives the target money)" );

if ( id == INVALID_PLAYER_ID )
    return SendClientMessage( playerid, -1, "player not connected" );

GivePlayerMoney( id, amount );
SendClientMessage( id, -1, "money received." );
SendClientMessage( playerid, -1, "money sent." );
return 1;
}

This is my 2nd include I've ever made, and not gonna release it at SA-MP forums.
Special for sampscripting.smffy.com :3
DOWNLOAD LINK ARE AT THE TOP OF THE POST!

Share on Bluesky Share on Facebook


KiNG3

  • Global Moderator
  • Newbie
  • ********
  • Posts: 10
  • Reputation: 0
    • View Profile
Tested out your Command Processor,

It is the same as ZCMD, but is a processor of strcmp.

And considering the file is a .exe when I download. Some people may think it is a virus, please do not continue this development.

greentarch

  • Global Moderator
  • Newbie
  • ********
  • Posts: 16
  • Reputation: 0
    • View Profile
Actually, it's not an EXE.
UNCHECKLIST THIS: Use our download manager and get recommended downloads
And I don't use strcmp

KiNG3

  • Global Moderator
  • Newbie
  • ********
  • Posts: 10
  • Reputation: 0
    • View Profile
I never stated anywhere that you use STRCMP.....

I'm saying a command processes like the speed of strcmp in my opinion... You should try testing ZCMD and GCMD and find out what the speed of each of it is.

greentarch

  • Global Moderator
  • Newbie
  • ********
  • Posts: 16
  • Reputation: 0
    • View Profile
Sorry. I'm maybe a little blind.
I'll try benchmarking speed as soon as I can.

EDIT:
Here's it!
Code: [Select]
[16:57:04]  Bench for ZCMD: executes, by average, 2935.52 times/ms.
[16:57:50]  Bench for GreenCMD: executes, by average, 2937.04 times/ms.
[17:03:29]  Bench for Romanius CMD: executes, by average, 2850.47 times/ms.
« Last Edit: April 25, 2013, 06:04:05 pm by greentarch »