Skip to content

Commit

Permalink
perfect
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntisT committed Jul 29, 2023
1 parent 2877797 commit 973529b
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<h1 align = "left">Welcome to the <i><b>PawnScript</b></i> Wiki</h1>
<h3 align = "left">
Complex and Easy-to-Use Extentsion to Pawn
Complex but Easy-to-Use Extentsion to Pawn
</h3>
<img height="30" align="left" src="https://cdn.discordapp.com/attachments/1130879376423145522/1134843345462636665/brace_product.png">
<img height="30" align="left" href="https://sa-mp.com" src="https://cdn.discordapp.com/attachments/1130879376423145522/1134843694487441438/brace_samp.png">
Expand Down
20 changes: 19 additions & 1 deletion doc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,22 @@ cool
2
```

**WARNING**: Current `sscanf` delimiter is `-` because of some limitations we're facing, it may be changed in the future.
**WARNING**: Current `sscanf` delimiter is `-` because of some limitations we're facing, it may be changed in the future.


---------------------------------------------------------------------------------

## Component: `pawn`
- Provides forms for interaction with the Pawn language.

Import the component using:
```pawn
using.pawn;
```

### Form: `callfunction`
- Calls a public function declared in the running Pawn code.

```cpp
pawn.callfunction("public_name");
```
22 changes: 20 additions & 2 deletions doc/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Method test #2
#### Method: `log`
- Printed text will also be logged into `scriptfiles/dpp.log`.
- Printed text will also be logged into `scriptfiles`.
```pawn
console.println.log("Test");
Expand All @@ -55,9 +55,27 @@ console.println.log("Test");

#### Method: `log`

- Printed text will also be logged into `scriptfiles/dpp.log`.
- Printed text will also be logged into `scriptfiles`.

```pawn
console.cout.log(char);
```

### Form: `pawn.callfunction`

#### Method: `local`

- Equivalent to `CallLocalFunction` (it can only call functions declared inside `pawnscript.amx`).

```pawn
pawn.callfunction.local("funcname");
```

#### Method: `remote`

- Equivalent to `CallRemoteFunction`.

```pawn
pawn.callfunction.remote("funcname");
```

Binary file modified scriptfiles/modules/pawn.ps
Binary file not shown.
32 changes: 7 additions & 25 deletions src/components/pawn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public dpp_processpawn(funcgroup[][],args[][],args_const[][])
return 1;
}
// If the function used it "print"
if(!strcmp(funcgroup[1], "println"))
if(!strcmp(funcgroup[1], "callfunction"))
{
new mul, str[dpp_argcharsize];
strmid(str, args[0], 0, dpp_argcharsize);
Expand All @@ -42,36 +42,18 @@ public dpp_processpawn(funcgroup[][],args[][],args_const[][])
}

//dpp_debug("Line \"%s\" successfully executed.", line);
print(args[0]);

if(!strcmp(funcgroup[2], "log"))
if(isnull(funcgroup[2]))
{
dpp_savelog(DPP_LOG_FILE, args[0]);
CallRemoteFunction(args[0], "");
}
return 1;
}

if(!strcmp(funcgroup[1], "cout"))
{
new coutargerr = 0;

for(new i; i < strlen(args[0]); i++)
if(!strcmp(funcgroup[2], "local"))
{
if(args[0][i] == '\"') coutargerr = 1;
if(args[0][i] == ' ') coutargerr = 1;
if(args[0][i] == '\t') coutargerr = 1;
CallLocalFunction(args[0], "");
}

if(coutargerr == 1)
{
dpp_error("Invalid symbols in the argument 1.",);
}
//dpp_debug("Line \"%s\" successfully executed.", line);
print(args[0]);

if(!strcmp(funcgroup[2], "log"))
if(!strcmp(funcgroup[2], "remote"))
{
dpp_savelog(DPP_LOG_FILE, args[0]);
CallRemoteFunction(args[0], "");
}
return 1;
}
Expand Down
13 changes: 11 additions & 2 deletions src/pawnscript.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
//-----------------------------------------------------------
#define DPP_VERSION_MAJOR 1
#define DPP_VERSION_MINOR 0
#define DPP_VERSION_PATCH 0
#define DPP_VERSION_RELEASE 4
#define DPP_VERSION_PATCH 1
#define DPP_VERSION_RELEASE 1
#define DPP_CELLMAX 8

#define DPP_VERSION_BETA 0
Expand Down Expand Up @@ -473,4 +473,13 @@ main()
printf("Keyword 3: '%s'",funcgroup[2]);
}*/
SetTimer("dpp_main", 1000, false);
}

//-----------------------------------------------------------

forward pawnscript_testpawnfunc();
public pawnscript_testpawnfunc()
{
dpp_print("pawnscript_testpawnfunc was sucessfully called");
return 1;
}

0 comments on commit 973529b

Please sign in to comment.