Notepad++ Pawno Scripting

I recently decided to revist SA:MP (San Andreas Multiplayer) which is basically a self hosted server with a coded library of events to create an immersive world from capture the flag to racing, team deathmatch etc.

The "gamemode" I initially created a few years ago was a modified form of Grand Larceny (comes with the SA:MP server) allowing saving of your character to a database.

I decided to revist as I have now obtained a degree in programming to see if I could make something even half as good as the RP style of GTA (5) Online. I have been used to decent IDE's so decided to investigate plugging in to notepad++ to at least make coding a little easier and was pleased to discover that on the SAMP (can't be bothered to keep typing the colon) forums, someone had already done most of the legwork for this. 

Step 1 Accessing the data


I realised that most of the posts were very old and any links to external content were unlikely to work directly and hoped by using part of the URL's that I would be able to recover the lost content. This did actually work and I was able to find the original missing data.

Step 2 Getting it working


The biggest problem with out of date content is that it often needs updating to bring it up together with the latest requirements for an in development application (such as notepad++). So after a bit of squirming I was able to get things working.

Step 3 Writing the new instructions


Rewriting the instructions for the "modern" world is the last step in this journey of reactivation and providing a mirror link to all the download content required to get things going. SAMP 0.3.7 was released in 2015 so being 5 years out of date suggests that its probably not under any further development and at some point, the site owner may close down. A lot of forum resources will be lost at that point and developing will become really hard for this great game add on especially if the wiki goes too.

Anyway, instead of dreaming about issues of the future, here is the full set of instructions to get PWN scripts to open and work with notepad++ including autocomplete.

Instructions to get PWN files working correctly in Notepad++

Original 0.3.7 downloads from sa-mp.com

Setting up required files

  1. Download the server (use the download links on the SA:MP website or from All Downloadable Items above) if you dont already have it, thats where the Pawno compiler comes from which is a vital part of coding in Pawno for SAMP.
  2. Once the server files are extracted, you are ready to being setting up Notepad++ with pawnocc as a compiler. Make a note of the directory you have extracted the server to as this will be used during this setup. If its not on your C drive (assuming Windows), make a note of the drive letter its on too.

Downloading Notepad++ files to the right locations

There are just 2 files to download. I have provided the updated files in All Downloadable Items above AND linked them in the listing below it too. These 2 files are:
It is important to note that I did NOT create the original language definitions file or code styles but I HAVE updated the code styles to work with the current latest version of Notepad++ (7.8.6).

  • Download the language definitions file to your Program Files folder where Notepad++ is installed into the directory "Autocompletion"
  • Download the code styles file into your appdata > roaming > notepad++ folder. You can get to this by navigating to %appdata% and opening the notepad++ folder
Now you have the files in the right place you can reload notepad++ then open a pwn file and see if it works. If it does you should be able to open and close {} sections and see various coloured sections too.

If not, click on the menu language and go to the bottom and click PAWN

Setting up compiling from Notepad++

There was a guide for this in the original guide which partially helped me with this but I wrote my own version instead. The original suggested using a plugin called nppexec which you are more than welcome to figure out but heres my way:

Download the compileTemplate.bat file

This is the file:

@echo off && setlocal EnableDelayedExpansion
DRIVELETTER:\
cd %1
"DRIVELETTER:\PATHTOPAWNODIRECTORY\pawncc.exe" %2
pause
goto :eof 
  • Replace DRIVELETTER: with the drive letter you have extraced the SAMP server to, for example c:\
  • Replace PATHTOPAWNODIRECTORY with the path to the pawno directory in the SAMP server folder for example: Programs\Servers\SAMP LATEST\Server\pawno\pawncc.exe so that the path reads like this: "c:\Programs\Servers\SAMP LATEST\Server\pawno\pawncc.exe"
  • Save the compileTemplate.bat file as compile.bat or something similar
  • Open Notepad++
  • Open a PWN file that works already for compiling
  • Go the Run menu and click Run... or press F5
  • In the program to run box type the following:

    "FULLPATHTOSAMPSERVER\pawno\compile.bat" "$(CURRENT_DIRECTORY)" "$(FILE_NAME)"

    and replace FULLPATHTOSAMPSERVER with the path noted from section Setting up required files step 2 above
  • Copy the contents of the box to the clipboard (ctrl+c) just in case and the click on Run. If all is successful you should see a black box appear with compiling successful. Press any key to get rid of it.
  • OPTIONAL: Save a shortcut key
  • Reopen the run box which should still have the last run item in it, if so, click on save, give it a name such as Run PAWN Compile and make your own shortcut key up, I setup CTRL+SHIFT+C for mine. Once saved, your shortcut key should work. Don't forget to save before running or your latest changes won't take effect. This will now appear in the Run menu.

Comments