Today I learned - Share your newly found knowledge!

Today I learned that using printf with large strings will crash the server.
Reply

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.
Reply

Today I learned to make Dialog with string and I made that:
Reply

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
Reply

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.
Reply

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:
PHP код:
@test()
{

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.
Reply

Today i learned there exist an *then in Pawn, like this:

PHP код:
new a=5;
if 
a==*then print("a=5"); 
Didn't know that
Reply

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Today i learned there exist an *then in Pawn, like this:

PHP код:
new a=5;
if 
a==*then print("a=5"); 
Didn't know that
Basic C++ or PHP
Reply

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Basic C++ or PHP
Dude...what Pawn has to do with PHP? Right, nothing.

Thats why it wonders me.
Reply

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:
PHP код:
@test()
{

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==*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
Reply

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")
Reply

@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");
}
Reply

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.
Reply

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 '@'
Reply

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.
Reply

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 '@'
Reply

Yes, i was wrong. Because i was thinking to say that you need the '@' but i say the opposite.
Reply

Aha I don't mind it
Reply

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.
  1. First, we will need to declare a define
  2. 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
Reply

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.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)