[Plugin] pawnCompiler - Compile your scripts without pawno
#1

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.
Reply
#2

wow!

truly amazing!
Reply
#3

Awesome ! Thnx RyDeR xD
Reply
#4

WOW!! gonna test now!!!
Reply
#5

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)
Reply
#6

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
Reply
#7

Its awesome RyDeR!
Reply
#8

Nice job
Reply
#9

Nice,but you must uplaod pawn folder on host?
Reply
#10

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`.
Reply
#11

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

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

other then that, great job.
Reply
#12

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

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

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.
Reply
#15

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.
Reply
#16

Why shouldn't I compile my script while online?
Reply
#17

Good work !
Reply
#18

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.
Reply
#19

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.
Reply
#20

Awesome work man great job i love it!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)