Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xian

Pages: [1]
1
Tutorial / Re: [TUTORIAL] How to use ShowPlayerDialog?
« on: April 22, 2013, 11:07:08 pm »
Input dialog example(s) :
Code: [Select]
ShowPlayerDialog(
    playerid,
    1337,
    DIALOG_STYLE_INPUT,
    "Food Shop",
    "(1). Burger\n(2). Pizza\n(3). Donuts\nPlease input the number of the food you want to buy.",
    "Input", "Exit"
);

At OnDialogResponse :
Code: [Select]
switch ( dialogid )
{
    case 1337:
    {
        if ( response )
        {
            new food = strval( inputtext );
            if ( !( 1 <= food <= 3 ) ) return SendClientMessage( playerid, -1, "Invalid food ID! <1-3>" );
            new food_name[ 100 ];
            switch ( food )
            {
                case 0: food_name = "Burger";
                case 1: food_name = "Pizza";
                case 2: food_name = "Donuts";
            }
            new str[128]; format(str, 128, "You have bought a %s", food_name);
            SendClientMessage(playerid, -1, str);
        }
    }
}
yum, yum, that's delicious. Anyway, thanks for listing out a tutorial of INPUT. ;)

2
Tutorial / [TUTORIAL] How to use ShowPlayerDialog?
« on: April 22, 2013, 09:22:11 pm »
Hello guys, before I start this tutorial, you should have a include called ZCMD because we'll use it later.

Remember to put ZCMD:
Code: [Select]
#include <a_samp>
#include <zcmd>

First, if you've ZCMD now, please find this and remove it:
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
   if (strcmp("/mycommand", cmdtext, true, 10) == 0)
   {
      // Do something here
      return 1;
   }
   return 0;
}

After that, make a new command with your newly ZCMD. >.>
Code: [Select]
CMD:dialog(playerid,params[])
{
   /*We'll learn here!*/
   return 1;
}

Alright, if you've copied the "/*We'll learn here*/", remove it, and make a ShowPlayerDialog.
Code: [Select]
CMD:dialog(playerid,params[])
{
   ShowPlayerDialog();
   return 1;
}

No, don't compile it yet. Now let's see the ShowPlayerDialog's parameters:
Code: [Select]
(playerid, dialogid, style, caption[], info[], button1[], button2[])I will explain it here now.
"playerid" - The ID of the player to show the dialog to. (Obviously to you)
"dialogid" - An ID to assign this dialog to, so responses can be processed. Max dialogid is 32767. Using negative values will close any open dialog.
"style" - The style of the dialog. (4 types of dialog, "DIALOG_STYLE_MSGBOX, DIALOG_STYLE_LIST, DIALOG_STYLE_INPUT, DIALOG_STYLE_PASSWORD *not recommended*)
"caption[]" - The title of the dialog.
"info" - Its info in it.
"button1[]" - The first button, for example, "yes".
"button2[]" - The second button, for example, "no", you can also use "" if you want to hide it.

Now, you've understand it, if you don't understand it, read it again.

Alright, let's make a dialog!
Code: [Select]
CMD:dialog(playerid,params[])
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog", "Hello, this is my first dialog", "Yay!", "Boo!");
return 1;
}

This is an example dialog without response. (DIALOG_STYLE_MSGBOX is the suitable one)

Now, let's make a dialog with response. (I suck at this)
Code: [Select]
CMD:dialog2(playerid,params[])
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Dialog", "Response 1\nResponse 2\nResponse 3", "Choose", "Exit");
return 1;
}

Alright, after creating it, now search for this:
Code: [Select]
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

Now, let's make a response.
Code: [Select]
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
    case 2:
    {
    if(response)
    {
        switch(listitem)
        {
        case 0: return SendClientMessage(playerid, 0xFFFFFFAA, "Response 1");
        case 1: return SendClientMessage(playerid, 0xFFFFFFAA, "Response 2"), DestroyVehicle(1); //With two response in return
        case 2: return SendClientMessage(playerid, 0xFFFFFFAA, "Response 3"), SetPlayerPos(playerid, 0.0, 0.0, 3.0),DestroyVehicle(2); //With 3 response in return
        }
}
}
}
return 1;
}
*DestroyVehicle is just giving an example!

Now, you're done, good luck in scripting OnPlayerDialog (You will only use DIALOG_STYLE_MSGBOX and LIST only, that's why I don't give a tutorial in INPUT and PASSWORD, not really know with INPUT and PASSWORD)

3
Gamemode / Re: Stunt Project V2 [v1.0 Version]
« on: April 22, 2013, 08:42:05 pm »
Updated to v1.0 version!

4
Fliterscript / Weapon Spawner + AFK + Godmode by LeeXian99
« on: April 22, 2013, 11:56:47 am »
Hey guys, I've created a simple fliterscript which contained some commands! Anyway, this is my really first filterscript, hope you'll like it!

/weapons, /godmode and /afk! I know this is easy to create but I decided to publish it and I am using it on my server. ;)

So, here's some picture of it, I don't put IMG because its screen solution is too big! ( 1366*768 )

Pictures

Source: Download
.amx file: Download

You can edit it easily, but at least give me a credit. :) Thanks.

5
Tutorial / [TUTORIAL] How to script? (For beginner)
« on: April 21, 2013, 09:44:50 pm »
So, this is my first attempt to make a tutorial. :3

First, you need to download the package here if you're using Windows or here if you're using Linux 32 bit.

After installed, extract it to a folder.

And open pawno > pawno.exe.
*Note: If you're using Windows Vista or higher, you must right click > Run as administrator. If not, you will get a warning: "Couldn't be executed" or w/e...

After open it, press the new button. After open it, this is your first script. :3

Code: [Select]
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

So, as you see this is your first script... Let's start making your first own gamemode!
So, let's change this thing.
Code: [Select]
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
to
Code: [Select]
main()
{
print("\n----------------------------------");
print(" Tutorial by xian");
print("----------------------------------\n");
}

Alright, after change it, we'll start to make commands!
Find public OnPlayerCommandText...
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}

Now, let's do something with it!
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFFFF00AA, "This is help from the server.");
return 1;
}
return 0;
}

Of course, you can add anything you like in it!
But if you want to make another command... You need to be pay more attention now.
Code: [Select]
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/help", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, 0xFFFF00AA, "This is help from the server.");
return 1;
}

if (strcmp("/test", cmdtext, true, 10) == 0)
{
    SendClientMessage(playerid, 0xFFFFFFAA, "This is a test message");
    return 1;
}
return 0;
}

After make it (You can make any numbers of commands in your gamemode!)

Now, let's add something to OnPlayerConnect!
Code: [Select]
public OnPlayerConnect(playerid)
{
return 1;
}

Alright, let's start!
Code: [Select]
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, 0x00FFFFAA, "Welcome to My Tutorial Server!");
return 1;
}

Alright, but if you want to add string, let's start with it.
We'll create two new's, these are: name and string.
Code: [Select]
new name[25], string[100];
Why do I put 25 strings on name but not a higher string? Reason: "The SAMP name character has only 24 characters, so don't put them higher than 25, but if you unsure with this, put name[MAX_PLAYER_NAME]"

Now, let's do something on name and string!
Code: [Select]
GetPlayerName(playerid, name,sizeof(name));
format(string,sizeof(string), "Player %s has joined the server.", name);

Alright, it's done, but we haven't give it a callback, add SendClientMessageToAll.
Code: [Select]
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string), "Player %s has joined the server!", name);
SendClientMessageToAll(-1, string);

The entire code should be like this.
Code: [Select]
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], string[100];
SendClientMessage(playerid, 0x00FFFFAA, "Welcome to My Tutorial Server!");
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string), "Player %s has joined the server!", name);
SendClientMessageToAll(-1, string);
return 1;
}

So, do the same to the OnPlayerDisconnect, just remove the "SendClientMessage(playerid, 0x00FFFFAA, "Welcome to My Tutorial Server!");" and replace "joined" to "leave".

So, the code should be like this.
Code: [Select]
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], string[100];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string), "Player %s has left the server!", name);
SendClientMessageToAll(-1, string);
return 1;
}

So, I think I'm done here. If you've any suggestion or problem, please reply here.

6
Gamemode / Stunt Project V2 [v1.0 Version]
« on: April 21, 2013, 09:33:29 pm »
Hello, this is my first gamemode and it has been used in my server. You can download it and add some commands you want!

I don't include the plugins and include in pawnos because I know some of them just copy and paste, so search the plugins and include yourself in here.

v1.0:
Source:Here
Done, can be used if you've plugins: Here

Beta: (Not recommended)
Source: Here
Done, can be used if you've plugin: Here

Code: [Select]
Changelog:

Beta Version:
Intinally release

v1.0:
-Added Hours system (pInfo[playerid][Hours])
-Fixed some camera bugs!
-Removed some useless codes.

7
You need to practice more about this and you'll eventually know this. :3

8
Include / Command Processor
« on: April 21, 2013, 09:04:49 pm »
Hello guys, I'm here as kelvin, i leave kelvin account alone and use it when needed! So, here's some command processor of it.

ZCMD - One of the fastest command processor.
DCMD - Slowest, jks, idk.
rCMD - I'm not sure.
LifeCMD - Not sure though!
YCMD - One of the include in YSI!

So, if any other processors, please reply here!

Pages: [1]