Thread: [ANY] Gifts!
View Single Post
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 04-25-2022 , 18:51   Re: [ANY] Gifts!
Reply With Quote #37

Modified the plugin for my private needs, but here it is.
Includes some changes and fixes:

Version 3.1 by azalty (from 2.3 by Zephyrus):

- added a collision fix: prop_dynamic_override is now used instead of prop_physics_override, and collisions are now manually set. You can now set the collision box (square) in the config file.
Quote:
// Size of the gift collision box in hammer/csgo units.
// -
// Default: "20"
sm_gifts_size "20"
20 means a box of 20x20 units

- added the default gift model for csgo (same as css)

- fixed a bug with the saving of the gift's position

- fixed gifts being duplicated (can't remember the details to be honest)

- added a forward: Gifts_OnClientGrabGift which passes the client and the entity indexes and allows you to block the event (the client won't be able to grab the gift if you return Plugin_Handled)
Quote:
/**
* Called when a client tries to grab a gift.
*
* @param client The client index.
* @param entity The gift entity index.
* @return Return Plugin_Handled to block the grabbing & Plugin_Continue to let the client grab.
* If any plugin returns Plugin_Handled, the client won't be able to grab.
*/
forward Action Gifts_OnClientGrabGift(int client, int entity);

These fixes won't be useful to everyone, I know, but since there is a small chance that someone might need this, I'll post the plugin.

Plugin compiled with SM 1.7 (I think) - it doesn't compile on SM 1.10 but will work fine on a SM 1.10 and + server
Attached Files
File Type: sp Get Plugin or Get Source (gifts.sp - 99 views - 13.6 KB)
File Type: smx gifts.smx (34.7 KB, 109 views)
File Type: inc gifts.inc (1.5 KB, 65 views)
__________________
GitHub | Discord: @azalty | Steam
azalty is offline