Re: Today I learned - Share your newly found knowledge! -
HBG - 11.08.2015
Today I learned that using printf with large strings will crash the server.
Re: Today I learned - Share your newly found knowledge! -
Write - 21.08.2015
Today I learned that if you put a plane-swipe command with a public function, it'll delete all of your saved files in the scriptfiles thread therefore you must use swipe commands only.
Re: Today I learned - Share your newly found knowledge! -
jlalt - 21.08.2015
Today I learned to make Dialog with string and I made that:
Re: Today I learned - Share your newly found knowledge! -
Tamer - 21.08.2015
Quote:
Originally Posted by jlalt
Today I learned to make Dialog with string and I made that:
|
Here's something new for you to learn today, DIALOG_STYLE_TABLIST_HEADERS
https://sampwiki.blast.hk/wiki/Dialog_Styles
https://sampwiki.blast.hk/wiki/Image:Di...st_headers.png
Re: Today I learned - Share your newly found knowledge! -
Inn0cent - 31.08.2015
Well, Today i came to know that we can still chat if the gamemode is restarting. Will be good for the servers which have restarting every 5 min. For mission changes.
Re : Today I learned - Share your newly found knowledge! -
Dutheil - 03.09.2015
Today I learned that when you declare a function with a name starting with an at sign '@' character, it is automatically detected as a public function.
If you do this:
You will take a "warning 235: public function lacks forward declaration (symbol "@test"), because it is not forward, this means that it is a public function.
AW: Today I learned - Share your newly found knowledge! -
Kaliber - 03.09.2015
Today i learned there exist an *then in Pawn, like this:
PHP код:
new a=5;
if a==5 *then print("a=5");
Didn't know that
Re: AW: Today I learned - Share your newly found knowledge! -
SecretBoss - 03.09.2015
Quote:
Originally Posted by Kaliber
Today i learned there exist an *then in Pawn, like this:
PHP код:
new a=5;
if a==5 *then print("a=5");
Didn't know that
|
Basic C++ or PHP
AW: Re: AW: Today I learned - Share your newly found knowledge! -
Kaliber - 03.09.2015
Quote:
Originally Posted by SecretBoss
Basic C++ or PHP
|
Dude...what Pawn has to do with PHP? Right, nothing.
Thats why it wonders me.
Re: AW: Today I learned - Share your newly found knowledge! -
Freezo - 03.09.2015
Quote:
Originally Posted by Dutheil
Today I learned that when you declare a function with a name starting with an at sign '@' character, it is automatically detected as a public function.
If you do this:
You will take a "warning 235: public function lacks forward declaration (symbol "@test"), because it is not forward, this means that it is a public function.
|
True, the character '@' declare a public function|
@test() ->
public test()
Quote:
Originally Posted by Kaliber
Today i learned there exist an *then in Pawn, like this:
PHP код:
new a=5;
if a==5 *then print("a=5");
Didn't know that
|
in samp pawn only, in
sourcemod &
amxmodx &
amxmod, it shows up an error :
Код:
Error: Expected token: "(", but found "-identifier-" on line 14
Re : Re: AW: Today I learned - Share your newly found knowledge! -
Dutheil - 03.09.2015
Quote:
Originally Posted by Freezo
True, the character '@' declare a public function| @test() -> public test()
|
Not really, if you put the character '@' before the name, you can't call only the function name.
Example which works :
PHP код:
#include <a_samp>
main()
{
@test();
}
forward @test();
@test()
{
print("test");
}
Example doesn't work :
PHP код:
#include <a_samp>
main()
{
test();
}
forward test();
@test()
{
print("test");
}
Код:
error 004: function "test" is not implemented
warning 235: public function lacks forward declaration (symbol "@test")
Re: Today I learned - Share your newly found knowledge! -
Slice - 03.09.2015
@Dutheil: he's talking about public functions (i.e. saved in the public function table in the AMX).
This should work:
pawn Код:
main() {
CallLocalFunction("@test", "");
}
@test();
@test() {
printf("test");
}
Re: Re : Re: AW: Today I learned - Share your newly found knowledge! -
Freezo - 03.09.2015
Quote:
Originally Posted by Dutheil
Not really, if you put the character '@' before the name, you can't call only the function name.
Example which works :
PHP код:
#include <a_samp>
main()
{
@test();
}
forward @test();
@test()
{
print("test");
}
Example doesn't work :
PHP код:
#include <a_samp>
main()
{
test();
}
forward test();
@test()
{
print("test");
}
Код:
error 004: function "test" is not implemented
warning 235: public function lacks forward declaration (symbol "@test")
|
i dunno what are you trying to say. But yes, i know when you declare it as @test, you will call it as test() and not @test().
@ is like doing public or nothing.
@test() = public test() or test() =
It was just yesterday that i join samp pawn, i was in amxmodx, they don't do forward for such a thing like that.
Re : Re: Re : Re: AW: Today I learned - Share your newly found knowledge! -
Dutheil - 03.09.2015
Quote:
Originally Posted by Freezo
@test() = public test() or test() =
|
Check out my examples, you'll see that it's not exactly right.
@Slice : Yes I understood it (not for the forward, but thanks).
What I mean is that if I want to call the function, it will necessarily indicate the at sign '@'
Re: Re : Re: Re : Re: AW: Today I learned - Share your newly found knowledge! -
Freezo - 03.09.2015
Quote:
Originally Posted by Dutheil
Check out my examples, you'll see that it's not exactly right.
|
@ -> public = point finale.
Sorry i was meaning that you need to call it with @. But i write the opposite.
Re : Today I learned - Share your newly found knowledge! -
Dutheil - 03.09.2015
Quote:
Originally Posted by Freezo
@ -> public = point finale.
You are doing a call with @ and you expect to the function to be called?
|
I answered :
Quote:
Originally Posted by Dutheil
What I mean is that if I want to call the function, it will necessarily indicate the at sign '@'
|
Re: Today I learned - Share your newly found knowledge! -
Freezo - 03.09.2015
Yes, i was wrong. Because i was thinking to say that you need the '@' but i say the opposite.
Re : Today I learned - Share your newly found knowledge! -
Dutheil - 03.09.2015
Aha I don't mind it
Re: Today I learned - Share your newly found knowledge! -
Freezo - 05.09.2015
Today i learned that when you declare a stock or a function like :
Код:
stock printf.one() { }
The compiler doesn't manage that, well because of the point '
.', and it gives an error of "
Undefined symbol", but how can we fix that?
Well its really simple.
- First, we will need to declare a define
- the define will basically replace the real one.
Take a look:
Код:
#define printf. _replace_
Код:
stock printf.one() { }
stock printf.two() { }
stock printf.three() { }
What did i do? Well simply i create a define that replace the printf with _replace_ which the compiler will read it like this:
Код:
stock _replace_one() {}
stock _replace_two() {}
stock _replace_three {}
Done.
Edit: i didn't tough that its something made before:
Here
Re: Today I learned - Share your newly found knowledge! -
Jpew - 08.09.2015
Today i learned the functions for stablish a mysql conection, like this:
Код:
#define SQL_HOST ("localhost")
#define SQL_USER ("root")
#define SQL_PASS ("")
#define SQL_DB ("db")
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
It's really stupid, but it is something.