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

[CSS] Custom Weapon Interface


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

Napisano 06.05.2013 14:03

<!-- BEGIN TEMPLATE: postbit_external -->
<div><div align="center"><font size="4"><font color="Magenta"><i><b><u>The Custom Weapon Interface</u></b></i></font></font><font size="4"><br /></font></div> <br />After a day or so of coding I've created a pretty simple, cool and amazing interface for custom weapons.<br />It allows you to change weapon viewmodels and worldmodels.<br /><br />If you're using a custom weapon model. Make sure that you add the files to the downloads table like this:<br /><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<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 OnMapStart()<br />{<br />&nbsp; &nbsp; AddFileToDownloadsTable(PATH OF FILE);<br />}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable -->Remember to include the .vtx file extension with a few files. Many people get muddled up on this.<br /><br /> dx90.vtx<br /> dx80.vtx<br /> xbox.vtx<br /> sw.vtx<br /><br /><br />Natives:<br /><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<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 />&nbsp;* @brief Registers a custom Weapon and Returns it's index.<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; String&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WeaponToReplace<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; String&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WeaponName<br />&nbsp;* @return&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;*/<br />native WX_RegisterWeapon(const String:replace[], const String:name[]);<br /><br />/**<br />&nbsp;* @brief&nbsp; &nbsp; Sets the weapons View/World Model.<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; String&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Path<br />&nbsp;* @noreturn<br />&nbsp;*/<br />native WX_SetWeaponViewModel(WeaponID, const String:path[]);<br />native WX_SetWeaponWorldModel(WeaponID, const String:path[]);<br /><br />/**<br />&nbsp;* @brief&nbsp; &nbsp; Returns Model Index.<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;* @return&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; ModelIndex<br />&nbsp;*/<br />native WX_GetWeaponViewModel(WeaponID);<br />native WX_GetWeaponWorldModel(WeaponID);<br /><br />/**<br />&nbsp;* @brief Gets Weapon Name by its ID.<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; The Ability<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;* @return&nbsp; &nbsp; &nbsp; &nbsp; String&nbsp; &nbsp; &nbsp; &nbsp; WeaponName<br />&nbsp;*/<br />native WX_GetWeaponName(Weapon, String:buffer[]);<br /><br />/**<br />&nbsp;* @brief Returns how many registered weapons there are.<br />&nbsp;*<br />&nbsp;* @return Number of registered Weapons<br />&nbsp;*/<br />native WX_RegisteredWeapons();</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable -->Forwards:<br /><br /><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<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 />&nbsp;* @brief When a custom weapon has been given to the player<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Client&nbsp; &nbsp; &nbsp; &nbsp; A Player<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;* @noreturn<br />&nbsp;*/<br />forward WXF_OnWeaponGiven(Client, WeaponID);<br /><br />/**<br />&nbsp;* @brief When a custom weapon has been removed from the player<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Client&nbsp; &nbsp; &nbsp; &nbsp; A Player<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;* @noreturn<br />&nbsp;*/<br />forward WXF_OnWeaponRemoved(Client, WeaponID);<br /><br />/**<br />&nbsp;* @brief When a custom weapon has been fired.<br />&nbsp;*<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Client&nbsp; &nbsp; &nbsp; &nbsp; A Player<br />&nbsp;* @param&nbsp; &nbsp; &nbsp; &nbsp; Integer&nbsp; &nbsp; &nbsp; &nbsp; WeaponID<br />&nbsp;*/<br />forward WXF_OnWeaponFired(Client, WeaponID);</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable -->Example Usage:<br /><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<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">#pragma semicolon 1<br /><br />#include &lt;sourcemod&gt;<br />#include &lt;cstrike&gt;<br />#include &lt;sdktools&gt;<br />#include &lt;WeaponAPI&gt;<br /><br />public Plugin:myinfo=<br />{<br />&nbsp; &nbsp; name=&quot;Weapon Interface Example&quot;,<br />&nbsp; &nbsp; author=&quot;Skydive&quot;,<br />&nbsp; &nbsp; description=&quot;Changes Many Weapons!&quot;,<br />&nbsp; &nbsp; version=&quot;1.0&quot;,<br />&nbsp; &nbsp; url=&quot;&quot;<br />};<br /><br />new WeaponUMP;<br /><br />public OnPluginStart()<br />{<br />&nbsp; &nbsp; WeaponUMP = WX_RegisterWeapon(&quot;weapon_ump45&quot;,&quot;UMP--&gt;P90 And Burn&quot;);<br />&nbsp; &nbsp; WX_SetWeaponViewModel(WeaponUMP,&quot;models/Weapons/v_smg_p90.mdl&quot;);<br />&nbsp; &nbsp; WX_SetWeaponWorldModel(WeaponUMP,&quot;models/Weapons/w_smg_p90.mdl&quot;);<br /><br />&nbsp; &nbsp; //Create Global Forwards<br />&nbsp; &nbsp; StartWeaponForwards();<br />}<br /><br /><br />public WXF_OnWeaponDamaged(Client,WeaponID,Victim)<br />{<br />&nbsp; &nbsp; //Check if the WeaponID is a UMP<br />&nbsp; &nbsp; if(WeaponID == WeaponUMP)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; //Ignite Victim<br />&nbsp; &nbsp; &nbsp; &nbsp; IgniteEntity(Victim, 6.0);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; PrintToServer(&quot;ON WEAPON DAMAGED %i&quot;,WeaponID);<br />}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable -->The WeaponInterface Plugin in the Source is Necessary for this to function.<br />Compile it and add it in your &quot;/plugins&quot; folder too.<br />Link To Code:<br /><a href="https://weaponinterf...googlecode.com/" target="_blank">https://weaponinterf...googlecode.com/</a><br />or<br /><a href="https://weaponinterf...weaponinterface" target="_blank">https://weaponinterf...nterface</a><br /><br />Use an SVN client to download them.<br /><br />Special Thanks to bacardi who posted the Weapon View Model code for me to alter.<br /><br />Please leave appropriate feedback and suggestions, I've released this early. It's lacking many features.<br /><br />This plugin is still in development. Will be updated periodically. Keep A Look Out!</div>


<!-- END TEMPLATE: postbit_external -->

Wyświetl pełny artykuł




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

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