|
|
#3281 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jan 2010
Location: Australia
Posts: 4,007
Reputation: 833
|
Revamped the version someone posted about ConvertPrice itself, it now doesn't use valstr and supports negative numbers.
pawn Code:
Warning: Can crash if using a integer over the 32 bit integer limit.. I fixed some little glitch with the logarithm... Should work fine now! |
|
|
|
|
|
#3282 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2009
Location: Belgium
Posts: 3,075
Reputation: 572
|
I remember posting this function almost two years ago, just if you're interested:
pawn Code:
pawn Code:
|
|
|
|
|
|
#3283 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jan 2010
Location: Australia
Posts: 4,007
Reputation: 833
|
Yeah, I noticed I could of optimized a few things but I'll be sure to use yours as it might be faster (from the looks of it, mines larger in code).
|
|
|
|
|
|
#3284 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2009
Location: Belgium
Posts: 3,075
Reputation: 572
|
Yeah, for example the logarithm part to calculate the length is pretty unnecessary - just use strlen as you have already converted the number into a string.
|
|
|
|
|
|
#3285 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2007
Location: Germany
Posts: 2,999
Reputation: 253
|
I have been working on a wait function lately
One version with an global stack which and another one with SetTimerEx only I just want that some people test it out since there were some problems with the second version Pastebin Usage pawn Code:
|
|
|
|
|
|
#3286 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,301
Reputation: 1909
|
Any heap usage is going to seriously mess that up, and detecting its usage will be very hard given that you need to store the entire stack*. What gets returned if you, for example, use this in "OnPlayerCommandText"?
* Actually thinking about it it might not. Edit 2: Just had a closer read through of your code, you can't do it like that. You seem to be (correct me if I'm wrong) passing the start address of the stack as an array pointer to SetTimerEx. Ignoring for the moment the fact that arrays don't work in SetTimerEx, even if they did when your "WakeEx" function gets called the stack will be reset and reused, overwriting all the things you were trying to save initially. Check y_inline which does something similar. You need to manually store the stack somewhere else or it will get changed by function calls between your wait and call, then in "WakeEx" put everything back on the stack (and probably the heap). Or just use "sleep". Edit 3: Just realised something else I didn't think of originally - how well does this work with "CallRemoteFunction"? |
|
|
|
|
|
#3287 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2010
Location: ES
Posts: 2,699
Reputation: 148
|
I wanna know if
pawn Code:
|
|
|
|
|
|
#3288 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
Tempting to make a joke about DeaKiNs and his brilliant coding skills...
Regardless, I wouldn't think so, strcmp is a native so I would imagine it's better. But I'm not really sure what the get/setproperty functions do anyway... |
|
|
|
|
|
#3289 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2008
Location: Sweden
Posts: 1,669
Reputation: 969
|
|
|
|
|
|
|
#3290 |
|
Banned
![]() Join Date: Apr 2009
Location: England
Posts: 4,013
Reputation: 701
|
Okay that's a far more descriptive reply!
I just tested it and wow that's slightly slower than strcmp... Like 10 times slower...
|
|
|
|
![]() |
| 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 |