Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Today I learned - Share your newly found knowledge!

 
  • 0 Vote(s) - 0 Average
Pawn Today I learned - Share your newly found knowledge!
kristo
Offline

Burgershot Member
Posts: 47
Threads: 10
Joined: Feb 2019
Reputation: 7
Location: Estonia
#1
2019-04-17, 02:31 PM (This post was last modified: 2019-04-17, 02:32 PM by kristo.)
Credits for the concept of this thread go to Slice.

Slice Wrote:Simple. If you learned something new related to SA-MP scripting, share it here!

Please:
  • Explain what it is you learned, don't just say you learned something. <----
  • Try keeping it concise.
  • Don't post stupid pictures or otherwise annoying, non-related stuff.
  • Don't link to or quote posts then say you learned that.


Today I learned that natives can be forwarded and this can be used to deprecate natives and add replacements for them without getting a deprecation warning inside the replacement function:

PHP Code:
forward DeprecatedNative();

stock NewFunction()
{
   return DeprecatedNative(); // no warning here
}

#pragma deprecated Use `NewFunction` instead.
native DeprecatedNative();

main()
{
   DeprecatedNative(); // (warning) function is deprecated (symbol "DeprecatedNative") Use `NewFunction` instead.
   NewFunction();
} 
Tama
Offline

Burgershot Member
Posts: 42
Threads: 8
Joined: Sep 2019
Reputation: 1
Location: India
#2
2020-08-06, 09:25 AM (This post was last modified: 2020-08-06, 09:26 AM by Tama.)
Today i learn something, using ! without manually set true\false.

Usage:
PHP Code:
main() {
    
var1 = !var1;
} 

Instead of:
PHP Code:
main() {
    
var1 = true;
    
var1 = false;
} 
आपको अपने पापों पर पश्चाताप करना चाहिए, वे आपको नष्ट कर देंगे। आप कोई मौका नहीं खड़े हो रहे हैं। तुम उसके हाथ पर मर जाओगे। पछताना


« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode