SA-MP Forums

Go Back   SA-MP Forums > Search Forums

Showing results 1 to 25 of 41
Search took 0.00 seconds.
Search: Posts Made By: Slice
Forum: Discussion 21/07/2016, 01:06 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Ah ok I see what you mean. This would be better then:

static prefix[4] = {'1', '2', '3', '_'}, str[144];

str = some_other_String;

print(prefix);
Forum: Discussion 21/07/2016, 12:03 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Mind clarifying the last two examples? I don't get what you mean.
Forum: Discussion 31/03/2016, 09:18 AM
Replies: 709
Views: 166,384
Posted By Slice
Forum: Discussion 27/02/2016, 08:45 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Nice.

Maybe the next thing you should learn is to read the front page post.
Forum: Discussion 03/12/2015, 11:06 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

There are cases where it actually is a bit useful, but it's rare. In his example, he could just have refactored the if statements.

One place where goto is useful is obviously when dealing with...
Forum: Discussion 01/11/2015, 09:25 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Ah, right, yeah. I even put 12+0..
Forum: Discussion 01/11/2015, 06:44 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Tomato tomato. I prefer showing it that way because the strack grows upwards.
Forum: Discussion 01/11/2015, 09:41 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

its*

A function doesn't iterate through its parameters; they are pushed onto the stack in reverse order.

PUSH c
PUSH b
PUSH a

The frame now looks like this:
12+8 - c
Forum: Discussion 06/10/2015, 07:21 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Oh my bad, I thought you wanted to actually discuss the technical details. You just wanted to tell the world what you think.
Maybe we can start putting 2d arrays into them also? With your logic, it...
Forum: Discussion 06/10/2015, 05:14 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

I'm talking about CallRemoteFunction, and how strings/arrays are treated there. Not sure what you're on about..
There is no way for CallRemoteFunction to know the array size of a string, because...
Forum: Discussion 06/10/2015, 12:04 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Integer key codes? What.
Either way, "cells" is the correct term when you talk about the abstract representation of a value in AMX memory. An integer is a cell with an empty tag. A float is a cell...
Forum: Discussion 06/10/2015, 11:24 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Today I learned that CallLocalFunction and CallRemoteFunction do in fact support arrays, and it copies the array to the heap of the receiving AMX, so it's safe to use between filterscripts and/or the...
Forum: Discussion 17/09/2015, 04:29 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

It does not affect speed in any way, because the replacements are doing during compile-time (not run-time).

I've done this previously:

#define DB:: DB_

new DB::SomeVariable = 2;

stock...
Forum: Discussion 03/09/2015, 02:40 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

@Dutheil: he's talking about public functions (i.e. saved in the public function table in the AMX).

This should work:

main() {
CallLocalFunction("@test", "");
}

@test();
@test() {
Forum: Discussion 21/06/2015, 08:39 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

stock test() {
return;
}

main() {
new a = test();

return a;
}
Forum: Discussion 21/06/2015, 11:25 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

That will cause a warning if you actually use the return value.
Forum: Discussion 01/04/2015, 10:52 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Today I learned a different way to check for -1!

These two if-statements check for the same thing:

if (strfind("hello world", "hello") != -1) {
printf("string found!");
}

if...
Forum: Discussion 23/03/2015, 09:01 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

I'm not sure if the terms "truthy" and "falsey" really exist in Pawn. False is 0, and true is not false.

Truthy/falsey refers to values in languages such as JavaScript where the following are...
Forum: Discussion 08/02/2015, 12:55 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Wow, Misiur, I have been searching for a solution to a problem just like that for quite a while.

I have an idea of an include that could be put into old, broken scripts to prevent them from...
Forum: Discussion 07/01/2015, 01:21 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

If you fall faster than -0.6 you will always die. If you fall slower than -0.2 you will not take damage. If you fall between -0.2 and -0.6 the damage will be 4.95-29.95.

Today I learned using a...
Forum: Discussion 05/01/2015, 12:06 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Today I learned the following is a valid way to specify the apostrophe character:

new apostrophe = ''';
Forum: Discussion 01/01/2015, 01:49 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Today I learned drowning/fire/carpark damage values are different depending on FPS, explosions never do more than 82.5 damage, and fall damage is at most 165.
Forum: Discussion 12/02/2014, 08:28 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Today I learned that the anti-DoS timeout issues can be fixed (http://forum.sa-mp.com/showthread.php?p=2910058#post2910058) by constantly unbanning the IP of a player experiencing problems.
...
Forum: Discussion 20/11/2013, 01:29 PM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

Native hash maps, nice!

Though why do you need to send the address of [0][0]? What about finding that inside the init function?


// using varargs to avoid tag index mismatch
stock...
Forum: Discussion 24/10/2013, 06:29 AM
Replies: 709
Views: 166,384
Posted By Slice
Re: Today I learned - Share your newly found knowledge!

It won't, actually. It will match "f", then it won't match "u". Because it's &&, it stops on the first false.

Example:
// return the first argument
stock ReturnArg(arg) {
printf("arg: %d",...
Showing results 1 to 25 of 41

 

All times are GMT. The time now is 10:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.