SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 03/06/2012, 04:22 PM   #1
Tom Kingston
Big Clucker
 
Tom Kingston's Avatar
 
Join Date: May 2012
Posts: 53
Reputation: 5
Default Tutorial for starting scripters

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.
Tom Kingston is offline   Reply With Quote
Old 03/06/2012, 11:23 PM   #2
StrangeLove
Huge Clucker
 
StrangeLove's Avatar
 
Join Date: Nov 2011
Location: Philippines
Posts: 223
Reputation: 26
Default Re: Tutorial for starting scripters

Nice
__________________
Life is but a dream.
StrangeLove is offline   Reply With Quote
Old 03/06/2012, 11:56 PM   #3
swindle69
Little Clucker
 
Join Date: Nov 2010
Posts: 22
Reputation: 0
Default Re: Tutorial for starting scripters

Nice tut man
swindle69 is offline   Reply With Quote
Old 04/06/2012, 11:23 AM   #4
Gangs_Rocks
Big Clucker
 
Join Date: Feb 2012
Location: Mars
Posts: 115
Reputation: 13
Default Re: Tutorial for starting scripters

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 google it on wikipedia. It's not just SAMP that uses PAWNO, It's many other games too!
Gangs_Rocks is offline   Reply With Quote
Old 04/06/2012, 12:19 PM   #5
Jonny5
Gangsta
 
Join Date: Mar 2012
Location: Mi, USA
Posts: 935
Reputation: 146
Default Re: Tutorial for starting scripters

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 google 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.
__________________
If your topic says "REP+", I ignore it.

If you haven't tried it I suggest you do so.
Pawn PlayGround By Slice!
Jonny5 is offline   Reply With Quote
Old 04/06/2012, 12:45 PM   #6
Tom Kingston
Big Clucker
 
Tom Kingston's Avatar
 
Join Date: May 2012
Posts: 53
Reputation: 5
Default Re: Tutorial for starting scripters

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.
__________________
SAMP Player since 2010, hardcore Roleplayer.
Tom Kingston is offline   Reply With Quote
Old 04/06/2012, 12:51 PM   #7
Tom Kingston
Big Clucker
 
Tom Kingston's Avatar
 
Join Date: May 2012
Posts: 53
Reputation: 5
Default Re: Tutorial for starting scripters

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.
__________________
SAMP Player since 2010, hardcore Roleplayer.

Last edited by Tom Kingston; 08/06/2012 at 05:32 PM.
Tom Kingston is offline   Reply With Quote
Old 07/07/2012, 08:19 PM   #8
Rg-Gaming.Info
Huge Clucker
 
Rg-Gaming.Info's Avatar
 
Join Date: Jan 2012
Location: Europe
Posts: 231
Reputation: 10
Default Re: Tutorial for starting scripters

Good tut bro.
Rg-Gaming.Info is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial]Starting Up A Successful Server Jack_Rocker Server Support 1 02/10/2011 08:10 AM
[Tutorial] Kako napraviti tutorial sa TextDraw-ovima Gagi_Corleone Archive 15 30/09/2011 11:56 AM
[GF-Tutorial] & [NON-GF-Tutorial] : Fahrschule Mit Fragen Erstellen V.2.0 [Erfor playafaller Archive 1 26/12/2009 03:24 PM


All times are GMT. The time now is 12:02 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.