←  [RSS] Pluginy

AMXX.pl: Support AMX Mod X i SourceMod

»

[ANY] BossEngine

Adminek AMXX.PL - zdjęcie Adminek AMXX.PL 13.06.2015

<div>An API that lets developers set custom attributes and properties on players such that ANY plugin may view them (and edit them in the case of properties). The core should also work with any game.<br /><br /><u>Basics:</u><br /><div style="margin: 5px;">
<div class="smallfont" style="margin-bottom: 2px;">
<b>Spoiler</b> <input value="Show" style="margin: 0px; padding: 0px; width: 45px; font-size: 10px;" onclick="if(this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline')
{ this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }
else
{ this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button">
</div>
<div class="alt2" style="border: 1px inset; padding: 6px;">
<div class="spoiler" style="display: none;"><br />[1]Create an 'Egg' and add attributes to it<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">Egg myegg = BossEngine_CreateEgg(&quot;egghead&quot;);<br />if (myegg != INVALID_EGG)<br />{<br />&nbsp; &nbsp; myegg.LoadConfig(&quot;egghead&quot;);<br />&nbsp; &nbsp; myegg.SetAttribute(&quot;egghead_power&quot;);<br />&nbsp; &nbsp; myegg.SetAttribute(&quot;egghead_power2&quot;, &quot;godlike&quot;);<br />&nbsp; &nbsp; myegg.ClearAttribute(&quot;egghead_power3&quot;);<br />}</code><hr />
</div>[2] Create a monster from that egg by binding it to a client<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">public void OnClientPutInGame(int client)<br />{<br />&nbsp; &nbsp; Monster chickenlord = BossEngine_CreateMonster(client, myegg);<br />&nbsp; &nbsp; return;<br />}</code><hr />
</div>[3] Do stuff<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">// in another plugin<br />public void BossEngine_MonsterCreated(Monster thing, const char[] name, int client)<br />{<br />&nbsp; &nbsp; if (thing.HasAttribute(&quot;egghead_power&quot;))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; SDKHook(client, SDKHook_GetMaxHealth, MaxHealthOver9000);<br />&nbsp; &nbsp; }<br /><br />&nbsp; &nbsp; char szData[5];<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; float scale = 0.0;<br />&nbsp; &nbsp; if (thing.GetAttribute(&quot;egghead_power2&quot;, szData, sizeof(szData)))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; scale = StringToFloat(szData);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; for (int i = 0; i &lt; scale; i++)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; // do something 10 times<br />&nbsp; &nbsp; }<br />}</code><hr />
</div></div>
</div>
</div><br /><br /><u>Other Info:</u><ul><li> When a monster is created from an egg, it inherits all its attributes in that instant. Further changes to the egg will not be reflected on the monster</li>
<li> Attributes on a monster a constant. There is no method available for editing them, only retrieving them.</li>
<li> Monster Properties are not constant. Any plugin is free to add, modify or remove properties on any monster.</li>
</ul><br /><u>TODO:</u><ul><li> Make this page fancier</li>
<li> Make it possible for configs to contain filenames of other configs (that will also get loaded)</li>
<li> Allow 'Monsters' to be bound to any entity</li>
<li> Squish any bugs (help will be much appreciated)</li>
</ul><br />For anything else, send me a PM<br />Zip contains:<ul><li> Core plugin (bossengine.smx)</li>
<li> Include (bossengine.inc)</li>
<li> Example setup (be_stunenemies.smx, be_custommodel.smx, be_example.smx)</li>
<li> Example configs</li>
</ul></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/zip.gif"alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>


<a href="https://forums.allie...e_1.0.0.zip</a>(43.9 KB)


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


</div>

Wyświetl pełny artykuł
Odpowiedz