SA-MP Forums Archive
[Include] Main.inc - A lot of random useful functions (also necessary for my releases) - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Main.inc - A lot of random useful functions (also necessary for my releases) (/showthread.php?tid=622875)



Main.inc - A lot of random useful functions (also necessary for my releases) - ¤Adas¤ - 27.11.2016

Hello guys,

I haven't visited this forum or SA-MP gameplay for years now, and now I think it's time to finally release some things I've been working on, and am rightfully proud of. The reason for sharing is just that I wanted to share all my work I've been doing when I was a SAMP-playing teen. If I recall correctly, most of this was created when I was 14-16 years old.

This include is related to my unfinished gamemode and finished filterscript I've released (see the links below). It can be used for whatever you want, but there's a catch - you'll kinda have to figure out what all the functions do (in case it's not obvious from the script), because I don't have the time to write it all down, it also includes quite a lot of functions. Also, my programming style is both very messy and very clear in a sense. Sometimes it may seem overly simplified. I also almost never added comments to my scripts since I've had no idea I would be sharing them once.

To name a few:

Text editing functions
Object moving functions (related to my Mustang object editor)
Checkpoint streamer
Completely random functions (SetPlayerFaceToPlayer...)
Functions I don't recall because it's been such a long time.


Here is the link to it: Main.inc
Pastebin: Main.inc

Links to my gamemode and filterscript that use this file:

Gamemode: https://sampforum.blast.hk/showthread.php?pid=3805798#pid3805798
Filterscript: https://sampforum.blast.hk/showthread.php?pid=3805815#pid3805815

If you're an experienced programmer, you should understand 98% of the functions, sometimes what they do is in their name. Regardless, have fun with them!


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Dayrion - 27.11.2016

Post a pastebin link please.
EDIT: There is no intendation. It's like unreadable.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - ¤Adas¤ - 27.11.2016

Thanks for your reply. I know it's almost unreadable, but understand it's all I have. This was my style. You're free to dislike it, but that's about it. I know the reality of it. I know it's messy. But who really wants to take something out of it and is curious, will definitely benefit from it.

Have a great day.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - oMa37 - 27.11.2016

Pastebin please.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - ¤Adas¤ - 27.11.2016

Pastebin link now in the original post. Enjoy.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Pottus - 27.11.2016

stock DoNothing() return true;


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - ¤Adas¤ - 27.11.2016

Yes, that kind of stuff is also included there. Some functions really have no function. Others very limited.

I would also like to add that some functions are not 100% mine, sometimes I was inspired by someone else's job but always improved/added something.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Ivan_Ino - 27.11.2016

Nice, but you should use TAB somewhere...

it will be readable

example,




Re: Main.inc - A lot of random useful functions (also necessary for my releases) - oMa37 - 27.11.2016

Horrible, really horrible ...


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Swedky - 27.11.2016

pawn Код:
stock minusrandom(max)
{
new rana[2];
rana[0] = random(max);
rana[1] = random(max);
return rana[0] - rana[1];
}
pawn Код:
#define minusrandom(%1) (random(%1) - random(%1))
Код:
stock Wait(interval)
{
    new TickCount = GetTickCount();
    while(GetTickCount() - TickCount < interval) DoNothing();
    return true;
}
What?


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - ¤Adas¤ - 27.11.2016

Yeah dude. Even I don't know. I was probably testing something that I forgot, and the functions remained, lol.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Yashas - 28.11.2016

Quote:
Originally Posted by EnzoMetlc
Посмотреть сообщение
Код:
stock Wait(interval)
{
    new TickCount = GetTickCount();
    while(GetTickCount() - TickCount < interval) DoNothing();
    return true;
}
What?
Makes the server sleep. It works though.


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Pearson - 28.11.2016

Horrible, Its so horrible


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - AbyssMorgan - 28.11.2016




Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Dignity - 10.12.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
lmfao i laughed


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Swedky - 10.12.2016

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Makes the server sleep. It works though.
Sure it works, but why "GetTickCount() - GetTickCount() < interval" instead "0 < interval"?


Re: Main.inc - A lot of random useful functions (also necessary for my releases) - Yashas - 09.02.2017

Quote:
Originally Posted by Swedky
Посмотреть сообщение
Sure it works, but why "GetTickCount() - GetTickCount() < interval" instead "0 < interval"?
That is an infinite loop.

His code isn't an infinite loop. After executing the loop millions of times, GetTickCount will return a new value whereas TickCount will remain the same. It works like the sleep() function.

EDIT: Oops. I bumped. Sorry.