SA-MP Forums Archive
Today I learned - Share your newly found knowledge! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Today I learned - Share your newly found knowledge! (/showthread.php?tid=359953)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18


Re: Today I learned - Share your newly found knowledge! - Kaperstone - 22.07.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
Just ****** what the maximum safe voltage for everyday use is for that CPU and keep below that. I've been running my i5-6600K at 4.6 Ghz (up from 3.5 Ghz) at 1.325V for many months now without any issues whatsoever, absolutely stable. The maximum safe voltage for this particular CPU is 1.4V I believe.
I wouldn't recommend it for cpu's that aren't unlocked.
I have i7 4770 (not the K version) and whenever I overclock it, at some point during the day Win' freezed.
Then it had some strange "fading away" effect that Win' kept freezing the next days or two (after I stopped overclocking) and then it turned back normal.


Re: Today I learned - Share your newly found knowledge! - Hansrutger - 22.07.2017

A friend of mine who helped me with overclocking asked me whether my CPU had that K-label or not and just told me to not do anything about the CPU since it didn't have one. I can't touch anything to do with the CPU in MSI Afterburner anyways but I'm sure there's workarounds like Kaperstone mentioned with his case.

Ї\_(ツ)_/Ї


Re: Today I learned - Share your newly found knowledge! - Dignity - 23.07.2017

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
A friend of mine who helped me with overclocking asked me whether my CPU had that K-label or not and just told me to not do anything about the CPU since it didn't have one. I can't touch anything to do with the CPU in MSI Afterburner anyways but I'm sure there's workarounds like Kaperstone mentioned with his case.

Ї\_(ツ)_/Ї
You're right - just because your CPU doesn't have a "k" in it's name doesn't mean it's not overclockable.

The "k" chips are made with overclocking in mind, whereas the non-k chips aren't (theyre meant to run at factory freqs). There are a lot of steps you can perform for safely overclocking a non-k chip, as long as you don't exceed max voltage your only worry should be heat. Doing a delid and or investing in a AIO cooler will do wonders. Reading up past user experiences helps a whole lot too - chances are someone probably tried overclocking it before, like Vince stated.

You should also only OC in the motherboard, not using a software. The motherboard is a safer environment than a third party program, you will probably see your clocks behave very differently if you boot into it through the motherboard instead of applying it through the program.

Also that monitor resolution issue happens frequently for people with dual monitor setups. I'm not too sure why myself but I imagine GeForce Experience frequently uploads/stores presets when updating drivers, even if you don't press optimize.


Re: Today I learned - Share your newly found knowledge! - Vince - 12.08.2017

Quote:
Originally Posted by Misiur
Посмотреть сообщение
ISmokezU: You don't have to repeat your arguments, just use VALUES(column). So, it would be:
pawn Код:
mysql_format(MYSQL, query, sizeof(query)
        ,"INSERT INTO jail (ID, Name, Time, Bail, Cell, Reason) VALUES (%d, '%e', %d, %d, %d, '%s') ON DUPLICATE KEY UPDATE Time = VALUES(Time), Bail = VALUES(Bail), Cell = VALUES(Cell), Reason = VALUES(Reason)"
        , Player[playerid][ID], GetName(playerid), time, bail, GetPlayerVirtualWorld(playerid), reason);
    mysql_tquery(MYSQL, query, "", "");
TIL.


Re: Today I learned - Share your newly found knowledge! - Y_Less - 06.09.2017

https://sampforum.blast.hk/showthread.php?tid=640660

TIL you don't actually need a space between a number and the next symbol token. It somewhat makes sense since symbols can't start with numerals, I just never tried skipping the space entirely. There is also rarely a case other than macros when symbols can actually legitimately follow numbers without any operator in between.

I did some tests, and these all work amazingly:

PHP код:
#include <a_samp>
#define eXX
#define _XX
#define xXX
#define bXX
main()
{
    
printf("",
        
0eXX,
        
0bXX,
        
0xXX,
        
0_XX);

More worryingly, guess the output:

PHP код:
#include <a_samp>
#define xFF
main()
{
    new 
0xFF;
    
printf("a = %d"a);

If pawn had octal this would be even more fun:

PHP код:
#include <a_samp>
#define xFF 255
main()
{
    new 
0xFF;
    
printf("a = %d"a);

But it doesn't...


Re: Today I learned - Share your newly found knowledge! - JasonRiggs - 06.09.2017

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=640660

TIL you don't actually need a space between a number and the next symbol token. It somewhat makes sense since symbols can't start with numerals, I just never tried skipping the space entirely. There is also rarely a case other than macros when symbols can actually legitimately follow numbers without any operator in between.

I did some tests, and these all work amazingly:

PHP код:
#include <a_samp>
#define eXX
#define _XX
#define xXX
#define bXX
main()
{
    
printf("",
        
0eXX,
        
0bXX,
        
0xXX,
        
0_XX);

More worryingly, guess the output:

PHP код:
#include <a_samp>
#define xFF
main()
{
    new 
0xFF;
    
printf("a = %d"a);

If pawn had octal this would be even more fun:

PHP код:
#include <a_samp>
#define xFF 255
main()
{
    new 
0xFF;
    
printf("a = %d"a);

But it doesn't...


That what happens to me when i read a Y Less post...


Re: Today I learned - Share your newly found knowledge! - Y_Less - 06.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение


That what happens to me when i read a Y Less post...
OK... Do you have anything to say about the content itself? That would be far more useful TBH.


Re: Today I learned - Share your newly found knowledge! - JasonRiggs - 06.09.2017

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
OK... Do you have anything to say about the content itself? That would be far more useful TBH.
The content itself is helpful but the method of explanation needs like ages to be understood by the new people in scripting.. just like Eminem in RapGod song takes time to understand what's he saying for natives and other people..


Re: Today I learned - Share your newly found knowledge! - Y_Less - 06.09.2017

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
The content itself is helpful but the method of explanation needs like ages to be understood by the new people in scripting.. just like Eminem in RapGod song takes time to understand what's he saying for natives and other people..
The discussion forum isn't really designed for new scripters. Scripting Help is for learning, Discussion is for more advanced topics and sharing advanced knowledge. I doubt there's any need for a new scripter to need that knowledge (since they never had it before and scripts never suffered), I don't even think there's a need for advanced scripters either, it's just interesting (and borderline bug: https://github.com/Zeex/pawn/issues/183)


Re: Today I learned - Share your newly found knowledge! - Jeroen52 - 06.09.2017

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
The discussion forum isn't really designed for new scripters. Scripting Help is for learning, Discussion is for more advanced topics and sharing advanced knowledge. I doubt there's any need for a new scripter to need that knowledge (since they never had it before and scripts never suffered), I don't even think there's a need for advanced scripters either, it's just interesting (and borderline bug: https://github.com/Zeex/pawn/issues/183)
It may be a borderline bug, but it could be useful in a form of a macro.


Re: Today I learned - Share your newly found knowledge! - Paulice - 15.09.2017

PHP код:
#undef tabsize
#pragma tabsize 0 
Hack right back at you! (tested)

-----

What is "%00%0\10;%0" for?

PHP код:
#define tabsize _DUMMY_do_not_use_tabsize_0 
works just as fine for me (Russian compiler)


Re: Today I learned - Share your newly found knowledge! - Y_Less - 15.09.2017

Quote:
Originally Posted by Dayvison_
Посмотреть сообщение
What happens with the pre-compiler, why the first seven characters are ignored? why this not give a warning unknown #pragma. you confused me
No clue - you aren't really meant to redefine pragmas, so I think the compiler is getting confused, processing the word "tabsize" (hence advancing the pointer 7 characters), then doing the replacement, then thinking there's a new symbol starting from that point on.

Quote:
Originally Posted by Paulice
Посмотреть сообщение
PHP код:
#undef tabsize
#pragma tabsize 0 
Hack right back at you! (tested)

-----
Well obviously. But I doubt anyone with the knowledge to do that will be using "tabsize 0" in the first place.

Quote:
Originally Posted by Paulice
Посмотреть сообщение
What is "%00%0\10;%0" for?

PHP код:
#define tabsize _DUMMY_do_not_use_tabsize_0 
works just as fine for me (Russian compiler)
Yes, but that will break ANY "tabsize" use, even good ones like "tabsize 4". The extra code checks that there is a "0" between the end of "tabsize" and the end of the line ("\10;"). So strictly speaking this will also ban "#pragma tabsize 10", but in many years I've never seen indentations other than 0, 1, 2, 3, 4, and 8 (and that's including all languages, not just pawn), so I think we're good.

Given that, you can also bypass it with:

PHP код:
#define ZERO 0
#pragma tabsize ZERO 



Re: Today I learned - Share your newly found knowledge! - Misiur - 26.09.2017

Maybe not really learned as I knew about named parameters, but finally used for something useful:
pawn Код:
#include <a_samp>

main() {}

public OnGameModeInit() {
    new a, b, c;

    Test(.foo = a, .biz = c);
    printf("%d %d %d", a, b, c); // 15 0 45
}

Test(&foo = 0, &bar = 0, &biz = 2)
{
    foo = 15;
    bar = 25;
    biz = 45;
}



Re: Today I learned - Share your newly found knowledge! - jlalt - 26.09.2017

Today learnt how to get the distance between two points ;-;, with / without Z.



which would use
https://sampwiki.blast.hk/wroot/index.php?title=Floatsqroot
and
https://sampwiki.blast.hk/wiki/Floatpower


Re: Today I learned - Share your newly found knowledge! - BiosMarcel - 26.09.2017

Today i learnt to not spam GitHub with queries, they will block ya IP


Re: Today I learned - Share your newly found knowledge! - Jeroen52 - 26.09.2017

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Today i learnt to not spam GitHub with queries, they will block ya IP
Oh shit, what did you do?


Re: Today I learned - Share your newly found knowledge! - J0sh... - 26.09.2017

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
Oh shit, what did you do?
Testing his auto update addition to his launcher


Re: Today I learned - Share your newly found knowledge! - Y_Less - 26.09.2017

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Today learnt how to get the distance between two points ;-;, with / without Z.



which would use
https://sampwiki.blast.hk/wroot/index.php?title=Floatsqroot
and
https://sampwiki.blast.hk/wiki/Floatpower
99% of the time you don't need floatsqroot. Yes, if you want the exact distance you need it, but most people just want to know if something is in range of something else. To check the range you do "if (distance < range)". However, getting the distance requires a square root. Instead, you can square the distance and square the range: "if (distance * distance < range * range)". Since a square root followed by a square is equivalent to nothing, this is the much faster: "if (partial_distance_calculation < range * range)".


Re: Today I learned - Share your newly found knowledge! - OGMurda - 03.10.2017

Today I learned
Код:
OnGameModeExit...(handlesql.)
is not working...


Re: Today I learned - Share your newly found knowledge! - Freaksken - 08.10.2017

TIL how tags work in pawn, mainly the float tag that is implemented with operator overloading. See float.inc.