#define players. a_ // Allocate symbol for the system
#define a_@ "players" // Set the name of the system
#define a_@@ 0 // Set the number of the system
...
#define gamemode. b_
#define b_@ "gamemode"
#define b_@@ 1
#define vehicles. c_
#define c_@ "vehicles"
#define c_@@ 2
...
/*!
- Objects Static
*/
#define Objects. Objects_
#define Object. Object_
#define CLASS_NAME Objects
#define CLASS_DATA Object
en(Data)
{
i.SomeIntVar;
f.SomeFloatVar;
i.SomeArrayOfVars[TheSizeOfTheArray];
}
nw[CountOfObjects]{Data};
#undef Objects
#undef Object
#define Objects[%0]. Objects[%0][Object_@
#define Object Objects[object]
#undef CLASS_NAME
#undef CLASS_DATA
new this.VarName, this.VarName2;
#define object objectid
#define objectid.%0(%1) objects.%0(_:object,%1)
is.Name()
{
// stock and integer function
}
ip.Name1(param0, param1, ...)
{
// public and integer function
}
in.Name2(param0, param1, ...)
{
// normal integer function
}
fs.Name3(param0, param1, ...)
{
// stock and float
}
bs.Name4()
{
// stock and bool
}
is.SomeMethod(object)
{
// some actions over the object
}
// class "players"
is.Teleport(player, float:x, float:y, float:z)
{
Player.Pos.X = x; // Player.Pos.X ~ Player.Pos[0] ~ Players[player].Pos[0] ~ Players[player][Player_Pos][0]
Player.Pos.Y = y; // Player.Pos.Y ~ Player.Pos[1] ~ Players[player].Pos[1] ~ Players[player][Player_Pos][1]
Player.Pos.Z = z; // Player.Pos.Z ~ Player.Pos[2] ~ Players[player].Pos[2] ~ Players[player][Player_Pos][2]
player.SetPos(); // <- is the method set position to player
}
is.SetPos(player)
{
SetPlayerPos(player, Player.Pos.X, Player.Pos.Y, Player.Pos.Z);
}
is.GetPos(player)
{
GetPlayerPos(player, Player.Pos.X, Player.Pos.Y, Player.Pos.Z);
}
// class "players"
is.Connect(player) // it's event
{
// to call some method use:
player.SomeMethod(params); // player is the object
// to call normal function use:
players.NormalFunctions(params); // players is the system
// you also can write shortly
this.NormalFunctions(params); // If you locate in "players" system
thi.SomeMethod(params); // If you locate in "players" system and "player" is an object of this system.
one.SomeMethod(params); // the same
}
// class "players"
cl.Connect(player) // is the same as "OnPlayerConnect"
{
// cl - callback (public function without forward)
// callback to the object
}
// class "gamemode"
cl.Init()
{
// callback to the system
}
// you also can make your own event
is.SomeEvent()
{
// do something
}
is.MoveToXYZ(player, float:x, float:y, float:z) // simple method
{
player.@Move();
// or
players.@Move(player);
// "Move" is the function, "@Move" is the event!
}
is.MoveToPlayer(player, player1)
{
players.GetPos(player1);
Player.Pos.X = Players[player1].Pos.X;
Player.Pos.Y = Players[player1].Pos.Y;
Player.Pos.Z = Players[player1].Pos.Z;
player.SetPos(player);
}
// or
is.MoveToPlayer(player, player1)
{
players.GetPos(player1);
for(i -> 3) Player.Pos[i] = Players[player1].Pos[i];
player.SetPos(player);
}
just because you can fiddle with the oh-so-loose preprocessor doesn't mean you should! replacement specifiers alone isn't a perfect solution. so many inconsistencies, syntax is just awful (not even close to the real approach), in short - i'm not a fan.
|