<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>SA-MP Forums - Tutorials</title>
		<link>http://forum.sa-mp.com/</link>
		<description>A place where you can post tutorials related to sa-mp scripts.</description>
		<language>en</language>
		<lastBuildDate>Mon, 20 May 2013 03:19:12 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forum.sa-mp.com/images/misc/rss.jpg</url>
			<title>SA-MP Forums - Tutorials</title>
			<link>http://forum.sa-mp.com/</link>
		</image>
		<item>
			<title><![CDATA[[Tutorial] Virtual world and interior system explanation]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=438238&amp;goto=newpost</link>
			<pubDate>Sun, 19 May 2013 10:47:16 GMT</pubDate>
			<description>*Virtual world 
and 
interior system 
 
* 
 
NOTE: This tutorial is a sequel/prequel to the Coordinate-system-explanation...</description>
			<content:encoded><![CDATA[<div><b><font size="5"><div align="center">Virtual world<br />
and<br />
interior system<br />
</div></font></b><br />
<br />
NOTE: This tutorial is a sequel/prequel to the <a href="http://forum.sa-mp.com/showthread.php?t=415205" target="_blank">Coordinate-system-explanation</a><br />
<br />
<br />
<b><font size="4">1. Interiors - what are they?</font></b><br />
Interiors are basically a different VIEW towards the default GTA. You remain in the same world, but you cannot see the world, although you can still feel it.<br />
 <br />
Interior 0 =&gt; The default GTA world<br />
Interior 1 to infinite =&gt; The same GTA world, but different view.<br />
<br />
<img src="http://img515.imageshack.us/img515/7397/samp588v.png" border="0" alt="" /><br />
<img src="http://img546.imageshack.us/img546/9605/samp589z.png" border="0" alt="" /><br />
<br />
<font size="4">How are they useful?</font><br />
<br />
The default GTA SA world objects are only visible in INTERIOR 1<br />
BUT<br />
Script-added objects are visible in ALL interiors, thus making it possible to create different worlds, creating different custom interiors. There are endless ways to utilize the interior's, but that gets even better with virtual worlds. <br />
<br />
Also, vehicles exist in all interiors as they are, but they're invisible in every other interior except the one that they're created in (<i>This can be solved by linking the vehicle to interior</i>)<br />
<br />
<br />
<b><font size="4">2. Virtual worlds - what are they?</font></b><br />
<br />
Virtual worlds are completely different worlds, although with the SAME point of view (<i>The point of view can be altered with the help of interiors</i>). Objects remain same throughout all the virtual worlds, but the same cannot be said for vehicles.<br />
Vehicles must be in the same virtual world as the player who wants to see them in order to be visible (<a href="http://wiki.sa-mp.com/wiki/SetVehicleVirtualWorld" target="_blank">SetVehicleVirtualWorld</a>)<br />
This can be used for creating RACES (wouldn't want to get rammed by non-racers while you're racing, would you?), but that's just one idea, there are endless possibilities to what you can do with these 2!<br />
<br />
P.S: I know that this tutorial is not very informative, but I think it explains the basic concept of what virtual worlds and interiors are, and what they can be used for<br />
<br />
<br />
<b><font size="5">Conclusion</font></b><br />
<br />
This concludes with 3 type's of data of LOCATION for EACH player<br />
<br />
<img src="http://img507.imageshack.us/img507/5862/conceptg.png" border="0" alt="" /><br />
<br />
In simpler words, if all these 3 are utilized in an innovative and efficient way, you can create a number of dimensions (Although virtual worlds are limited to 2,147,483,647, and there's no limit mentioned to interiors but I guess there is one)<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="6" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="alt2">
			<hr />
			
				<div>
					Originally Posted by <strong>BigETI</strong>
					(Post 2533046)
				</div>
				<div style="font-style:italic">Coordinates and interior IDs are basicly GTA SA game engine inbuild features. Interior IDs just changes the way the game engine renders the scenes, still the collision calculations remain the same. Virtual worlds are a feature from SA:MP to change the way how players stream players, vehicles, pickups etc. so basicly someone in the 1st virtual world won't see someone in the 2nd virtual world even, if they are almost at the same position, since the server only streams players, vehicles and pickups, if the virtual worlds equals the entity uses. Virtual worlds can't be manipulated using cheating engines.</div>
			
			<hr />
		</td>
	</tr>
	</table>
</div></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>CreativityLacker</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=438238</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] How to make a very simple Anti-Spawn Kill]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=438100&amp;goto=newpost</link>
			<pubDate>Sat, 18 May 2013 17:17:40 GMT</pubDate>
			<description><![CDATA[*Okay, so I'm getting bored ATM so, I've decided to make this very simple tutorial about Anti-Spawn Killing. 
Basically its only 9 Lines. 
Okay, lets...]]></description>
			<content:encoded><![CDATA[<div><div align="center"><b>Okay, so I'm getting bored ATM so, I've decided to make this very simple tutorial about Anti-Spawn Killing.<br />
Basically its only 9 Lines.<br />
Okay, lets get started.</b><br />
<font color="Black">-------------------------------------------------------------------</font><br />
<br />
<font face="Arial Black"><font size="5"><font color="Red"><font color="Black"><b>First :</b></font></font></font></font><br />
<b>We need to put it on the OnPlayerDeath callback.</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:87px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">public</span> OnPlayerDeath<span style="color: #000000;">&#40;</span>playerid, killerid, reason<span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #2222BB;">return</span> <span style="color: #000000;">1</span>;<br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<font size="5"><font face="Arial Black"><b><font color="Red"><font color="Black">Second :</font></font></b></font></font><br />
<b>We will use the IsPlayerInRangeOfPoint, but, instead of playerid, we will use Killerid.<br />
Then find the Spawn coordinates of each teams.</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">IsPlayerInRangeOfPoint<span style="color: #000000;">&#40;</span>killerid, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>size, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnX, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnY, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnZ<span style="color: #000000;">&#41;</span>;</div></div></pre>
</div><br />
<b><font size="5"><font color="Red"><font color="Black"><font face="Arial Black">Third :</font></font></font></font><br />
Then, we will now merge it in the OnPlayerDeath callback.</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:151px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">public</span> OnPlayerDeath<span style="color: #000000;">&#40;</span>playerid, killerid, reason<span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerInRangeOfPoint<span style="color: #000000;">&#40;</span>killerid, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>Range, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnX, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnY, <span style="color: #000000;">Float</span><span style="color: #000000;">:</span>SpawnZ<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #228822;">// do whatever punishment you want to do with the Spawn Killer here.</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<span style="color: #2222BB;">return</span> <span style="color: #000000;">1</span>;<br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
<b><font face="Arial Black"><font size="5"><font color="Red"><font color="Black">Example :</font></font></font></font></b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:167px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">public</span> OnPlayerDeath<span style="color: #000000;">&#40;</span>playerid, killerid, reason<span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;<span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerInRangeOfPoint<span style="color: #000000;">&#40;</span>killerid, <span style="color: #000000;">20</span>, <span style="color: #000000;">1587</span>, <span style="color: #000000;">-</span><span style="color: #000000;">1693</span>, <span style="color: #000000;">7</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #228822;">// It means that if the player is within 20 meter range some around the Garage of LSPD the following will happen :</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>killerid, <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>; <span style="color: #228822;">// my punishment for the Spawn Killer is Death.</span><br />&nbsp; &nbsp; SendClientMessage<span style="color: #000000;">&#40;</span>killerid, Red, <span style="color: #000066;">&quot;SERVER : You can't spawn kill!&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #228822;">// then sends him a message that he can't spawn kill</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;<span style="color: #2222BB;">return</span> <span style="color: #000000;">1</span>;<br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><b>Suggestions of all types are open.<br />
Please help me improve if anything is wrong in the tutorial!</b></div></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>Lagger321</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=438100</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] How to add a player to your script]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437985&amp;goto=newpost</link>
			<pubDate>Sat, 18 May 2013 07:03:53 GMT</pubDate>
			<description><![CDATA[*_Today I will show you how to add a skin to your script._* 
To start off, Open up Pawno and click new. 
 
Now look for "*AddPlayerClass*" 
 
*When...]]></description>
			<content:encoded><![CDATA[<div><font face="Georgia"><b><u><font color="Green"><font size="4">Today I will show you how to add a skin to your script.</font></font></u></b></font><br />
To start off, Open up Pawno and click new.<br />
<br />
Now look for &quot;<b><font face="Arial Black"><font color="Red">AddPlayerClass</font></font></b>&quot;<br />
<br />
<b>When you have found that... Read the following information:<br />
<br />
What is this line Used for?<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">AddPlayerClass<span style="color: #000000;">&#40;</span><span style="color: #000000;">0</span>, <span style="color: #000000;">1958.3783</span>, <span style="color: #000000;">1343.1572</span>, <span style="color: #000000;">15.3746</span>, <span style="color: #000000;">269.1425</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div>This line is used for adding ped's into your script/Server:<br />
The Meaning of that line is:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">AddPlayerClass<span style="color: #000000;">&#40;</span>Player model, X, Y, Z, A, Weapon <span style="color: #000000;">0</span>, Ammo <span style="color: #000000;">0</span>, Weapon <span style="color: #000000;">1</span>, Ammo <span style="color: #000000;">1</span>, Weapon <span style="color: #000000;">2</span>, Ammo <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div>Infomation about the script line:<br />
Player model<br />
The player Model, Is the players skin ID. To use a Rich means skin, Use skin ID=59.<br />
To use a Sureno gang banger skin, Use skin ID=175.<br />
So if you wanted to use a rich man skin you would have your code like this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:55px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">AddPlayerClass<span style="color: #000000;">&#40;</span><span style="color: #000000;">59</span>, X, Y, Z, A, Weapon <span style="color: #000000;">0</span>, Ammo <span style="color: #000000;">0</span>, Weapon <span style="color: #000000;">1</span>, Ammo <span style="color: #000000;">1</span>, Weapon <span style="color: #000000;">2</span>, Ammo <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>;<br />X,Y,Z,A</div></div></pre>
</div>X Y Z Are the Coords Aka Coordinates, This tells the script when the person picks his player, To spawn that player were the coords were set to.<br />
The A is the facing angle of the player, So if you want your player to be facing somewere, Use this.<br />
Soo, If you wanted the player to start at Unity Station and want him to have a rich man skin, You would have this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">AddPlayerClass<span style="color: #000000;">&#40;</span><span style="color: #000000;">59</span>,<span style="color: #000000;">1799.7964</span>,<span style="color: #000000;">-</span><span style="color: #000000;">1867.6007</span>,<span style="color: #000000;">13.5700</span>,<span style="color: #000000;">347.3619</span>,Weapon <span style="color: #000000;">0</span>, Ammo <span style="color: #000000;">0</span>, Weapon <span style="color: #000000;">1</span>, Ammo <span style="color: #000000;">1</span>, Weapon <span style="color: #000000;">2</span>, Ammo <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>;</div></div></pre>
</div>Weapon 0-2 And Ammo 0-2<br />
Weapon is the weapon that the player gets when he spawns. Weapon ID=24 Is an Deagle And Weapon ID 30 Is an AK-47.<br />
Ammo is the bullets that the weapon has. So if you want a player to start a Unity station with a rich man skin and an AK-47 <br />
With 300 bullets you would put in this:<br />
AddPlayerClass(59,1799.7964,-1867.6007,13.5700,347.3619,30, 300, 0, 0, 0, 0);<br />
Reminder: If you want a player with no weapon, Just put a 0 for the Weapon and put a 0 for the ammo.<br />
<br />
Ok, That tells us what the script line means. Now lets tell you how to get Coords.<br />
Open up your GTA:SA Folder and there should be something called &quot;samp_debug.exe&quot;. Ok, Open it up. <br />
You should see that GTA:SA started with nothing Only Cj running around with no weapons.<br />
<br />
Now go to the place were you want your player to start, Then Press &quot;T' Or 'F6' to type in the command &quot;/save&quot;.<br />
HINT:Next to save you can wirte something that would let your rember that you just saved so do this:<br />
/save New Player Spawn.<br />
Ok, Now you have saved the place were you want the player to start. Now got into your GTA:SA folder and there should be something named:<br />
&quot;Savedpositions.Txt&quot;<br />
Open that up and you have the Coords of were you want your player to start, All you have to do now is copy the X Y Z and A from the &quot;Savedpositions.Txt&quot;<br />
file and just replace it with the one you have on your script.</b><br />
<br />
<br />
<font color="Navy"><b>So there you go, You made your first player in your script with a gun.</b></font></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>Lagger321</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437985</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] Beautiful, Readable Code II (Indentation Styles)]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437855&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 16:06:58 GMT</pubDate>
			<description>*Beautiful, Readable Code II - Indentation Styles* 
 
 
Foreword 
 
 
The idea for this thread was brought to me by Vince in the previous thread,...</description>
			<content:encoded><![CDATA[<div><font size="6"><div align="center"><font face="Century Gothic"><b>Beautiful, Readable Code II - Indentation Styles</b></font></div></font><br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Foreword</div></font></font><br />
<br />
The idea for this thread was brought to me by Vince in the previous thread, Beautiful, Readable Code I. If you haven't seen that thread yet, I would recommend you read it first by <a href="http://forum.sa-mp.com/showthread.php?t=437374" target="_blank">clicking here</a>. In my previous thread I went through several key characteristics of writing readable code including indentation (in general), white space, and comments. That being said, I neglected to touch on indentation styles. I tried to keep my previous thread as &quot;one size fits all&quot; as possible as to not conflict with the different styles of indentation (although inevitably I did). I am creating this thread to explain (in as much detail as necessary for SA-MP scripting purposes) the different styles of indentation and their benefits. I will only be touching on certain popular styles that lay the groundwork for other styles, so to gain a more complete knowledge of indentation styles you may desire to do some reading on your own. <br />
<br />
Oh, and one more thing! In the examples I provide I will be creating a simple command using the most popular command processor, ZCMD. If you aren't familiar with the processor, you can read about it by <a href="http://forum.sa-mp.com/showthread.php?t=91354" target="_blank">clicking here.</a> Keep in mind that the example command is simply meant to demonstrate indentation.<br />
<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Benefits</div></font></font><br />
<br />
One common misconception is that the length of a script determines how well that script will perform. This is simply not true. The only reason this generalization exists is because of the poorly-written nature of some of the most popular scripts in the community. Somewhere along the line, members of the SA-MP community began to associate a lot of lines in a script with that script being poorly written. While it is possible that a long script is poorly written, on the other hand a script is not poorly written just because it is long. This is an important distinction to understand.<br />
<br />
Because of the obsession with line count in the SA-MP scripting community, the choice of indentation styles has been heavily influenced as of recent. As you will see in the examples below, some styles of indentation will produce more lines than others. Keep in mind that despite what indentation style you choose, your script will perform at EXACTLY the same rate. More lines does NOT mean less performance. Instead of focusing on which indentation style creates the least amount of lines, <u>the sole purpose of indentation is readability</u>. Each indentation style affects readability in one way or another, and I will cover these in detail below. While you are reading, focus on which style suits you best and is most appealing. The only benefit that one indentation style provides over another is readability factor, so the indentation style which you find most readable is the one you should use.<br />
<br />
One final benefit to understanding indentation styles is flexibility. Although you may find one style more readable than another, you are not always going to be working with code you have written. If, for example, you begin to edit another person's script, chances are they may be exercising a different indentation style. It is important that you are not only able to interpret the style they are using, but you actually must be able to use it yourself! It is vital that the same style of indentation is used throughout an entire script to ensure continuity. This is simply a matter of standards, and while neglecting it won't produce any errors or affect the script itself, continuity of indentation can make a script more readable should a third party ever need to intervene and read a script edited by more than one person. Be flexible!<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Allman Style</div></font></font><br />
<br />
I have elected to begin this tutorial with the Allman style of indentation because it seems (to me at least) to be the most prominent in the community. Named after Eric Allman, this style of indentation requires the placing of any brace related to a control statement to be placed on its own line. This includes opening and closing braces. See the example below.<br />
<br />
<b>ALLMAN STYLE</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:199px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">COMMAND</span><span style="color: #000000;">:</span>heal<span style="color: #000000;">&#40;</span>playerid, params<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerAdmin<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>playerid, <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">else</span><br />&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; Kick<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
This style of indentation allows nests to be clearly defined, which makes modifications to nests significantly more fluid. If you aren't sure what a nest is, refer to my previous thread's basic explanation of indentation. The amount of white space surrounding different nests provides excellent readability and the matching indentation of the opening and closing braces serves as a clear barrier to define the end of a nest. The visibility of the braces also decreases the possibility of leaving out a brace, one of the most frustrating errors that an inexperienced (or experienced alike) scripter can come across. Some would say that the &quot;disconnected&quot; nature of nests from their control statements actually hurts readability as opposed to the styles below.<br />
<br />
This style of indentation has more recently come under fire in the SA-MP community because it generates more lines than the styles below. Once again, I would like to reiterate that line count in the case of indentation does not affect performance in the slightest. Your main focus in choosing an indentation style should be readability.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Stroustrup Style</div></font></font><br />
<br />
As the second most prominent form of indentation in this community (as I see it), we have the Stroustrup style of indentation. This style is identical to the Allman style, except for the placement of the opening brace on the same line as the initial statement. See the example below.<br />
<br />
<b>STROUSTRUP STYLE</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:151px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">COMMAND</span><span style="color: #000000;">:</span>heal<span style="color: #000000;">&#40;</span>playerid, params<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerAdmin<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>playerid, <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">else</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; Kick<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
As you can initially see, this style takes up considerably less space than the Allman style. The placement of the opening brace on the same line as the initial statement defining the nest allows nested elements to feel more &quot;connected&quot; to their control statements. Some would argue that this makes reading code more effective in terms of determining cause and effect patterns. On the other hand, the lack of white space has been claimed to hurt readability and make the modification of large nests more difficult.<br />
<br />
This style, once again, has become more prominent in the SA-MP community with the obsession of line count. While it is perfectly fine to utilize this method of indentation, make sure that you are using it because it is more readable in your eyes, not because you want to save on line count. Once again, line count in terms of indentation has no effect on performance.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">K&amp;R Style</div></font></font><br />
<br />
Finally we have the K&amp;R style, which is actually the style which the Stroustrup style is derived from. The K&amp;R style is similar to the Stroustrup style in that it places the initial brace on the same line as the initial statement and places the final brace on its own line. The exception comes when <font face="Courier New">else</font> or <font face="Courier New">while</font> are used, where the K&amp;R style places the closing brace on the same line as the else or while keyword. See the example below.<br />
<br />
<b>K&amp;R STYLE</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:135px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">COMMAND</span><span style="color: #000000;">:</span>heal<span style="color: #000000;">&#40;</span>playerid, params<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerAdmin<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>playerid, <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #2222BB;">else</span> <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; Kick<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
As you can see, the K&amp;R style uses up the least amount of space of all of the styles showcased thus far. The question becomes, is this a good thing or a bad thing? Once again, it is a matter of readability in your eyes. Considering the fact that I rarely see K&amp;R on these forums, I would not recommend using it for a new project if at any point someone else may be required to read and modify your existing code. This style of indentation is arguably the most susceptible to leaving out a brace, which is, once again, a very annoying experience.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Summary</div></font></font><br />
<br />
I tried to remain as objective as possible throughout this thread; however, it's probably already clear to you which style of indentation I favor. Try not to let my commentary sway you. If you find K&amp;R to be the most readable and you don't mind knowing that the majority of people on this forum who may be working with your code have no experience with the style, then go for it! To once again reiterate the point of this thread (I know I'm beating a dead horse), <u>readability is the most important factor to consider in choosing an indentation style.</u></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>RvGamers</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437855</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] Howto: Properly handle rcon login spam]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437753&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 06:09:30 GMT</pubDate>
			<description>This contains:  
- Automatic ban of external console logins that fail to login (most of this type of attacks).  
- Warning system (will warn all...</description>
			<content:encoded><![CDATA[<div>This contains: <br />
- Automatic ban of external console logins that fail to login (most of this type of attacks). <br />
- Warning system (will warn all players from same ip not to try to login if they are not admins)<br />
- Flood control - too many false attempts -&gt; ban<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><br />
OnRconLoginAttempt(ip[], password[], success) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; #pragma unused password<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!success) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new hasplayers = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new pip[16];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (new PlayerID=0; PlayerID &lt; MAX_PLAYERS; PlayerID++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!IsPlayerConnected(PlayerID))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetPlayerIp(PlayerID, pip, sizeof(pip));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strcmp(ip, pip, true)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasplayers++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // protect nubs against their stupidity.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new timex = TimeSincePvar(PlayerID, &quot;last_rcon_attempt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (timex &gt; 1000) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendPlayerMessage(PlayerID, COLOR_RED, &quot;Do not abuse the rcon system, you will be banned if you fail to login again.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetPVarInt(PlayerID, &quot;last_rcon_attempt&quot;, TickCount());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new rla;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rla = GetPVarInt(PlayerID, &quot;rcon_login_attempts&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rla = rla + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (rla &gt; 3) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // ban the ip via rcon<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; makestrf(banipstr, 64, &quot;banip %s&quot;, ip);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendRconCommand(banipstr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetPVarInt(PlayerID, &quot;rcon_login_attempts&quot;, rla);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } // loop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (hasplayers == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // ban the ip via rcon<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; makestrf(banipstr, 64, &quot;banip %s&quot;, ip);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SendRconCommand(banipstr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return PCOR_CONTINUE;<br />
}</code><hr />
</div>For: TimeSincePvar - grab it here: <a href="http://forum.sa-mp.com/showpost.php?p=1995778&amp;postcount=40" target="_blank">http://forum.sa-mp.com/showpost.php?...8&amp;postcount=40</a></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>JernejL</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437753</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] Fix: Pawno failed to set data for ".]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437610&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 14:00:25 GMT</pubDate>
			<description><![CDATA[Hi guys, I decided to make this small very simple tutorial for beginners who may not know how to fix this bug, let's say. 
 
I'm sorry for how I...]]></description>
			<content:encoded><![CDATA[<div>Hi guys, I decided to make this small very simple tutorial for beginners who may not know how to fix this bug, let's say.<br />
<br />
I'm sorry for how I express myself, or if I write bad, but I'm Italian.<br />
<br />
So we move to the Tutorial.<br />
<br />
When we go to open the Pawno, a screen will appear that says &quot;failed to set data for&quot;. &quot;.<br />
<img src="http://i.imgur.com/MNPokjf.png" border="0" alt="" /><br />
<br />
To solve this problem we must go to the folder Pawno server, and open the file &quot;Settings&quot;.<br />
<img src="http://i.imgur.com/KGBnlmA.png" border="0" alt="" /><br />
<br />
FileAssoc is set to one, and must be set to zero.<br />
<img src="http://i.imgur.com/7SscVX8.png" border="0" alt="" /><br />
<br />
Well, we set to zero and save the changes to the bloc note.<br />
<img src="http://i.imgur.com/8rRRBcC.png" border="0" alt="" /><br />
<br />
We finished, now the pawno will open normally<br />
<img src="http://i.imgur.com/33DrxMR.png" border="0" alt="" /></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>Maran3llo</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437610</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] How to make a DM zone]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437593&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 12:00:27 GMT</pubDate>
			<description><![CDATA[_DM Zones_ 
 
*Hello guys , in this tutorial i'm going to show you how to make a DM ( Death match ) zone 
It is so simple , you must follow some...]]></description>
			<content:encoded><![CDATA[<div><div align="center"><font face="Fixedsys"><font size="6"><u><font color="SeaGreen">DM Zones</font></u></font></font><br />
<br />
<b>Hello guys , in this tutorial i'm going to show you how to make a DM ( Death match ) zone<br />
It is so simple , you must follow some steps</b><br />
<font size="5"><font color="Lime">Step I:</font></font><br />
<i>New variable</i><br />
<br />
<b>We must create a new variable who's gonna verify if the player is in a DM or not</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:71px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">new</span> <br />&nbsp; &nbsp; &nbsp;DM <span style="color: #000000;">&#91;</span> MAX_PLAYERS <span style="color: #000000;">&#93;</span> <br />;</div></div></pre>
</div><b>You must create a variable with [ MAX_PLAYERS ]because it must be a variable for a player not a global variable </b><br />
<font size="5"><font color="Lime">Step II:</font></font><br />
<i>Making a DM Zone by command</i><br />
<b>If you wanna to make a DM zone available you must set the variable which we created to 1<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;">DM <span style="color: #000000;">&#91;</span> playerid <span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #000000;">1</span> ;</div></div></pre>
</div></b><br />
Ex:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:103px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">CMD</span><span style="color: #000000;">:</span>gotodm <span style="color: #000000;">&#40;</span> playerid , params <span style="color: #000000;">&#91;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp;DM <span style="color: #000000;">&#91;</span> playerid <span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #000000;">1</span> ; <br />&nbsp; &nbsp; &nbsp;<span style="color: #2222BB;">return</span> <span style="color: #000000;">1</span> ;<br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><font size="5"><font color="Lime">Step III:</font></font><br />
<i>Verification</i><br />
<b>In this step , i'll show you how to verify if the player is in a DM or not<br />
We must use <font color="Blue">if</font> to verify if the player is in a DM or NOT</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">if</span> <span style="color: #000000;">&#40;</span> DM <span style="color: #000000;">&#91;</span> playerid <span style="color: #000000;">&#93;</span> <span style="color: #000000;">==</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span> <span style="color: #2222BB;">return</span> SendClientMessage <span style="color: #000000;">&#40;</span> playerid , <span style="color: #000000;">-</span><span style="color: #000000;">1</span> , <span style="color: #000066;">&quot; You can't use this command in a DM &quot;</span> <span style="color: #000000;">&#41;</span> ;</div></div></pre>
</div><b>With the upper code the script will verify if the player is in a DM<br />
if DM is set to 1 he'll can't use a command , if DM is set to 0  he'll can use the command<br />
What SendClientMessage mean ?<br />
Well , SendClientMessage send a message to player who try to use a command or make a action<br />
SendClientMessage ( playerid , color , message [ ] ) ;<br />
<br />
playerid - The player who the message will be send<br />
color - the text color<br />
message - the text who will be sent to a player<br />
</b><br />
Ex:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:167px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">CMD</span><span style="color: #000000;">:</span>gotodm <span style="color: #000000;">&#40;</span> playerid , params <span style="color: #000000;">&#91;</span> <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #2222BB;">if</span> <span style="color: #000000;">&#40;</span> DM <span style="color: #000000;">&#91;</span> playerid <span style="color: #000000;">&#93;</span> <span style="color: #000000;">==</span> <span style="color: #000000;">1</span> <span style="color: #000000;">&#41;</span> <span style="color: #2222BB;">return</span> SendClientMessage <span style="color: #000000;">&#40;</span> playerid , <span style="color: #000000;">-</span><span style="color: #000000;">1</span> , <span style="color: #000066;">&quot; You can't use this command in a DM &quot;</span> <span style="color: #000000;">&#41;</span> ;<br />&nbsp; &nbsp; &nbsp;<span style="color: #2222BB;">else</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetPlayerPos <span style="color: #000000;">&#40;</span> playerid , <span style="color: #000000;">0.0</span> , <span style="color: #000000;">0.0</span> , <span style="color: #000000;">0.0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #2222BB;">return</span> <span style="color: #000000;">1</span> ;<br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div>I hope i helped you<br />
If i wrong something reply xD<br />
Sorry for my bad english<br />
</div></div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>Rimmon</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437593</guid>
		</item>
		<item>
			<title><![CDATA[[Tutorial] Beautiful, Readable Code (Indentation, Whitespace, Comments)]]></title>
			<link>http://forum.sa-mp.com/showthread.php?t=437374&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 13:02:29 GMT</pubDate>
			<description>*Beautiful, Readable Code: Version 1.* 
 
 
Audience 
 
 
It has come to my attention that poor scripting habits lurk left and right in the SA-MP...</description>
			<content:encoded><![CDATA[<div><font size="6"><div align="center"><font face="Century Gothic"><b>Beautiful, Readable Code: Version 1.</b></font></div></font><br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Audience</div></font></font><br />
<br />
It has come to my attention that poor scripting habits lurk left and right in the SA-MP community. This isn't a surprise considering the fact that most scripters are taking their first steps on these forums to produce code which offers immediate gratification. If you have ever found yourself wondering whether or not to indent, how to structure a set of statements, how to use comments effectively, or even looking up a plugin which indents for you automatically, then this tutorial is for you.<br />
<br />
Oh, and one more thing! I have gone ahead and underlined key points in each section of the tutorial. Even if for some reason you don't understand any part of a particular explanation, make sure you understand the underlined key point!<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Benefits</div></font></font><br />
<br />
Proper indentation is the groundwork for writing beautiful, readable code. Although this point may have already been stressed to you at one point or another along your journey, you should be writing your code with the intention of it being readable for someone other than yourself. Even if you never intend to show your code off or introduce someone else to it, writing readable code makes troubleshooting easier and modifications less difficult to implement. Besides, you never know when you may take a break from the project you are working on and come back a few months later. If your code isn't readable, you will find yourself frustrated and unproductive.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Indentation</div></font></font><br />
<br />
Indentation is arguably the most prominent factor in writing beautiful, readable code. Do you know how to indent properly? Let's find out.<br />
<br />
First and foremost, we need to cover the idea of &quot;nesting.&quot; <u>Nesting</u> is the use of those neat <u>braces: { }</u> to nest one statement, argument, or function within another. Let's start out with a basic example of nesting.<br />
<br />
For this example, I am using a popular command processor named ZCMD for the purpose of simplicity and application. An example of a nest is creating a command using ZCMD. Notice the comments next to the code.<br />
<br />
<b>SINGLE NEST:</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:87px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">COMMAND</span><span style="color: #000000;">:</span>heal<span style="color: #000000;">&#40;</span>playerid, params<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>playeird, <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span>;<span style="color: #228822;">// This function (SetPlayerHealth) is nested inside of the command &quot;heal.&quot;</span><br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
The nested area is the area where you place further arguments and then define what you wish the command to do. It is possible to have a nest within a nest, or several nests within a nest. Below I have placed an example of a nest within a nest. Notice the comments in the code.<br />
<br />
<b>MULTIPLE NESTS:</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:135px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #000000;">COMMAND</span><span style="color: #000000;">:</span>heal<span style="color: #000000;">&#40;</span>playerid, params<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>IsPlayerConnected<span style="color: #000000;">&#40;</span>playerid<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #228822;">// Nested within the &quot;heal&quot; command.</span><br />&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SetPlayerHealth<span style="color: #000000;">&#40;</span>playerid, <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span>; <span style="color: #228822;">// Nested within the if statement &quot;IsPlayerConnected.&quot;</span><br />&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /><span style="color: #000000;">&#125;</span></div></div></pre>
</div><br />
How does nesting apply to indentation? They are directly related! <u>The purpose of indentation is to visually represent nesting</u>. In order to indent properly, all you have to do is press that &quot;tab&quot; button (the button which introduces several spaces) every time you are placing a new nested item. If you ever ask yourself again, &quot;Do I need to indent here?&quot; just remind yourself that you ONLY indent when you are placing a nested item. If the item you are placing is NOT nested in another statement/argument, you do NOT need to indent.<br />
<br />
While you may have noticed in the past that loose indentation (improper indentation) only results in warnings, it is extremely beneficial to exercise good indentation when scripting. When you need to create multiple nests within nests, you'll find it much easier to locate the certain pieces you want to change or modify at a later date if they are indented properly.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">White Space</div></font></font><br />
<br />
White space is your friend! For some reason an obsession with line count (the amount of lines in a script) has overcome the SA-MP community. Stop making generalizations! Line count has absolutely nothing to do with how well a script has been written or how efficiently it will perform. The only reason line count has received such a negative aura is due to the fact that MOST scripts with large amounts of lines ALSO happen to be very poorly written. It is uncommon to find a large script written well, due to the fact that most large scripts are simply edits of poorly-written older scripts. If you utilize the latest plugins, includes, and stay up to date in your methods, line count is not an issue.<br />
<br />
Now that I have flipped your world upside down, let's talk about white space! The ability to separate chunks of code with <u>white space is a very powerful tool for creating excellent readability</u>. Your code does not have to be on top of itself! Make some space, allow some breathing room! A couple of lines of space in between commands, for example, can make scanning through code a much more enjoyable experience. That being said, don't go overboard. You still want to display as much code as possible on the screen at any given time. Find the right balance between white space to create separation and readability and still displaying a good amount of code on the screen.<br />
<br />
<font size="5"><font face="Century Gothic"><div align="center">Comments</div></font></font><br />
<br />
Another trend in the SA-MP community is the use of extravagant comments to create separation. While there isn't an issue with this practice, it's also not necessary. The real reason I am mentioning comments is not to encourage you to use them for separation, but to use them for what they are meant for: commenting things! Like I mentioned in the first paragraph, you should be writing your code through the eyes of someone else viewing it. This can be hard to do if you don't adjust your thinking accordingly!<br />
<br />
Comments are meant to explain SCRIPT-SPECIFIC content, not general concepts of scripting. I find that some scripters tend to go overboard with their comments and begin to rewrite pawn_lang.pdf in the process. For example, in the if statement below:<br />
<br />
<b>BAD COMMENT:</b><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">pawn Code:</div>
	<pre class="alt2" style="margin:0px; padding:6px; border: 1px solid #C2C2C2; width:800px; height:39px; overflow:auto"><div dir="ltr" style="text-align:left;"><div class="pawn" style="font-family:monospace;"><span style="color: #2222BB;">if</span><span style="color: #000000;">&#40;</span>PlayerInfo<span style="color: #000000;">&#91;</span>playerid<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>Admin<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&gt;</span> <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #228822;">// Checks if the player's admin level is greater than zero.</span></div></div></pre>
</div><br />
I do NOT need you to tell me that this checks if the player's &quot;Admin&quot; is greater than zero. I have eyes and I have cognitive abilities! Instead, <u>use comments to describe attributes of your script which an experienced scripter would not be able to recognize</u> without previous knowledge of this exact script. An example of this is the creation of a new, unique function.<br />
<br />
Just remember, you don't have to reinvent the wheel in your comments. Keep them short, simple, to the point, and most importantly only utilize them when necessary. While you may think its better to err on the side of caution, really you are just destroying your productivity.</div>

]]></content:encoded>
			<category domain="http://forum.sa-mp.com/forumdisplay.php?f=70">Tutorials</category>
			<dc:creator>RvGamers</dc:creator>
			<guid isPermaLink="true">http://forum.sa-mp.com/showthread.php?t=437374</guid>
		</item>
	</channel>
</rss>
