Raised This Month: $51 Target: $400
 12% 

TripMine small change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PredatorBlock
AlliedModders Donor
Join Date: Apr 2020
Old 11-07-2020 , 17:39   TripMine small change
Reply With Quote #1

Hello,

Can someone help me to not allow plant lasermine over other players!.

Code:
public bool: CanPlant( iPlayer ) {     static Float: flOrigin[ 3 ];     entity_get_vector( iPlayer, EV_VEC_origin, flOrigin );         static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];     velocity_by_aim( iPlayer, 64, flTraceDirection );     flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];     flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];     flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];         static Float: flFraction, iTr;     iTr = 0;     engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr );     get_tr2( iTr, TR_vecEndPos, flTraceResult );     get_tr2( iTr, TR_vecPlaneNormal, flNormal );     get_tr2( iTr, TR_flFraction, flFraction );         if( flFraction >= 1.0 ) {         zp_colored_print( iPlayer, 1, " You must plant the Tripmine on a Wall" );                 return false;     }         return true; }

Last edited by PredatorBlock; 11-07-2020 at 17:40.
PredatorBlock is offline
PredatorBlock
AlliedModders Donor
Join Date: Apr 2020
Old 11-15-2020 , 18:56   Re: TripMine small change
Reply With Quote #2

Found it.

Thanks anyway.

Code:
#define _IsPlayer(%1) (1<=%1<=g_max_players) new g_max_players public plugin_init() {     g_max_players = get_maxplayers() } public bool: CanPlant( iPlayer ) {     static Float: flOrigin[ 3 ];     entity_get_vector( iPlayer, EV_VEC_origin, flOrigin);         static Float: flTraceDirection[ 3 ], Float: flTraceEnd[ 3 ], Float: flTraceResult[ 3 ], Float: flNormal[ 3 ];     velocity_by_aim( iPlayer, 64, flTraceDirection);     flTraceEnd[ 0 ] = flTraceDirection[ 0 ] + flOrigin[ 0 ];     flTraceEnd[ 1 ] = flTraceDirection[ 1 ] + flOrigin[ 1 ];     flTraceEnd[ 2 ] = flTraceDirection[ 2 ] + flOrigin[ 2 ];         static Float: flFraction, iTr;     iTr = 0;     engfunc( EngFunc_TraceLine, flOrigin, flTraceEnd, 0, iPlayer, iTr);     get_tr2( iTr, TR_vecEndPos, flTraceResult);     get_tr2( iTr, TR_vecPlaneNormal, flNormal);     get_tr2( iTr, TR_flFraction, flFraction);         static target, body;     get_user_aiming(iPlayer, target, body)     if( flFraction >= 1.0 || _IsPlayer(target)) {         zp_colored_print(iPlayer, 0, "** %L You must plant the TripMine on a Wall **", iPlayer, "MINE_WALL")                 return false;     }         return true; }

Last edited by PredatorBlock; 11-15-2020 at 18:57.
PredatorBlock is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-16-2020 , 07:03   Re: TripMine small change
Reply With Quote #3

Code:
_IsPlayer(get_tr2( iTr, TR_pHit)) && get_tr2( iTr, TR_pHit) != 0

use the trace outputs
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-16-2020 at 07:05.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode