SA-MP Forums Archive
[Plugin] pawnCompiler - Compile your scripts without pawno - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] pawnCompiler - Compile your scripts without pawno (/showthread.php?tid=174033)

Pages: 1 2


pawnCompiler v1.0 - Compile your scripts without pawno - RyDeR` - 04.09.2010

Hello, this is my first plugin release. This plugin makes sure that you can compile a script without opening pawno to compile. It's just with a simple function.

Here are the functions with additional info:
pawn Код:
/*
    @Release: pawnCompiler
    @Author: RyDeR`
    @Version: 1.0
    @Last Update: 04/08/2010 - 14:30
    @Bugs: -
    @Functions:
            @Functon: WinExec(path[])
            @Info: Use to execute programs. (like .exe, .bat, etc..)
            @params:
                - path[] = The path of the program.


            @Function: returnServerPath(strdest[])
            @Info: Stores your server path to a string.
            @params:
                - strdest[] = The string where you're going to store your data in.


            @Function: existFile(path[])
            @Info: Checks if a file exists (in your server folder).
            @params:
                - path[] = The path you want to check if exists.

            @Function: compileScript(directory[], scriptName[])
            @Info: Compiles your scripts.
            @params:
                - directory[] = In which directory your script is. (e.g. filterscripts, gamemodes, scriptfiles..)
                - scriptName[] = The name of the script you want it to compile. (e.g. vehiclespawner (without .pwn extention))

    @Author Notes: -
*/
The main function is compileScript which will compile your script. The rest are all needed to get this job done. But you can also use them seperate.

Here's an example script:
pawn Код:
#include <a_samp>
#include <pawnCompiler>

#if !defined strtokVar
#define strtokVar(%0,%1,%2) \
    SetPVarString(%0, %1, strtok(cmdtext, idx)), GetPVarString(%0, %1, %2, sizeof(%2)), DeletePVar(%0, %1)
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    new
        idx,
        cmd[128]
    ;
    cmd = strtok(cmdtext, idx);

    if(!strcmp(cmd, "/compile", true))
    {
        new
            directory[32],
            scriptName[20]
        ;
        strtokVar(playerid, "directory", directory);
        strtokVar(playerid, "scriptName", scriptName);
        if(!strlen(directory) || !strlen(scriptName)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /compile [directory] [scriptname]");
        return SendClientMessage(playerid, 0xFFFFFFFF, compileScript(directory, scriptName));
    }
    return 0;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
With this script you can compile your script when you're ingame with command /compile [directory] [scriptname].

Click here to download - Plugin + Include + Source

Changelog:
- 04/09/2010:
First public release.

- 05/09/2010:
Deleted creating .xml.

EDIT: Please always re-compile if you download an updated version of this script.


Re: pawnCompiler - Compile your scripts without pawno - WillyP - 04.09.2010

wow!

truly amazing!


Re: pawnCompiler - Compile your scripts without pawno - Defrinex - 04.09.2010

Awesome ! Thnx RyDeR xD


Re: pawnCompiler - Compile your scripts without pawno - kamalhood - 04.09.2010

WOW!! gonna test now!!!


Re: pawnCompiler - Compile your scripts without pawno - Hiddos - 04.09.2010

Great job, I'm still kinda figuring out why you wouldn't use pawno though (Except that scripters who don't make much mistakes can simply keep their .pwn file online and edit it their, instead of keeping uploading files)


Re: pawnCompiler - Compile your scripts without pawno - RyDeR` - 04.09.2010

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Great job, I'm still kinda figuring out why you wouldn't use pawno though (Except that scripters who don't make much mistakes can simply keep their .pwn file online and edit it their, instead of keeping uploading files)
That was the actual reason. And with the new HTTP function this will be quite useful.

thanks for your comment


Re: pawnCompiler - Compile your scripts without pawno - iZN - 04.09.2010

Its awesome RyDeR!


Re: pawnCompiler - Compile your scripts without pawno - Victor - 04.09.2010

Nice job


Re: pawnCompiler - Compile your scripts without pawno - pliva_sb - 04.09.2010

Nice,but you must uplaod pawn folder on host?


Re: pawnCompiler - Compile your scripts without pawno - Calgon - 04.09.2010

I don't actually see myself using this, though I can see quite a few new things becoming possible with this plugin, nice release RyDeR`.


Re: pawnCompiler - Compile your scripts without pawno - Toni - 04.09.2010

Just asking, what if your script get's errors ?

Will it not compile the .amx at all/not correctly ?

other then that, great job.


Re: pawnCompiler - Compile your scripts without pawno - lolumadd - 05.09.2010

If you make this for Linux, people wouldn't need to install Wine so they can compile their scripts!


Re: pawnCompiler - Compile your scripts without pawno - DiddyBop - 05.09.2010

Good job, i wont use it. But good job. Didn't think it was possible o.O


Re: pawnCompiler - Compile your scripts without pawno - RyDeR` - 05.09.2010

Quote:
Originally Posted by pliva_sb
Посмотреть сообщение
Nice,but you must uplaod pawn folder on host?
Sorry, I don't understand your question %100.

Quote:
Originally Posted by The Toni
Посмотреть сообщение
Just asking, what if your script get's errors ?

Will it not compile the .amx at all/not correctly ?

other then that, great job.
samp-server.exe will show the errors and it won't compile.

Quote:
Originally Posted by lolumadd
Посмотреть сообщение
If you make this for Linux, people wouldn't need to install Wine so they can compile their scripts!
I don't know. I have no experience with Linux.


And thanks ^^


EDIT: I did a small update. Changelog on first page (05/09/2010). Please re-download and re-compile if you're using this.

Have fun.


Re: pawnCompiler - Compile your scripts without pawno - RoBo - 05.09.2010

Quote:
Originally Posted by lolumadd
Посмотреть сообщение
If you make this for Linux, people wouldn't need to install Wine so they can compile their scripts!
Ummm no. All the plugin does it execute the pawn compiler, there is no pawn compiler for Linux.


Re: pawnCompiler - Compile your scripts without pawno - Jochemd - 05.09.2010

Why shouldn't I compile my script while online?


Re: pawnCompiler - Compile your scripts without pawno - James124 - 05.09.2010

Good work !


Re: pawnCompiler - Compile your scripts without pawno - lolumadd - 05.09.2010

Quote:
Originally Posted by RoBo
Посмотреть сообщение
Ummm no. All the plugin does it execute the pawn compiler, there is no pawn compiler for Linux.
Ahh, I thought that you didn't need to have the pawn compiler for this plugin, it just does it it self.


Re: pawnCompiler - Compile your scripts without pawno - RyDeR` - 05.09.2010

Quote:
Originally Posted by lolumadd
Посмотреть сообщение
Ahh, I thought that you didn't need to have the pawn compiler for this plugin, it just does it it self.
No, it just executes pawncc.exe like RoBo said.


Re: pawnCompiler - Compile your scripts without pawno - HyperZ - 06.09.2010

Awesome work man great job i love it!