Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[BB] Addon: Ammo-Pack System


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 476
  • Lokalizacja:AMXX.PL
Offline

Napisano 23.02.2016 22:03

<div><b><br /><font size="8"><font color="orange">[BB] Addon: Ammo-Pack System</font></font><font color="orange"><br /></font><font size="6">Author: <font color="orange">crnova<br /></font>Version: <font color="orange">1.0</font></font><font color="orange"><br /></font></b><font color="orange"><br /><br /><br /><font size="5">Description:</font></font><br /><br />- This plugin adds in an Ammo-Pack system similar to that one of <a href="https://forums.allie...ad.php?t=72505"target="_blank">Zombie Plague Mod</a>.<br /><br /><br /><font size="5"><font color="orange">Features:</font></font><br /><br />- API Shop.<br />- Hud Info.<br />- nVault saving.<br />- Ammo-Pack rewards for both humans &amp; zombies.<br />- Ammo-Pack as price.<br /><br /><font size="5"><font color="orange">Requirements:</font></font><br /><br />- HudInfo plugin is required in order to see how much ammo pack you got! (download in this post)<br />- AMXMODX 1.8+<br />- Base Builder<br />- Modules<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 />#include &lt;hamsandwich&gt;<br />#include &lt;nvault&gt;<br />#include &lt;fakemeta&gt;</code><hr />
</div><font size="5"><font color="orange">Installation:</font></font><br /><br />- The &quot;bb_ammopacks.inc&quot; file will go in 'addonsamxmodxscriptingincludes' folder.<br />- The sma files must be compiled locally and the output .amxx file will go in 'addonsamxmodxplugins' folder.<br /><br /><br /><font size="5"><font color="orange">Api Tutorial:</font></font><br /><br />- Alright so i'm gonna show you how to make your sub-plugin for the Ammo-Pack API Shop, first thing you should is register the shop item you're about to add, now in example<br /><br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP Code:</div>
<div class="alt2">
<hr />
<code style="white-space:nowrap">
<div dir="ltr" style="text-align:left;">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;</span><span style="color: #0000BB">plugin_init</span><span style="color: #007700">()
<br />{
<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">bb_shop_item_add</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"Double&nbsp;Health"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"DoubleHealth_Handler"</span><span style="color: #007700">)
<br />}&nbsp;
<br /></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</div>
</code>
<hr />
</div>
</div>The first parameter is the name of the shop item that's gonna show up in the shop menu, the second parameter is the price for the item, and the last parameter is the item handler,<br /><br />Example for item Handler:<br /><br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP Code:</div>
<div class="alt2">
<hr />
<code style="white-space:nowrap">
<div dir="ltr" style="text-align:left;">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;</span><span style="color: #0000BB">DoubleHealth_Handler</span><span style="color: #007700">(</span><span style="color: #0000BB">id</span><span style="color: #007700">)
<br />{
<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">set_user_health</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">get_user_health</span><span style="color: #007700">(</span><span style="color: #0000BB">id</span><span style="color: #007700">)&nbsp;*&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">)
<br />}&nbsp;
<br /></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</div>
</code>
<hr />
</div>
</div>Basically what the item will do, is double the purchaser's health, in example before we bought the item, our health was 2000, after we bought the item it's 4000.<br /><br />the full sub-plugin is gonna look like this<br /><br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP Code:</div>
<div class="alt2">
<hr />
<code style="white-space:nowrap">
<div dir="ltr" style="text-align:left;">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">#include&nbsp;&lt;amxmisc&gt;&nbsp;//No&nbsp;need&nbsp;to&nbsp;include&nbsp;amxmodx,&nbsp;because&nbsp;when&nbsp;amxmisc&nbsp;is&nbsp;included,&nbsp;amxmodx&nbsp;is&nbsp;included&nbsp;too
<br />#include&nbsp;&lt;fun&gt;&nbsp;//&nbsp;the&nbsp;include&nbsp;that's&nbsp;gonna&nbsp;handle&nbsp;our&nbsp;"set_user_health"&nbsp;function
<br />
<br />//Initialize&nbsp;our&nbsp;sub-plugin
<br /></span><span style="color: #007700">public&nbsp;</span><span style="color: #0000BB">plugin_init</span><span style="color: #007700">()
<br />{
<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">bb_shop_item_add</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">"Double&nbsp;Health"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"DoubleHealth_Handler"</span><span style="color: #007700">)&nbsp;</span><span style="color: #FF8000">//Add&nbsp;our&nbsp;shop&nbsp;item
<br /></span><span style="color: #007700">}
<br />
<br /></span><span style="color: #FF8000">//Handle&nbsp;our&nbsp;shop&nbsp;item
<br /></span><span style="color: #007700">public&nbsp;</span><span style="color: #0000BB">DoubleHealth_Handler</span><span style="color: #007700">(</span><span style="color: #0000BB">id</span><span style="color: #007700">)
<br />{
<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">set_user_health</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">get_user_health</span><span style="color: #007700">(</span><span style="color: #0000BB">id</span><span style="color: #007700">)&nbsp;*&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">)&nbsp;</span><span style="color: #FF8000">//the&nbsp;function&nbsp;that's&nbsp;gonna&nbsp;double&nbsp;the&nbsp;purchaser's&nbsp;health.
<br /></span><span style="color: #007700">}&nbsp;
<br /></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</div>
</code>
<hr />
</div>
</div><br /><font size="5"><font color="orange">Cvars, Commands and Natives:</font></font><br /><br /><font size="2"><font color="blue">Cvars:</font></font><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">// Ammopack reward for the zombie that killed the human<br />// default = &quot;25&quot;<br />ap_human_killed_reward &quot;25&quot;<br /><br />// Ammopack reward for the human that killed the zombie.<br />// default = &quot;5&quot;<br />ap_zombie_killed_reward &quot;5&quot;</code><hr />
</div><font size="2"><font color="blue">Commands:</font></font><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">&quot;say /shop&quot; // Opens our shop menu<br />&quot;amx_give_ap &lt;name&gt; &lt;amount&gt;&quot; // Gives our target Ammo-pack, accessible only by immunity admins!<br />&quot;amx_remove_ap &lt;name&gt; &lt;amount&gt;&quot; //Takes ammo-pack from our target, accessible only by immunity admins!</code><hr />
</div><font size="2"><font color="blue">Natives:</font></font><br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">PHP Code:</div>
<div class="alt2">
<hr />
<code style="white-space:nowrap">
<div dir="ltr" style="text-align:left;">
<!-- php buffer start --><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">/*
<br />*&nbsp;@param&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Item&nbsp;Name
<br />*&nbsp;@param&nbsp;cost&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Item&nbsp;Cost&nbsp;
<br />*&nbsp;@param&nbsp;handler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Item&nbsp;Function&nbsp;Handler
<br />*/
<br />
<br /></span><span style="color: #0000BB">native&nbsp;bb_shop_item_add</span><span style="color: #007700">(&nbsp;const&nbsp;</span><span style="color: #0000BB">szName</span><span style="color: #007700">[],&nbsp;const&nbsp;</span><span style="color: #0000BB">iCost</span><span style="color: #007700">,&nbsp;const&nbsp;</span><span style="color: #0000BB">szHandler</span><span style="color: #007700">[])
<br />
<br /></span><span style="color: #FF8000">/*
<br />*&nbsp;@param&nbsp;index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player&nbsp;index
<br />*&nbsp;@return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns&nbsp;player&nbsp;index&nbsp;ammo&nbsp;pack
<br />*/
<br />
<br /></span><span style="color: #0000BB">native&nbsp;bb_get_user_ap</span><span style="color: #007700">(</span><span style="color: #0000BB">Index</span><span style="color: #007700">)&nbsp;
<br /></span><span style="color: #0000BB"></span>
</span>
</code><!-- php buffer end -->
</div>
</code>
<hr />
</div>
</div><br /><font size="5"><font color="orange">Changelog</font></font><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">v1.0 - Released</code><hr />
</div><br /><font size="5"><font color="orange">Credits:</font></font><br /><br />- <a href="https://forums.allie...er.php?u=33273"target="_blank">MeRcyLeZZ</a> for the idea.</div>


<br /> <div style="padding:6px">








<fieldset class="fieldset">
<legend>Attached Files</legend>
<table cellpadding="0" cellspacing="3" border="0">
<tr>
<td><img class="inlineimg" src="https://forums.allie...attach/sma.gif"alt="File Type: sma" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>

<a href="http://www.amxmodx.o...69"><strong>GetPlugin</strong></a> or
<a href="https://forums.allie...1456258649">GetSource</a> (bb_hudinfo.sma - 1.8 KB)

</td>
</tr><tr>
<td><img class="inlineimg" src="https://forums.allie...attach/sma.gif"alt="File Type: sma" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>

<a href="http://www.amxmodx.o...73"><strong>GetPlugin</strong></a> or
<a href="https://forums.allie...1456260076">GetSource</a> (bb_ammopacks.sma - 8.0 KB)

</td>
</tr><tr>
<td><img class="inlineimg" src="https://forums.allie...attach/inc.gif"alt="File Type: inc" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>


<a href="https://forums.allie...mopacks.inc</a>(1,018 Bytes)


</td>
</tr>
</table>
</fieldset>


</div>

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych