[Tutorial] Tutorial for starting scripters
#1

WARNING:This threat is for beginners who need help,not for advanced ones.
This is my first tutorial,that's the reason it may be really bad.

Things I'll be showing:

1. What is PAWNO
2. What is Gamemode
3. How to make a Gamemode
4. What is Filterscript
5. What is ZCMD
6. How to use ZCMD
7. How to make a simple Dialog
8. How to make a response for the dialog
9. How to create objects
10. How to create vehicles

1PAWNO is a program with which you script for your server. It can be a gamemode,or filterscript.

2.Game mode is a file which you have to write in server.cfg so your server can run.

3.First,you open "pawno.exe" and click new. You will see how it is filled with many things: OnGameModeInit,OnGameModeExit,OnPlayerText,OnPlaye rCommandText,OnPlayerConnect,OnPlayerDissconnect,O nPlayerRequestClass. These are all blank codes. You need to fill them with what you wish to happen in order to make your gamemode full.

4.Filterscript is a small file,again .pwn and .amx,but it is something which you add in filterscripts and server.cfg. When done with both,when connecting to your server you'll see changes-things added from it. The Filterscript is a way to add something you scripted which you don't want in your gamemode.

5ZCMD is a include you need to add in your "include" and than do a #include <ZCMD> below your #include <a_samp> to start reading it. It is the most easiest way to create commands. Here is the link to download it: CLICK
When you finish downloading it,go to your server's directory, PAWNO,Includes,place it there.

6. Using ZCMD is really easy. For an example,you do like this:
pawn Code:
CMD:[command](playerid,params[])
{
    //Type what you wish your command to do here.
    return 1;
}
Here is one of my commands:
pawn Code:
CMD:help(playerid,params[])
{
    SendClientMessage(playerid,COLOR_WHITE,"Instant Weapons:/mp5");
    SendClientMessage(playerid,COLOR_WHITE,"Store Commands:/drink /buygun /loan");
    SendClientMessage(playerid,COLOR_WHITE,"Drinkable Items:/beer /whiskey /vodka /water");
    SendClientMessage(playerid,COLOR_WHITE,"Common Commands:/respawn");
    return 1;
}
So,let me explain more.

pawn Code:
CMD:help(playerid,params[]) // This is your command CMD:help is when you create /help
{  //The thing which gives a start to the things that'll happen from the command.
    SendClientMessage(playerid,COLOR_WHITE,"Instant Weapons:/mp5"); //The player which typed the command gets this message.
    SendClientMessage(playerid,COLOR_WHITE,"Store Commands:/drink /buygun /loan");//The player which typed the command gets this message.
    SendClientMessage(playerid,COLOR_WHITE,"Drinkable Items:/beer /whiskey /vodka /water");//The player which typed the command gets this message.
    SendClientMessage(playerid,COLOR_WHITE,"Common Commands:/respawn");//The player which typed the command gets this message.
    return 1; //The command's functions end by typing return 1;
} //The code is fully ended.
7. Creating a dialog is made by a command,let me show you an expample:
pawn Code:
CMD:help(playerid,params[])
{
    ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Help Menu","Account\nCommands\Admin\Helper\Shops\Houses","Enter","Exit");
    return 1;
}
Let me explane how it goes now.

pawn Code:
CMD:help(playerid,params[]) //The command
{ //The code starts
    ShowPlayerDialog //The first thing to type when coding a dialog
playerid // The ID of the player who used the command
"Help Menu" //The name of the dialog box
DIALOG_STYLE_LIST //The style of the dialog Note that the styles can be LIST,PASSWORD,MSG
"Account\nCommands\Admin\Helper\Shops\Houses" //What to show in the box
"Enter" //The first button on left
"Exit" //The second button on right
    return 1; //The function ends
} //The code is finished
8 Making a dialog responce goes by this way.

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) // Lookup the dialogid
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, 0xFF0000FF, "//What happens when you click the right button.");
                return 1; // We processed it
            }
 
            switch(listitem) // This is far more efficient than using an if-elseif-else structure
            {
                case 0: // Listitems start with 0, not 1
                {
                    // What should happen when they click on the first item?
                }
                case 1:
                {
                    // And the second item?
                }
                case 2:
                {
                    // We can keep going on here
                }
                // Add the rest of your listitems for dialog 1 here
 
            }
 
        }
        // Add the rest of your dialogs here
 
    }
    return 0; // If you put return 1 here the callback will not continue to be called in other scripts
}
9 Creating objects,let me give you an example.

pawn Code:
public OnGameModeInit()
{
CreateObject(14881,1468.40002441,-677.00000000,75.30000305,0.00000000,0.00000000,0.00000000);
return 1;
}
Let me explain now.
pawn Code:
CreateObject //Starts the code-tells that it creates the object
14881 //Model ID   
1468.40002441 //Float:X
-677.00000000 //Float:Y
75.30000305 //Float:Z
0.00000000 //Rotation:X
0.00000000 //Rotation:Y
0.00000000 //Rotation:Z
10 Creating vehicles,let me give you an example.

pawn Code:
AddStaticVehicleEx(497,990.70001221,1037.50000000,48.40000153,288.00000000,-1,-1,15); //Police Maverick
The same goes for it with the model and Float:X,Y and Z,no rotations and colors at the end.
Reply
#2

Nice
Reply
#3

Nice tut man
Reply
#4

No offense but this tutorial is MISLEADING.

First thing, you just copied the Dialog thing from the samp wiki and that's just stupid, no offense.

pawn Code:
CMD:help(playerid,params[]) //The command
{ //The code starts
    ShowPlayerDialog //The first thing to type when coding a dialog
playerid // The ID of the player who used the command
"Help Menu" //The name of the dialog box
DIALOG_STYLE_LIST //The style of the dialog Note that the styles can be LIST,PASSWORD,MSG
"Account\nCommands\Admin\Helper\Shops\Houses" //What to show in the box
"Enter" //The first button on left
"Exit" //The second button on right
    return 1; //The function ends
}
Then again, this is a epic fail. You didn't show the dialogid part here. And you forgot to mention the \r\n for Windows and \n for Linux.


2. You didn't #define COLOR_WHITE nor taught them how to do it.
When I was a noob, I always made this mistake of not defining COLOR_WHITE and I didn't know how to define and all this stuff when i was a real noob.


And then the filterscript part, That's just wrong knowledge. Filterscripts are mini-scripts that are used for the convenience of using/NOT using some part of the code. They can be easily loaded and unloaded without the server being disturbed.


Then the PAWNO part. PAWNO is a coding language, not just SAMP scripting, but you can create MUCH stuff with it. Go ****** it on wikipedia. It's not just SAMP that uses PAWNO, It's many other games too!
Reply
#5

Quote:
Originally Posted by Gangs_Rocks
View Post
Then the PAWNO part. PAWNO is a coding language, not just SAMP scripting, but you can create MUCH stuff with it. Go ****** it on wikipedia. It's not just SAMP that uses PAWNO, It's many other games too!
um PAWNO is NOT a language! It is an editor for the Scripting language PAWN.

Besides that i dont see where they say its only for samp.
Reply
#6

Look guys,all I wanted to do is just write something that will help very beginners with PAWNO,I am still learning with the OnDialogResponse,thats why I used the one from SAMP WIKI. Sorry for using other people's work,but just wanted to add it so I can help people who need help and get on this thread.
Reply
#7

Let me add the define part.



DEFINES
1.Define is a code with which you use for making your work easier,here is an example.

pawn Code:
#define COLOR_WHITE 0xFFFFFFAA
pawn Code:
#define //The first part of the code
COLOR_WHITE //The name of the color you wish to give
0xFFFFFFAA //The code of the color
this is all I can add for now,I'm from a dongle and don't got much time left on the internet.
Reply
#8

Good tut bro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)