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

What is the difference?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-23-2022 , 16:57   What is the difference?
Reply With Quote #1

Hello, what is the difference between using these?
PHP Code:
#define BlockLocker(%1)       ( entity_get_int( %1, EV_INT_iuser1 ) )
stock BlockLocker(ent)        return peventpev_iuser1 
They both do the same thing

Last edited by amirwolf; 01-23-2022 at 16:57.
amirwolf is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-23-2022 , 19:17   Re: What is the difference?
Reply With Quote #2

Well, one uses engine and the other uses fakemeta. Regarding how they are defined, you should read up on preprocessor directives, specifically macros (this being how the first one is defined). In short, the defined keyword is replaced with its definition, as if it were copy pasted, prior to compilation. The second one is just a function.
__________________

Last edited by fysiks; 01-23-2022 at 19:21.
fysiks is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-23-2022 , 19:23   Re: What is the difference?
Reply With Quote #3

Which one performs better?
What is the difference between using an engine and a fakemeta?
amirwolf is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-23-2022 , 19:30   Re: What is the difference?
Reply With Quote #4

There are many discussions about engine vs fakemeta. Generally, is that if it works, use it. Fewer native calls is usually faster so using a method that calls fewer natives than another method is faster. A lot of this depends on your specific use case.

Regarding the proprocessor macro vs function, it depends on the specific use case. In this case you're adding the overhead of calling a function. This will be negligible in most use cases.

P.S. if you're going to ask Scripting Help questions, please post in the Scripting Help section of the forum.
__________________

Last edited by fysiks; 01-23-2022 at 20:16. Reason: typo
fysiks is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-23-2022 , 19:39   Re: What is the difference?
Reply With Quote #5

Thank you for your answer
amirwolf is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-23-2022 , 23:22   Re: What is the difference?
Reply With Quote #6

1st. Youre just calling a native.

2nd. Youre calling a function that function calling a native and returing its value.

So which one do you think is more faster?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-23-2022 at 23:23.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:51.


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