04.09.2010, 13:02
(
Последний раз редактировалось RyDeR`; 06.08.2011 в 11:57.
)
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:
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:
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.
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: -
*/
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;
}
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.