Raised This Month: $32 Target: $400
 8% 

Creating box


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 08-28-2014 , 18:13   Creating box
Reply With Quote #1

hey everyone

I want to create a box when player is respawned on the exact position his standing, then detect if he leaves the box to trigger some other commands...
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%
AvaStIn is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-29-2014 , 07:28   Re: Creating box
Reply With Quote #2

Quote:
Originally Posted by AvaStIn View Post
hey everyone

I want to create a box when player is respawned on the exact position his standing, then detect if he leaves the box to trigger some other commands...
Not quite sure that I get what you want, but:

1. Hook CBasePlayer:: Spawn, it's a virtual function so you can hook it with hamsandwich( Ham_Spawn ).
2. Get user origin with pev_origin.
3. Create on this origin an entity, set the model that you need and some "cool" efects( that you want to set ).
4. Then, check pev_absmin and pev_absmax to see if the player is still into the box.
__________________

Last edited by HamletEagle; 08-29-2014 at 07:29.
HamletEagle is offline
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 08-29-2014 , 11:06   Re: Creating box
Reply With Quote #3

thx for helping I could make this, but I couldn't understand how to detect if player left the box... can u help me more?
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%

Last edited by AvaStIn; 08-29-2014 at 13:25.
AvaStIn is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-29-2014 , 11:14   Re: Creating box
Reply With Quote #4

Try this stock:
Code:
//iFirstIndex is the player index //iSecondIndex is the entity index stock bool:PlayerIsInEnt( iFirstIndex, iSecondIndex) {     new Float: fEntMin[ 3 ], Float: fEntMax[ 3 ]     new Float: fTargetMin[ 3 ], Float: fTargetMax[ 3 ]     new Float: v_fDistance[ 3 ]         pev( iFirstIndex, pev_absmin, fEntMin )     pev( iFirstIndex, pev_absmax, fEntMax )     pev( iSecondIndex, pev_absmin, fTargetMin )     pev( iSecondIndex, pev_absmax, fTargetMax )         for( new i; i < 3; i++ )     {         if( fEntMin[ i ] > fTargetMax[ i ] )         {             v_fDistance[ i ] = fEntMin[ i ] - fTargetMax[ i ]         }                 else if( fTargetMin[ i ] > fEntMax[ i ] )         {             v_fDistance[ i ] = fTargetMin[ i ] - fEntMax[ i ]         }     }         if( vector_length( v_fDistance ) )     {         return false     }         else     {         return true     }         return false }

This will return true if the player is in the entity, and false if not.
__________________

Last edited by HamletEagle; 08-29-2014 at 14:28.
HamletEagle is offline
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 08-29-2014 , 12:42   Re: Creating box
Reply With Quote #5

Getting some error, the function "PlayerIsInent" should return value .
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%
AvaStIn is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 08-29-2014 , 13:12   Re: Creating box
Reply With Quote #6

Add "return false" before the last bracket
RateX is offline
AvaStIn
Senior Member
Join Date: Feb 2013
Location: Algeria
Old 08-29-2014 , 13:25   Re: Creating box
Reply With Quote #7

ye thx I found that ), thx everyone xD
Edit: Ye it worked Great thx again
__________________
Project : Speedrun / Fastrun / CrazySpeed & [FPS CATEGORY]

o [
||||||||||||||||||||] - 95%

Project : Upgraded Drshop To V6.0

o [||||||||||||||||||||]- 100%

Last edited by AvaStIn; 08-29-2014 at 14:55.
AvaStIn is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-29-2014 , 14:27   Re: Creating box
Reply With Quote #8

Quote:
Originally Posted by RateX View Post
Add "return false" before the last bracket
Oops, forgot to add that. Thx.

Btw, it worked ?
__________________

Last edited by HamletEagle; 08-29-2014 at 14:29.
HamletEagle is offline
Reply


Thread Tools
Display Modes

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 19:21.


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