[Include] Main.inc - A lot of random useful functions (also necessary for my releases)
#1

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!
Reply
#2

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

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

Pastebin please.
Reply
#5

Pastebin link now in the original post. Enjoy.
Reply
#6

stock DoNothing() return true;
Reply
#7

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

Nice, but you should use TAB somewhere...

it will be readable

example,

Reply
#9

Horrible, really horrible ...
Reply
#10

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?
Reply
#11

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

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

Horrible, Its so horrible
Reply
#14

Reply
#15

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

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)