small tweaks ..

This commit is contained in:
Lukasz Wlasinksi 2004-06-25 01:00:29 +00:00
parent 45a3493256
commit a9c5228c31
6 changed files with 108 additions and 114 deletions

View File

@ -25,7 +25,6 @@
#define ACT_NADE_NONE 0
#define ACT_NADE_SHOT 1<<0
#define ACT_NADE_PUT 1<<1
#define ACT_NADE_THROW 1<<2
#define PD_AMMO_SHELLS 53 + LINUXOFFSET
#define PD_AMMO_BULLETS 55 + LINUXOFFSET

View File

@ -362,100 +362,6 @@ static cell AMX_NATIVE_CALL TFC_SetPDdata(AMX *amx, cell *params) {
}
static cell AMX_NATIVE_CALL TFC_register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0
int i;
bool bFree = false;
for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;i<TFCMAX_WEAPONS;i++){
if ( !weaponData[i].ammoSlot ){
bFree = true;
break;
}
}
if ( !bFree )
return 0;
int iLen;
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
strcpy(weaponData[i].name,szName);
weaponData[i].ammoSlot = true;
weaponData[i].melee = params[2] ? true:false;
return i;
}
static cell AMX_NATIVE_CALL TFC_cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
int weapon = params[1];
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ // only for custom weapons
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int att = params[2];
if (att<1||att>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int vic = params[3];
if (vic<1||vic>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int dmg = params[4];
if ( dmg<1 ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int aim = params[5];
if ( aim < 0 || aim > 7 ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
pVic->pEdict->v.dmg_inflictor = NULL;
pAtt->saveHit( pVic , weapon , dmg, aim );
if ( !pAtt ) pAtt = pVic;
int TA = 0;
if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) )
TA = 1;
MF_ExecuteForward ( iFDamage, pAtt->index, pVic->index, dmg, weapon, aim, TA );
if ( pVic->IsAlive() )
return 1;
pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);
MF_ExecuteForward ( iFDeath, pAtt->index, pVic->index, weapon, aim, TA );
return 1;
}
static cell AMX_NATIVE_CALL TFC_cwpn_shot(AMX *amx, cell *params){ // player,wid
int index = params[1];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int weapon = params[2];
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
pPlayer->saveShot(weapon);
return 1;
}
static cell AMX_NATIVE_CALL TFC_IsMelee(AMX *amx, cell *params){ // player,wid
int weapon = params[1];
if ( weapon < 1 || weapon >= TFCMAX_WEAPONS ){
@ -490,11 +396,6 @@ AMX_NATIVE_INFO base_Natives[] = {
{"TFC_IsMelee", TFC_IsMelee},
{"TFC_UserKill" , TFC_UserKill},
// Custom Weapon Support
{ "TFC_reg_custom_wpn", TFC_register_cwpn },
{ "TFC_custom_wpn_dmg", TFC_cwpn_dmg },
{ "TFC_custom_wpn_shot", TFC_cwpn_shot },
{"TFC_SetPDdata", TFC_SetPDdata },
//******************* 19 :)
{NULL, NULL}

View File

@ -256,6 +256,100 @@ static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params)
return g_rank.getRankNum();
}
static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0
int i;
bool bFree = false;
for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;i<TFCMAX_WEAPONS;i++){
if ( !weaponData[i].ammoSlot ){
bFree = true;
break;
}
}
if ( !bFree )
return 0;
int iLen;
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
strcpy(weaponData[i].name,szName);
weaponData[i].ammoSlot = true;
weaponData[i].melee = params[2] ? true:false;
return i;
}
static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
int weapon = params[1];
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ // only for custom weapons
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int att = params[2];
if (att<1||att>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int vic = params[3];
if (vic<1||vic>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int dmg = params[4];
if ( dmg<1 ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int aim = params[5];
if ( aim < 0 || aim > 7 ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
pVic->pEdict->v.dmg_inflictor = NULL;
pAtt->saveHit( pVic , weapon , dmg, aim );
if ( !pAtt ) pAtt = pVic;
int TA = 0;
if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) )
TA = 1;
MF_ExecuteForward ( iFDamage, pAtt->index, pVic->index, dmg, weapon, aim, TA );
if ( pVic->IsAlive() )
return 1;
pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);
MF_ExecuteForward ( iFDeath, pAtt->index, pVic->index, weapon, aim, TA );
return 1;
}
static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid
int index = params[1];
if (index<1||index>gpGlobals->maxClients){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
int weapon = params[2];
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
pPlayer->saveShot(weapon);
return 1;
}
AMX_NATIVE_INFO stats_Natives[] = {
{ "get_stats", get_stats},
{ "get_statsnum", get_statsnum},
@ -267,6 +361,12 @@ AMX_NATIVE_INFO stats_Natives[] = {
{ "get_user_wrstats", get_user_wrstats}, // DEC-Weapon(Round) Stats
{ "get_user_wstats", get_user_wstats},
{ "reset_user_wstats", reset_user_wstats },
// Custom Weapon Support
{ "reg_custom_wpn", register_cwpn },
{ "custom_wpn_dmg", cwpn_dmg },
{ "custom_wpn_shot", cwpn_shot },
{ NULL, NULL }
};

View File

@ -35,16 +35,16 @@
traceVault traceData[] = {
{ "tf_gl_grenade", TFC_WPN_GL, ACT_NADE_PUT, 2.0 },
{ "tf_gl_pipebomb", TFC_WPN_PL, ACT_NADE_PUT, 2.0 },
{ "tf_weapon_normalgrenade", TFC_WPN_NORMALGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
{ "tf_weapon_nailgrenade", TFC_WPN_NAILGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
{ "tf_weapon_mirvgrenade", TFC_WPN_MIRVGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
{ "tf_weapon_napalmgrenade", TFC_WPN_NAPALMGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
{ "tf_weapon_gasgrenade", TFC_WPN_GASGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
{ "tf_weapon_empgrenade", TFC_WPN_EMPGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
{ "tf_weapon_normalgrenade", TFC_WPN_NORMALGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 },
{ "tf_weapon_nailgrenade", TFC_WPN_NAILGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 },
{ "tf_weapon_mirvgrenade", TFC_WPN_MIRVGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT, 2.0 },
{ "tf_weapon_napalmgrenade", TFC_WPN_NAPALMGRENADE, ACT_NADE_SHOT, 0.0 },
{ "tf_weapon_gasgrenade", TFC_WPN_GASGRENADE, ACT_NADE_SHOT, 0.0 },
{ "tf_weapon_empgrenade", TFC_WPN_EMPGRENADE, ACT_NADE_SHOT, 0.0 },
{ "tf_weapon_mirvbomblet", TFC_WPN_MIRVGRENADE,ACT_NADE_PUT, 2.0 },
{ "tf_rpg_rocket", TFC_WPN_RPG,ACT_NADE_PUT, 2.0 },
{ "caltrop", TFC_WPN_CALTROP, ACT_NADE_SHOT|ACT_NADE_THROW,0.0 },
{ "tf_weapon_concussiongrenade", TFC_WPN_CONCUSSIONGRENADE, ACT_NADE_THROW, 0.0 },
{ "caltrop", TFC_WPN_CALTROP, ACT_NADE_SHOT,0.0 },
{ "tf_weapon_concussiongrenade", TFC_WPN_CONCUSSIONGRENADE, ACT_NADE_NONE, 0.0 },
// { "timer", TFC_WPN_TIMER,ACT_NADE_NONE, 2.0 },

View File

@ -57,7 +57,6 @@ int mPlayerIndex;
int iFDamage;
int iFDeath;
int iFGrenade;
RankSystem g_rank;
Grenades g_grenades;
@ -295,9 +294,6 @@ void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *
if ( traceData[i].iAction & ACT_NADE_PUT ){
g_grenades.put(e,traceData[i].fDel,traceData[i].iId,GET_PLAYER_POINTER(e->v.owner));
}
if ( traceData[i].iAction & ACT_NADE_THROW ){
MF_ExecuteForward ( iFGrenade, pPlayer->index,ENTINDEX(e),traceData[i].iId );
}
break;
}
}
@ -359,5 +355,4 @@ void FN_AMXX_Detach() {
void FN_AMXX_PLUGINSLOADED(){
iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
}

View File

@ -83,7 +83,6 @@ extern int mState;
extern int iFDamage;
extern int iFDeath;
extern int iFGrenade;
//extern int gmsgCurWeapon;
//extern int gmsgDamage;