[Tutorial] PAWN for SA-MP in Sublime Text 3
#1

PAWN for SA-MP in Sublime Text 3


About

Sublime Text 3 is a highly customizable Text-editor with a lot of cool features, that you don't get using the standard Pawno-editor or Notepad++. I know there are already a bunch of tutorials about this, but they don't explain how to install packages very well, which can be confusing for beginners and I added some instructions on using the program.
  • You can fully customize the editor to something you feel comfortable with.
  • Writing code is faster because of the auto-completion and a smart auto-correction.
  • Your code will look a lot cleaner with the neat indentation it offers.
  • A lot of useful (customizable) Keyboard Shortcuts to write code more easily.
  • It also works for a lot of other languages, so it can be used as your primary text editor.
  • Sublime Text is available for Windows, OS X and and Linux.
Features

Auto-completion






Some pre-made Color Schemes








Some pre-made shortcuts

http://docs.sublimetext.info/en/late...tcuts_win.html



Installing

Downloads
Click here - Download and Install the latest Sublime Text
Click here - Download the Package Control file for sublime


Installing the syntax
  1. Download and Install Sublime Text
  2. Download the Package Control file
  3. Paste the Package Control file into C:\Users\Your PC Username\AppData\Roaming\Sublime Text 3\Installed Packages
  4. Open Sublime Text 3 - or restart if already open
  5. Go to Preferences>Package Control and choose Install Package and wait until a new window pops up
  6. Search for pawn and click on Pawn Syntax, wait until it's installed
  7. You can now change the syntax to PAWN in the Lower right corner or View>Syntax>Pawn
You can now start writing SendClientMessage to see if the auto-completion works. If it doesn't you didn't complete these steps successfully.

Installing the compiler
  1. Go to Tools>Build System>New Build System
  2. Replace the code with this code:
    Code:
    {
    	"cmd": ["pawncc.exe", "-i includes", "$file", "-;+"],
    	"path": "C:/path/to/pawno/folder"
    }
  3. You have to change the path to the folder containing pawncc.exe (e.g. "C:/Users/Name/Desktop/MyServer/pawno"), make sure the slashes from your path are / and not \.
  4. Save the file (remember the name) and close the tab
  5. Restart the program
  6. Set your build system: Tools>Build System>name you chose
  7. You can now press Ctrl+B to compile the the code.
Congratulations, you're done



Extra instructions

How can I change the compile button?
  1. Go to Preferences>Key Bindings
  2. Search for build with Ctrl+F
  3. You can replace the current key with something new (e.g. F5)
    You should see something like this:
    Code:
    { "keys": ["ctrl+b"], "command": "build" },
  4. Save the file and restart Sublime Text 3

How can I change the color scheme?
  1. Go to Preferences>Color Scheme
  2. Try out some color schemes. Not satisfied? Go to the next quesion...
How can I get new color schemes?
  1. Go to Preferences>Package Control and choose Install Package
  2. You can search for color schemes between these packages
Indentation
  • Go to View>Indentation
    I recommend Tab Width 4
  • You can adjust the indentation by selecting the line(s) and pressing Ctrl+[ and Ctrl+].
    Or with the Tab button.

More tips

11 Sublime Text Tips for Productivity and a Faster Workflow
Reply
#2

As a regular sublime text user, I really think people should consider using this editor,
Nice explanation, I remember having trouble back when I first intended to install sublime text, there was really no accurate tutorials on how to do it
Reply
#3

Nice one mate TBH didn't noticed that it exists though and have much good shit in it as you explained...
+1
PS: please help me out the compiling part doesn't work.
And please tell that should I place pawncc.exe file the game mode or the all files of pawno folder.
Reply
#4

Good tutorial, i love sublime text 3, Good Post
Reply
#5

What I did wrong?

PHP Code:

__init__
() got an unexpected keyword argument 'Cmd' 
Reply
#6

Quote:
Originally Posted by View
View Post
What I did wrong?

PHP Code:

__init__
() got an unexpected keyword argument 'Cmd' 
There is a problem in your build system (compiler)
You wrote Cmd instead of cmd.

It should look like this:
Code:
{
	"cmd": ["pawncc.exe", "-i includes", "$file", "-;+"],
	"path": "C:/path/to/pawno/folder"
}
To fix it you have to edit the file that you made, located in:
C:\Users\YOUR PC USERNAME HERE\AppData\Roaming\Sublime Text 3\Packages\User
and Change Cmd to cmd
Reply
#7

Quote:
Originally Posted by princejeet1510
View Post
PS: please help me out the compiling part doesn't work.
And please tell that should I place pawncc.exe file the game mode or the all files of pawno folder.
Which part isn't working?
Actually it doesn't really matter where your pawncc.exe is. Just make sure that the path is correct.

If for example this is the location of pawncc.exe:
C:\Users\name\Desktop\MyServer\pawno\pawncc.exe

Then this should be your path:
C:/Users/name/Desktop/MyServer/pawno

So the path that you have to write for you build file doesn't have \ but /
and the path does not end with pawncc.exe
Reply
#8

Perfect , Thank you.
Reply
#9

Anyone know who can we get this ?
I'm using Sulime Text since some times and never finnd it : https://gyazo.com/8d45f23521877f7eb07dac9e490d441d
Reply
#10

i love you man, i was searching for this from a lonnnnnnnnnnnng time THANKS
+REP
Reply
#11

Quote:
Originally Posted by Dayrion
View Post
The compiler give me an .lst file, not the amx. You know why? :c
edit: the compiler doesn't work. Looking to compile fine even there is errors
Check the 'cmd' param. You ~probably~ are compiling with (-l) arg.
Reply
#12

Quote:
Originally Posted by PeanutButter
View Post
Maybe restart the program? Did you install the package control right?
You can check by going to Preferences and see if there is a Package Control option.
If not you didn't install it right.

If it does then click on it, afterwards click on install package and search for pawn syntax and install it.
Wait until it's finished and restart the program afterwards. You should now be able to find PAWN in the syntaxes
Nothing happens when I click on Pawn syntax, the pop up just dissapears.
Reply
#13

How to open the new folder in one project without seperate window
Reply
#14

Quote:
Originally Posted by justice96
View Post
How to open the new folder in one project without seperate window
Double click at the empty place beside any tab, I think you know what I mean?
Reply
#15

The compiler dosen't work for me any help? I followed all your instructions and saved the file but i am unable to see it in the built system.
Reply
#16

Quote:
Originally Posted by Oxygenated
View Post
The compiler dosen't work for me any help? I followed all your instructions and saved the file but i am unable to see it in the built system.
What happens when you do ctrl+b ?
Reply
#17

It says no built system maybe it does not work for the latest version plz check and inform that if it works for the latest version or not if there are any changes then please edit the post!
Nice work anyways.
Reply
#18

Quote:
Originally Posted by Oxygenated
View Post
It says no built system maybe it does not work for the latest version plz check and inform that if it works for the latest version or not if there are any changes then please edit the post!
Nice work anyways.
Do you use Linux/Windows/Mac ?
I double checked with the latest version on 2 different PCs and everything worked fine...

Is your file in the list of build systems? And did you click on it? Tools>Build System
I forgot to say that after you've made the file you have to restart the program before you can see it in Tools>Build System, so check again now that it has been restarted.

Send me the content of your build file, if it really doesn't work.
the file is located in C:\Users\PC_NAME\AppData\Roaming\Sublime Text 3\Packages\User
Reply
#19

Quote:
Originally Posted by renatog
View Post
Check the 'cmd' param. You ~probably~ are compiling with (-l) arg.
The compiler work on my other PC.
Code:
{
    "cmd": ["C:/Users/user/Desktop/Server Files/pawno.exe", "$file_name", "-;+", "-d3", "-\\)+"],
    "working_dir": "${file_path}",
    "file_regex": "^([^\\.]+\\.pwn)\\((\\d+)\\)() : (.*)$",
    "variants": [
        {
            "cmd": ["C:/Users/user/Desktop/Server Files/pawno.exe", "$file_name", "-;+", "-d3", "-\\)+", "-l"],
            "working_dir": "${file_path}",
            "name": "Preprocessed output"
        },
        {
            "cmd": ["C:/Users/user/Desktop/Server Files/pawno.exe", "$file_name", "-;+", "-d3", "-\\)+", "-a"],
            "working_dir": "${file_path}",
            "name": "P-code output"
        }
    ]
}
Edit: Doing the same thing:
Code:
{
	"cmd": ["pawncc.exe", "-i includes", "$file", "-;+"],
	"path": "C:/Users/user/Desktop/Server Files/"
}
Reply
#20

Quote:
Originally Posted by Dayrion
View Post
The compiler work on my other PC.
Code:
{
        {
            "cmd": ["C:/Users/user/Desktop/Server Files/pawno.exe", "$file_name", "-;+", "-d3", "-\\)+", "-l"],
            "working_dir": "${file_path}",
            "name": "Preprocessed output"
        },
Check if you're not compiling with "Preprocessed output" variant. The compiler will give a .lst file if you are using '-l' arg (or another arg that gives this file format).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)