|
|
#3431 | |
|
Big Clucker
![]() ![]() Join Date: Jan 2012
Posts: 30
Reputation: 29
|
Quote:
You just changed the local money variable to a static local variable. Do you think it might be faster because memory doesn't have to be allocated every function call? --- Why not just write global variables in camel case (GlobalVariable) and local variables in lower case (local_variable or localvariable)? |
|
|
|
|
|
|
#3432 | ||
|
Banned
![]() Join Date: Jul 2010
Posts: 2,365
Reputation: 569
|
Quote:
Second of all, I didn't just "change" to static, I allocated the variable iM, to GetPlayerMoney() so we don't have to call that function every time, its not like LOTS faster... But if you use it for big codes, it can affect the performance of the server Edit: Testing Code Quote:
|
||
|
|
|
|
|
#3433 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: Sweden
Posts: 1,667
Reputation: 969
|
You forgot to test just using "new". Or maybe you did, and realized there's hardly any difference.
|
|
|
|
|
|
#3434 |
|
Banned
![]() Join Date: Jul 2010
Posts: 2,365
Reputation: 569
|
|
|
|
|
|
|
#3435 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Belgium
Posts: 4,877
Reputation: 1410
|
So, what's the point of calling OnPlayerMoneyChange through CallLocalFunction? Naturally, it'd be faster if it was called directly.
|
|
|
|
|
|
#3436 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,235
Reputation: 1900
|
Yes, but if the user doesn't have that callback the code won't even compile. By not using CallLocalFunction you FORCE the user to include that callback even if they don't want it.
|
|
|
|
|
|
#3437 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: Sweden
Posts: 1,667
Reputation: 969
|
Non-recursive quicksort - sorts an array of plain integers.
pawn Code:
|
|
|
|
|
|
#3438 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,235
Reputation: 1900
|
Now where have I seen that code before...
I'm slightly surprised you didn't keep the GPL notice from the GNU original. I've debated porting that function before but can't stand GPL! |
|
|
|
|
|
#3439 |
|
Banned
![]() Join Date: Jul 2010
Posts: 2,365
Reputation: 569
|
IsPlayerInArea and IsPlayerInArea3D pawn Code:
|
|
|
|
|
|
#3440 | |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: Sweden
Posts: 1,667
Reputation: 969
|
Quote:
The original one is actually made by you (from YSI_Misc.own), which is adapted from some WKU page (dead link). After that I looked through a number of different implementations. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Functions? | sciman001 | Help Archive | 7 | 19/03/2011 02:03 PM |
| How to get functions? | Twain32 | Help Archive | 4 | 08/10/2010 07:37 PM |
| [Include] [INC] SA:MP New Functions 0.4a DKN | ipsBruno | Lançamentos/Releases | 22 | 17/06/2010 08:38 AM |
| [Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) | Lorenc_ | Includes | 11 | 03/05/2010 09:47 PM |
| What this functions do? | harrold | Help Archive | 2 | 08/05/2009 11:30 PM |