[Include] [INC] Hard-code
#1

What is this?
This "code" was written for fun, it's hard to read the script if you're coding it with this style, so that's all what's "useful" for.


How to install?
You'll need to include hcode.inc right after the a_samp.inc:
Код:
#include "a_samp"
#include "hcode"
New definitions:
BEGIN as {
END as }
O as (
C as )
OB as [
CB as ]
X as ;
CM as ,

ENUM as enum
var as new
con as const
stat as static

PUBLIC as public
FORWARD as forward
NATIVE as native
STOCK as stock
OP as operator
CHAR as char
SIZE as sizeof
TAG as tagof
GIVEBACK as return
GBTRUE as return true
GBFALSE as return false

FOR as for
WHILE as while
IF as if
ELSE as else
ELSEIF as else if
SWITCH as switch
CASE as case
OTHERWISE as default

STOP as break
GOON as continue
DOIT as do
GOTO as goto

IS as =
EQUAL as ==
NEQUAL as !=
LESS as <
MORE as >
LESSIS as <=
MOREIS as >=
ADD as +
TAKE as -
ADDADD as ++
TAKETAKE as --
ADDIS as +=
TAKEIS as -=
MULTI as *
DIV as /
AND as &&
OR as ||
N as !


Examples:
Example #1:
Hard code:
Код:
FORWARD HelloMsg O C X
PUBLIC HelloMsg O C GIVEBACK print O "Hello!" C X

PUBLIC OnGameModeInit O C
BEGIN
	HelloMsg O C X
	GIVEBACK true X
END
Normal code:
Код:
forward HelloMsg();
public HelloMsg() return print("Hello!");

public OnGameModeInit()
{
	HelloMsg();
	return true;
}
Example #2:
Hard code:
Код:
FOR O var a IS 0 X a LESS 5 X a ADDADD C
BEGIN
	printf O "%i" CM a C X
	IF O a EQUAL 2 C STOP X
END
Normal code:
Код:
for(new a = 0; a < 5; a++)
{
	printf("%i", a);
	if(a == 2) break;
}
Example #3:
Hard code:
Код:
var
	a IS 0 X
IF O N a C print O "Hello there." C X
Normal code:
Код:
new
	a = 0;
if(!a) print("Hello there.");
Example #4:
Hard code:
Код:
var
	a IS 5 CM b IS 7 X
IF O a EQUAL 5 AND b EQUAL 6 C
	print O "Variable \"a\" is equal to 5 AND variable \"b\" is equal to 6." C X
ELSE
	print O "Variable \"a\" is NOT equal to 5 OR variable \"b\" is NOT equal to 6." C X
Normal code:
Код:
new
	a = 5, b = 7;
if(a == 5 && b == 6)
	print("Variable \"a\" is equal to 5 AND variable \"b\" is equal to 6.");
else
	print("Variable \"a\" is NOT equal to 5 OR variable \"b\" is NOT equal to 6.");
Example #5:
Hard code:
Код:
var
	string OB 24 CHAR CB IS "Hello" X // Packed string (6 cells).
printf O "%s, %i" CM string CM SIZE string C X
Normal code:
Код:
new
	string[24 char] = "Hello"; // Packed string (6 cells).
printf("%s, %i", string, sizeof(string));
Download:
hcode.inc & testcode.pwn - http://www.solidfiles.com/d/9e79f46b79
Reply
#2

WoW! Very Nice!!!
Reply
#3

Why make coding harder? What's the point?
Reply
#4

good job mate but its a little bit useless (no offense )
but nice one
7/10
Reply
#5

It reminded me about Basic
But if you want hardcore coding, use PERL! xD That will be extreme!
Reply
#6

Rewrite the godfather using this include. I dare you.
Pretty cool include!
Reply
#7

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
Why make coding harder? What's the point?
If you manage to code like this, you can do anything - its good practice for your programming skills and brain functions!

Very nice!
Reply
#8

Nice job.
I can use this to check my skills in scripting.

Reply
#9

Inspired by https://sampforum.blast.hk/showthread.php?tid=171839?
Reply
#10

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
Why make coding harder? What's the point?
Quote:
Originally Posted by fiki574_CRO
Посмотреть сообщение
If you manage to code like this, you can do anything - its good practice for your programming skills and brain functions!

Very nice!
Seriously ?! I agree what Sniper Kitty says.

This include can be used for non-lazy persons; think more, think before you type/code if you use this include.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)