![]() |
|
[Pawn] Today I learned - Share your newly found knowledge! - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] Today I learned - Share your newly found knowledge! (/showthread.php?tid=325) |
Today I learned - Share your newly found knowledge! - kristo - 2019-04-17 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! 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();
}
RE: Today I learned - Share your newly found knowledge! - Tama - 2020-08-06 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;
}
|