Raised This Month: $ Target: $400
 0% 

Useful Stocks/Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-29-2022 , 16:23   Useful Stocks/Functions
Reply With Quote #1

Hello community i made this topic to gather around all the useful stocks and function that had been created/written by the community, feel free to post/create any useful global functions/stocks that can help us coders with creating plugins and shorten our coding time : 3




~ LIST ~

Seperate_Digital_Categories

ExterminateFolderContent

GetTopPlayers

entity_explosion_knockback

find_location_around_origin
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 05-17-2022 at 09:19.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-29-2022 , 16:24   Re: Useful Stocks/Functions
Reply With Quote #2

Reserved!
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-29-2022 , 17:04   Re: Useful Stocks/Functions
Reply With Quote #3

I don't think that this is all that helpful. It's an entirely too vauge grouping and will just get lost.

"Seperate_Digital_Categories", what in the world does that mean?

Exterminate"? I don't think that that word has any usefulness in the context of programming. The concept of deleting or removing something based on "before or after a certain date" is known as pruning IIRC. Also, the default values that you've assigned to this function make it do absolutely nothing which doesn't make any sense. If a default value doesn't actually do anything then it shouldn't exist.

I don't think that low-level stocks should be writing anything to any files, calling process should be the one to do that.
__________________

Last edited by fysiks; 01-29-2022 at 17:06.
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-29-2022 , 17:17   Re: Useful Stocks/Functions
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
I don't think that this is all that helpful. It's an entirely too vauge grouping and will just get lost.
I have to disagree with you, i think this thread would be very helpful and will make stuff much easier among programming plugins, because you don't have to rethink the whole logarithm and consume time for something already been done.

Quote:
Originally Posted by fysiks View Post
"Seperate_Digital_Categories", what in the world does that mean?
its a simple function divides/separates 3 numbers in a string into a single digital houses. ex: "1000000" will be "1 000 000"

Quote:
Originally Posted by fysiks View Post
Exterminate"? I don't think that that word has any usefulness in the context of programming. The concept of deleting or removing something based on "before or after a certain date" is known as pruning IIRC. Also, the default values that you've assigned to this function make it do absolutely nothing which doesn't make any sense. If a default value doesn't actually do anything then it shouldn't exist.
You are correct i just copied that from an old thread, feel free to improve it.

Quote:
Originally Posted by fysiks View Post
I don't think that low-level stocks should be writing anything to any files, calling process should be the one to do that.
IN addition this topic is going to be extreme helpful for new beginners.
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-29-2022 at 17:39.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-29-2022 , 20:21   Re: Useful Stocks/Functions
Reply With Quote #5

Perhaps you should provide documentation about what you think your functions do so people don't have to guess based on the confusing function names.

Quote:
Originally Posted by Natsheh View Post
its a simple function divides/separates 3 numbers in a string into a single digital houses. ex: "1000000" will be "1 000 000"
The one posted here that was created by Bugsy is much better for reusable code. The delimiter to be used can easily be added as the fourth parameter with a default value of ','.

Quote:
Originally Posted by Natsheh View Post
You are correct i just copied that from an old thread, feel free to improve it.
I'm unable to edit your post.


Quote:
Originally Posted by Natsheh View Post
IN addition this topic is going to be extreme helpful for new beginners.
That is debatable. If you teach poor or confusing code, they'll learn those same bad habits. But I guess that's the nature of the internet, both good and bad exist.
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-30-2022 , 06:19   Re: Useful Stocks/Functions
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Perhaps you should provide documentation about what you think your functions do so people don't have to guess based on the confusing function names.
I highly agree with you, i will find a free time to work on the documentation.
Quote:
Originally Posted by fysiks View Post
The one posted here that was created by Bugsy is much better for reusable code. The delimiter to be used can easily be added as the fourth parameter with a default value of ','.
The difference between my function and bugsy function that bugsy function deals with integers while my code deal with strings, and it can be useful to dig out my numbers out of characters.

Quote:
Originally Posted by fysiks View Post
I'm unable to edit your post.
You can notify me with a post, and I'll edit the first post after all this thread was meant for everyone to contribute.
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-30-2022 at 06:19.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-30-2022 , 17:06   Re: Useful Stocks/Functions
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
The difference between my function and bugsy function that bugsy function deals with integers while my code deal with strings, and it can be useful to dig out my numbers out of characters.
That doesn't make any sense. Where would that even be used?
__________________

Last edited by fysiks; 01-30-2022 at 17:09.
fysiks is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-02-2022 , 16:52   Re: Useful Stocks/Functions
Reply With Quote #8

randomOriginAroundEntity
Spoiler
get_time_played
Spoiler
Get wall thickness from Arkshine
Spoiler
formatLowNumber:
Spoiler
moveEntityTowardsAnotherEntity // throw an entity towards another
Spoiler
Radius Damage by Exolent
Spoiler
__________________

Last edited by EFFx; 02-03-2022 at 10:44.
EFFx is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: United States
Old 02-02-2022 , 19:50   Re: Useful Stocks/Functions
Reply With Quote #9

@EFFx on formatLowNumber can't you use floatround and then strip the zeros left?
bigdaddy424 is offline
Old 02-02-2022, 22:24
fysiks
This message has been deleted by fysiks. Reason: nvm
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-03-2022 , 09:13   Re: Useful Stocks/Functions
Reply With Quote #10

Quote:
Originally Posted by bigdaddy424 View Post
@EFFx on formatLowNumber can't you use floatround and then strip the zeros left?
To be honest I didn't try. The original stock was checking whole string message and if inside it contains a low float number, it converts... like

"Something happened blabla 0.01 seconds or time"

The stock takes everything besides the low float number and converts it. Instead of just adding %0.2f and having 0.10 when the value is 0.1, it prints 0.1 instead. The older version also finds players name inside the message, to avoid having a low float number inside the players name and thinking it's the actual low number. If you add as example %0.5f and have a number 0.00100, it'll print 0.001 only.

Not sure if with floatround it'll do 100x faster than that stock, but I've found this a long time ago and used so many times.
__________________

Last edited by EFFx; 02-03-2022 at 09:15.
EFFx 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 03:43.


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