[Tutorial] Basic Filterscript Tutorial
#1

Well this is my first post and i think players may like it, I don't mind if you don't as i'm quite new to coding in "pwn".

Before doing anything.
1)Load Pawno
2)Press CTRL+N
3)Press CTRL+A
4)Press Delete
5)You're ready!

Ok so fist you have to define it as a filterscript
Код:
#define FILTERSCRIPT //This is a comment, Use it to display the information you need
So now you've defined it you have to include the a_samp
Код:
#include <a_samp> //This includes it into the actual game!
After that we create a "IF" statement This can be done like this
Код:
#if defined FILTERSCRIPT
Now we start to create the actual script. If you wan't a initialization message (When the script loads) use this
Код:
public OnFilterScriptInit()
{
    //Code here Tabbed out to make sure its easily understood
    return 1;
}
Example of this
Код:
public OnFilterScriptInit()
{
	print("\n----------------------------------");
	print(" .........:Tutorial's Are Cool As:...........");
	print("----------------------------------\n");
	return 1;
}
Using that we'll need a exit one.
Код:
public OnFilterScriptExit()
{
    return 1;
}
Now we can create the messages so when the player spawns it displays them.
Код:
public OnPlayerSpawn(playerid) //This will get there playerid on spawn
{
    SendClientMessage(playerid,colour,"message");
    return 1;
 //Thats the basic, to make it better you can actually add multipul entries
}
Код:
public OnPlayerSpawn(playerid)
{
   SendClientMessage(playerid,0xFFFFFF,"Welcome, Type /help or /commands for more info!");
   return 1;
}
Now we're going to do a command input, This will allow the player to type in a command and it's displayed.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/info", cmdtext, true) == 0)
	{
	SendClientMessage(playerid,0xFFFFFF,"Creator: Kyle Magix ");
//Thats the base example To expand you can have lots of lines.
}
Heres the proper example
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/info", cmdtext, true) == 0)
	{
	SendClientMessage(playerid,0xFFFFFF,"Creator: Kyle Magix ");
	SendClientMessage(playerid,0xFFFFFF,"Tested By: You! ");
	SendClientMessage(playerid,0xFFFFFF,"Use /jobhelp to find out how to get a job ");
	}
}
Developing on this you can send a message to all players by using
Код:
SendClientMessageToAll(COLORCODE,"TEXT");
Heres the correct example.
Код:
SendClientMessageToAll(0xFF0000,"This is a tutorial and thanks for viewing it");
at the very end of the script you need a ending statement which can be done by this.
Код:
#endif
Thanks for viewing the tutorial, I hope i helped you. If you have any help you wan't to give me Please post it in the comments,
~Thanks
Kyle_Magix(RevolutionLite)
Reply


Messages In This Thread
Basic Filterscript Tutorial - by RevolutionLite - 19.11.2012, 19:07
Re: Basic Filterscript Tutorial - by Socan - 19.11.2012, 19:09
Re: Basic Filterscript Tutorial - by RevolutionLite - 19.11.2012, 19:10
Re: Basic Filterscript Tutorial - by Vince - 19.11.2012, 19:15
Re: Basic Filterscript Tutorial - by RevolutionLite - 19.11.2012, 19:18
Re: Basic Filterscript Tutorial - by RevolutionLite - 19.11.2012, 21:17
Re: Basic Filterscript Tutorial - by Gh05t_ - 19.11.2012, 21:39
Re: Basic Filterscript Tutorial - by RevolutionLite - 20.11.2012, 14:30
Re: Basic Filterscript Tutorial - by [FSaF]Jarno - 07.12.2012, 19:24
Re: Basic Filterscript Tutorial - by RevolutionLite - 07.12.2012, 20:53

Forum Jump:


Users browsing this thread: 4 Guest(s)