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

[CS:GO] GiveNamedItem Hook


  • 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 489
  • Lokalizacja:AMXX.PL
Offline

Napisano 14.06.2015 05:13

<div><font size="4">This plugin parses a forward to other plugins which allows them to edit weapon classnames and paintkits before they spawn.</font><br /><br />This was made to resolve issues where knife and paintkit plugins cause crashes on certain server types.<br /><br />Note: This plugin on it's own doesn't do anything. It requires another plugin to actually edit the hook properties.<br /><br /><font size="5">It's made for Dummies and is really simple to use.</font><br /><br /><font size="4"><font color="Red">Requires: <a href="https://forums.allie...d.php?t=180114"target="_blank">The latest DHooks</a> - Make sure you have the latest version</font></font><br /><br />Below is the example plugin:<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">#include &lt;givenameditem&gt;<br /><br />public OnGiveNamedItemEx(int client, const char[] classname)<br />{<br />&nbsp; &nbsp; // Change all knives to butterfly knives and let player keep their orginal skinned knife<br />&nbsp; &nbsp; if (StrEqual(classname, &quot;weapon_knife&quot;) || StrEqual(classname, &quot;weapon_knife_t&quot;))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; PrintToConsole(client, &quot;--==&gt; OnGiveNamedItemEx(client=%d, classname=%s)&quot;, client, classname);<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Paintkit = PAINTKIT_PLAYERS;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Seed = 100;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Wear = 0.0001;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Kills = -1;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.ItemDefinition = 515;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.SetClassname(&quot;weapon_knife_butterfly&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.EntityQuality = 3;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; // Change all M4A4's to vanilla stattrak M4A1-S's<br />&nbsp; &nbsp; else if (StrEqual(classname, &quot;weapon_m4a1&quot;))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; PrintToConsole(client, &quot;--==&gt; OnGiveNamedItemEx(client=%d, classname=%s)&quot;, client, classname);<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Paintkit = PAINTKIT_VANILLA;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Seed = 100;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Wear = 0.0001;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.Kills = 666;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.ItemDefinition = 60;<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.SetClassname(&quot;weapon_m4a1_silencer&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; GiveNamedItemEx.EntityQuality = -1;<br />&nbsp; &nbsp; }<br />}</code><hr />
</div>As you can see, you just include the givenameditem include file and your ready to go. The include uses a methodmap that is linked to natives to do the work so it feels like true OOP. There is no need to return any values as the hook itself will detect and process any hook properties you update.<br /><br /><font size="4">Special thanks</font><br />Drifter, Dr. API and all the feedback contributors in <a href="https://forums.allie...d.php?t=263832"target="_blank">this thread</a>.<br /><br />This was specially built for people like: Franc1sco, Klexen and Dr. API</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...tem-100.zip</a>(19.2 KB)


</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