![](images/misc/post_spacer.gif) |
Member
Join Date: May 2010
Location: Serbia
|
![Old](images/statusicon/post_old.svg)
05-20-2012
, 15:56
Re: Module: Rage
|
#104
|
Quote:
Originally Posted by Arkshine
Here the module example.
Please note :
- class_creator is integrated inside the module. It creates the entity "weapon_hivehand".
- I have a lot of trouble to get this working under linux without crash, while under windows it works like a charm. Please consider a release windows-only for now.
- Don't ask me to customize the weapon, it's just an example.
- This example may lead to an global API to make weapons later, like WeaponMod, but the core as module, weapons as sub-modules, and pawn plugins to customize things.
- The source code is kind of messy because of linux.
- The weapon uses a custom v_ model because the HL weapons are designed to right and in-game you will see the weapon at left. So, a new model flipped to left is provided.
Some screenchots : #1, #2, #3
Here the pawn plugin provided to show how it's nice to be able to us directly a new entity name :
Spoiler
PHP Code:
#include <amxmodx>
#include <rage>
#include <fun>
#include <cstrike>
new MaxServerSlots;
public plugin_init()
{
register_plugin( "Hornet Gun Example", "1.0", "Arkshine" );
register_clcmd( "hive", "ClientCommand_GiveHornetGun" );
register_clcmd( "say hive", "ClientCommand_GiveHornetGun" );
MaxServerSlots = get_maxplayers();
}
public ClientCommand_GiveHornetGun( const client )
{
give_item( client, "weapon_hivehand" );
return PLUGIN_HANDLED;
}
// Added 2 forwards for fun to control the tracking and touch.
forward OnHornetTracking( const hornet, const hornetOwner, const trackedEntity );
forward OnHornetDieTouch( const hornet, const hornetOwner, const touchedEntity );
#define IsPlayer(%0) ( 1 <= %0 <= MaxServerSlots )
#define SameTeam(%0,%1) ( IsPlayer( %0 ) && cs_get_user_team( %1 ) == cs_get_user_team( %0 ) )
public OnHornetTracking( const hornet, const hornetOwner, const trackedEntity )
{
return SameTeam( trackedEntity, hornetOwner );
}
public OnHornetDieTouch( const hornet, const hornetOwner, const touchedEntity )
{
return SameTeam( touchedEntity, hornetOwner );
}
As side-note, I've added 2 forwards for fun to control to whom the hornet should track and make damage.
By default, it ignores players of a same team.
Damage by default is on 10. Sorry forgot to add something to control it. :p
To install :
1) Install Rage beta3
2) Unzip & overwrite if ask hornetgun_BIN.zip in your $moddir.
3) Restart
4) In-game, just type the command hive in console or chat.
5) Enjoy. - hornetgun_BIN.zip : contains handlers/modules/amxx binaries + plugin source.
- hornetgun_SRC.zip : contains handlers/modules source code.
|
pls arkshine make this work on linux
|
|
|
|