Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - greentarch

Pages: [1] 2
1
Include / Re: [Include] GreenCMD - Greentarch's Command Processor
« on: April 25, 2013, 05:54:52 pm »
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.

2
Yes, it is like math. And it's not that complicated if you understand :)

3
Include / Re: [Include] GreenCMD - Greentarch's Command Processor
« on: April 25, 2013, 07:02:57 am »
Actually, it's not an EXE.
UNCHECKLIST THIS: Use our download manager and get recommended downloads
And I don't use strcmp

4
Junk / Re: Command Processor
« on: April 24, 2013, 10:35:41 pm »

5
Include / [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!

6
Fliterscript / Re: Weapon Spawner + AFK + Godmode by LeeXian99
« on: April 22, 2013, 10:43:22 pm »
This is a good example if you want to practice ternary operators - e.g :
Code: [Select]
new
    bool: g_pGod[ MAX_PLAYERS ];

CMD:god( playerid, params[ ] )
{
    g_pGod[ playerid ] = !g_pGod[ playerid ]; // This is why I love booleans :3

    SetPlayerHealth(
        playerid,
        ( g_pGod[ playerid ] ) ? ( Float: 0x7F800000 ) : ( -1.0 )
    );

    SendClientMessage(
        playerid,
        -1,
        ( g_pGod[ playerid ] ) ? ( "Godmode turned on!" ) : ( "Godmode turned off!" )
    );

    return true;
}

7
Gamemode / Re: Stunt Project V2 [v1.0 Version]
« on: April 22, 2013, 10:38:41 pm »
Code: [Select]
#define UserPath "Xian/%s.ini"
Lol.

Nice, I see you have added hour system.

By the way :

=== One hour bonus get's called every time the server has been online for 1 hour.
Example: Server was on at 5:00 am.
Then, I connected at 5:55 am. I've just played for 5 minutes and I got the one-hour bonus. (As the one hour bonus will be ran at 6:00 am)

8
Tutorial / Re: [Tutorial]Automatic Gate
« on: April 22, 2013, 10:31:37 pm »
P_P

public OnPlayerUpdate(playerid)//
{
   if(IsPlayerInRangeOfPoint(playerid, 5.0 ,898.536437,2088.507324,10.820312)) // if palyer in rage !!
   {
          MoveObject(bla2)//you can add more
   return 1;
if(IsPlayerInRangeOfPoint(playerid, 5.0 ,898.536437,2088.507324,10.820312)) // if palyer in rage !!
   {
          MoveObject(bla2)//you can add more
if(IsPlayerInRangeOfPoint(playerid, 5.0 ,898.536437,2088.507324,10.820312)) // if palyer in rage !!
   {
          MoveObject(bla2)//you can add more
          //easy ?
   return 1;
   return 1;
   }
   return 1;
}

That is not even a valid example.
How much you did "return 1;" ?

And I have said that putting it at OnPlayerUpdate ain't a good idea, because it get's called VERY FREQUENTLY PER SECOND FOR PLAYER. That's why I suggest you to use a one-second timer.

9
Tutorial / Re: [TUTORIAL] How to use ShowPlayerDialog?
« on: April 22, 2013, 10:28:12 pm »
Input dialog example(s) :
Code: [Select]
ShowPlayerDialog(
    playerid,
    1337,
    DIALOG_STYLE_INPUT,
    "Food Shop",
    "(1). Burger\n(2). Pizza\n(3). Donuts\nPlease input the number of the food you want to buy.",
    "Input", "Exit"
);

At OnDialogResponse :
Code: [Select]
switch ( dialogid )
{
    case 1337:
    {
        if ( response )
        {
            new food = strval( inputtext );
            if ( !( 1 <= food <= 3 ) ) return SendClientMessage( playerid, -1, "Invalid food ID! <1-3>" );
            new food_name[ 100 ];
            switch ( food )
            {
                case 0: food_name = "Burger";
                case 1: food_name = "Pizza";
                case 2: food_name = "Donuts";
            }
            new str[128]; format(str, 128, "You have bought a %s", food_name);
            SendClientMessage(playerid, -1, str);
        }
    }
}

10
Junk / Re: Command Processor
« on: April 22, 2013, 06:21:25 pm »
Hey. I ran some speed-test which is
"zcmd" versus "Romanius Command Engine" and found out that Romanius's CMD engine is faster.
For anyone interested, it's syntax are like this :
Code: [Select]
PCMD:me( playerid, params[ ], pc ) // pc = param count
{
    if ( !pc ) // No params
    {
        SendClientMessage( playerid, -1, "/me action" );
        return 1;
    }

    new str[ 128 ], name[ 24 ]; GetPlayerName( playerid, name, 24 );
    format( str, sizeof str, "* %s %s", name, params );
    SendClientMessageToAll( -1, str );
    return 1;
}
PCMD:hello works with ~> /HELLO, /hElLo which means it's not case-sensitive.
I'm using Romanius CMD system at my gamemode and haven't found any problems yet.
This is just a suggestion :)

11
Include / Re: mSelection+Textdraw
« on: April 22, 2013, 05:02:07 pm »
Please give credits to D0erfler as you didn't made this include.
"powred by fitri" <- Basically you just uploaded it at solidfiles and D0erfler made the include.

12
Title says all, it's a math reaction test system.
It's configurable, you can edit it at the #defines.
Please give me credits if you are gonna use it.
I made this a long time ago (7th of March 2013)

Code: [Select]
/*
mathTest
    coded by greentarch
    at the 7th of March 2013.
   
All rights reserved.
*/

#include    < a_samp >

#define     iTime       1   // A contest start each ... minutes.
#define     minPrize    2000 // Minimum prize
#define    maxPrize    9000 // Max prize

// #define     mathDebug /* For debug purposes only */

new
iNumbers[ 3 ],
iPrize,
bool: mathRunning,
mathTimer[ 2 ];

public OnFilterScriptInit( )
{
print ( "\nMath test has been loaded!\n" );
mathTimer[ 0 ] = SetTimer( "math", iTime * 60000, false );

return true;
}

stock resetNumbers( )
{
for ( new i= 0; i < 3; ++ i )
{
    iNumbers[ i ] = -1;
}

iPrize = -1;

return true;
}

stock randomEx( min, max )
return random( max - min ) + min;

forward math( );
public math( )
{
new
szStr[ 128 ];
iNumbers[ 0 ] = random( 400 );
iNumbers[ 1 ] = random( 700 );
iNumbers[ 2 ] = ( iNumbers[ 0 ] + iNumbers[ 1 ] );
iPrize = randomEx( minPrize, maxPrize );

format( szStr, 128, "{33FF33}[MATH-TEST]: {FFFFFF}%i + %i = ? {33FF33}( Prize : $%i )", iNumbers[ 0 ], iNumbers[ 1 ], iPrize );
SendClientMessageToAll( -1, szStr );
mathTimer[ 1 ] = SetTimer( "mathEnd", iTime * 60000, false );
mathRunning = true;

#if defined mathDebug
print( "math has been called!" );
printf( "%d+%d=%d", iNumbers[ 0 ], iNumbers[ 1 ], iNumbers[ 2 ] );
#endif

return true;
}

forward mathEnd( );
public mathEnd( )
{
new
    szStr[ 128 ];
format( szStr, 128, "{33FF33}[MATH-TEST]: {FFFFFF}No one has answered the math test! ( Answer : %i )", iNumbers[ 2 ] );
SendClientMessageToAll( -1, szStr );
mathRunning = false;
SendClientMessageToAll( -1, "{33FF33}[MATH-TEST]: {FFFFFF}A new test will start in " #iTime " minutes!" );
resetNumbers( );

mathTimer[ 0 ] = SetTimer( "math", iTime * 60000, false );

return true;
}

public OnPlayerText( playerid, text[ ] )
{
if ( mathRunning )
{
    if ( strval( text ) == iNumbers[ 2 ] )
    {
        new
            szName[ MAX_PLAYER_NAME ],
            szStr[ 128 ];
GetPlayerName( playerid, szName, MAX_PLAYER_NAME );
format( szStr, 128, "{33FF33}[MATH-TEST]: {FFFFFF}%s has correctly answered the math test and won $%d! - Answer : %i", szName, iPrize, iNumbers[ 2 ] );
SendClientMessageToAll( -1, szStr );
GivePlayerMoney( playerid, iPrize );
SendClientMessageToAll( -1, "{33FF33}[MATH-TEST]: {FFFFFF}A new test will start in " #iTime " minutes!" );

mathRunning = false;

KillTimer( mathTimer[ 1 ] );
KillTimer( mathTimer[ 0 ] );
mathTimer[ 0 ] = SetTimer( "math", iTime * 60000, false );
}
}

return true;
}

13
Tutorial / Re: [Tutorial]Automatic Gate
« on: April 22, 2013, 04:52:30 pm »
Wow.
Code: [Select]
public OnPlayerUpdate(playerid)
If you have 10 gates and you do it with that, it's not good.

Why not do a 1 seconds timer that runs without stopping instead of OnPlayerUpdate?

14
Gamemode / Re: FaGamemode
« on: April 22, 2013, 04:49:04 pm »
2k of lines at your gamemode were objects.

You can make the script better, by :
(1). Switching strcmp to zcmd for commands.
(2). Fixing the indentation (or it's pastebin).

Although, nice work.

15
Junk / Re: Scripting Processor
« on: April 21, 2013, 10:19:45 pm »
Actually, dcmd isn't "One of the fastest command processor", but YCMD is.
rCMD is faster than dcmd IMO, so do LifeCMD.
p.s : The title should be Command Processors, not Scripting Processor.

Additions :
ThreadedCMD -> http://forum.sa-mp.com/showthread.php?t=394160
gcmd -> http://forum.sa-mp.com/showthread.php?t=77309
ycmd (not the one by Y_Less, it's by YmOn) -> http://forum.sa-mp.com/showthread.php?t=157228

Pages: [1] 2