05.04.2015, 22:36
(
Последний раз редактировалось bartekdvd; 10.04.2015 в 02:02.
)
RAK
Hi,
First of all I hope it will get approved, because it is far less intruding than YSF plugin and much easier to update if there will be such a need (just a few offsets, no memory addresses, working without update since 0.3x for now).
With this plugin you can do this:
[ame]http://www.youtube.com/watch?v=FeWFyfkX1WE[/ame]
There are 3 include files. Include RAK.inc for networ engine functions, RPG.inc for RPG and RAKTOOLS.inc for HUD/Widescreen/Cutscene mode.
The RAK.inc functions (plugin):
Well, I think if you are interested in this the names speak for themselves. You can send RPC/Packets to client with this.
Example usage:
Currently supported version is 0.3z. I have not updated this plugin since 0.3x, so I hope it will work in 0.3.7, but these things here in PAWN:
need to be updated from version to version, like from 0.3x to 0.3z.
The minor updates like from 0.3z to 0.3z-R2 should not affect these.
RAK plugin only gives access to network engine (and only for sending data), so it doesn't relay on any
memory addresses like kurta999's one, but it still can stop working if major change in structures will happen (I think I probably will have to update it for 0.3.7, not sure).
And...
Honestly I don't remember what these do.
The RPG.inc functions:
vecFrom/vecPos - start position
vecTo - end position (where NPC should aim at)
vecAim - the aim vector determines missle direction (where NPC should aim)
quat - the Quaternion/orientation of NPC
vecSpeed - the 3D vector speed of NPC
skinId - the skin identifier of NPC
liveTime - how long should NPC live in ms - this value should always be >= 1000ms otherwise it won't shoot any rocket (could not make it in time)
worldId - determines in which virtual world you want to sync RPG (-1 = all)
interiorId - determines in which interior you want to sync RPG (-1 = all)
stream_distance - stream distance of RPG
RPG_Fire(playerid) - does the thing from *******.
The RAKTOOLS.inc functions:
Activates widescreen/cutscene mode and disables player HUD (also player can't go to main menu). If player plays with 16:9 (1080p, 720p) aspect ratio
then this doesn't add black bars bottom/top, just hides HUD. This option may not work in future samp versions.
Important:
RAK plugin just provides access to network engine. All the logic for RPG was written in PAWN and you can modify RPG.inc (it also includes static math functions) or create
new functions.
Download (Plugin source + includes + Windows & Linux x32 binaries):
http://www.mediafire.com/download/7d...lney8fv/RPG.7z
Hi,
First of all I hope it will get approved, because it is far less intruding than YSF plugin and much easier to update if there will be such a need (just a few offsets, no memory addresses, working without update since 0.3x for now).
With this plugin you can do this:
[ame]http://www.youtube.com/watch?v=FeWFyfkX1WE[/ame]
There are 3 include files. Include RAK.inc for networ engine functions, RPG.inc for RPG and RAKTOOLS.inc for HUD/Widescreen/Cutscene mode.
The RAK.inc functions (plugin):
Код:
native BitStream:InitBitStream();
native WriteToBitStream(BitStream:stream, type, {Float,_}:...);
native ReleaseBitStream(BitStream:stream);
native SendRPC(playerid, RPC, BitStream:stream);
native SendRPCToAll(RPC, BitStream:stream);
native SendData(playerid, BitStream:stream);
native SendDataToAll(BitStream:stream);
native AddTickSignal(index);
native RemoveTickSignal(index);
enum
{
BS_BOOL,
BS_CHAR,
BS_UCHAR,
BS_SHORT,
BS_USHORT,
BS_INT,
BS_UINT,
BS_FLOAT,
BS_STRING,
BSC_BOOL,
BSC_CHAR,
BSC_UCHAR,
BSC_SHORT,
BSC_USHORT,
BSC_INT,
BSC_UINT,
BSC_FLOAT,
BSC_STRING,
BS_NQUAT,
BS_VECTOR,
BS_ARRAY_BYTE,
BS_ARRAY_WORD,
BS_ARRAY_DWORD
};
Example usage:
Код:
#define RPC_WorldPlayerAdd 32
#define RPC_WorldPlayerRemove 163
#define RPC_ServerJoin 137
#define RPC_ServerQuit 138
#define ID_PLAYER_SYNC 212
#define ID_AIM_SYNC 218
forward Timer_FreeSlot(slot);
public Timer_FreeSlot(slot)
{
if (!IsPlayerConnected(slot))
{
new BitStream:stream;
stream = InitBitStream();
WriteToBitStream(stream, BS_SHORT, slot);
SendRPCToAll(RPC_WorldPlayerRemove, stream);
ReleaseBitStream(stream);
stream = InitBitStream();
WriteToBitStream(stream, BS_SHORT, slot);
WriteToBitStream(stream, BS_CHAR, 0);
SendRPCToAll(RPC_ServerQuit, stream);
ReleaseBitStream(stream);
FreeSlot(slot);
}
}
...
...
new BitStream:bsJoin, BitStream:bsAdd, BitStream:bsOnFoot, BitStream:bsAim, slot, Float:rot[3];
GetRotFromQuat(quat, rot[0], rot[1], rot[2]);
bsJoin = InitBitStream();
WriteToBitStream(bsJoin, BS_SHORT, slot);
WriteToBitStream(bsJoin, BS_INT, -1); //unknown
WriteToBitStream(bsJoin, BS_UCHAR, 1); //isNPC
WriteToBitStream(bsJoin, BS_UCHAR, 0); //nameLen
bsAdd = InitBitStream();
WriteToBitStream(bsAdd, BS_SHORT, slot);
WriteToBitStream(bsAdd, BS_CHAR, -1); //team
WriteToBitStream(bsAdd, BS_INT, skinId); //skin
WriteToBitStream(bsAdd, BS_FLOAT, vecFrom[0]);
WriteToBitStream(bsAdd, BS_FLOAT, vecFrom[1]);
WriteToBitStream(bsAdd, BS_FLOAT, vecFrom[2]);
WriteToBitStream(bsAdd, BS_FLOAT, rot[0]); //facingAngle
WriteToBitStream(bsAdd, BS_UINT, 0); //color
WriteToBitStream(bsAdd, BS_UCHAR, 0); //fightingStyle
static unkArray[11] = {0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8};
WriteToBitStream(bsAdd, BS_ARRAY_WORD, unkArray, sizeof(unkArray));
bsOnFoot = InitBitStream();
WriteToBitStream(bsOnFoot, BS_UCHAR, ID_PLAYER_SYNC); //PacketID
WriteToBitStream(bsOnFoot, BS_SHORT, slot); //playerId
WriteToBitStream(bsOnFoot, BS_BOOL, true); //hasLR
WriteToBitStream(bsOnFoot, BS_SHORT, 0); //lrAnalog
WriteToBitStream(bsOnFoot, BS_BOOL, true); //hasUD
WriteToBitStream(bsOnFoot, BS_SHORT, 0); //udAnalog
WriteToBitStream(bsOnFoot, BS_SHORT, 4 | 128); //keys
WriteToBitStream(bsOnFoot, BS_FLOAT, vecFrom[0]);
WriteToBitStream(bsOnFoot, BS_FLOAT, vecFrom[1]);
WriteToBitStream(bsOnFoot, BS_FLOAT, vecFrom[2]);
WriteToBitStream(bsOnFoot, BS_NQUAT, quat); //quat
WriteToBitStream(bsOnFoot, BS_UCHAR, -1); //health/armour
WriteToBitStream(bsOnFoot, BS_UCHAR, 35); //weapon
WriteToBitStream(bsOnFoot, BS_UCHAR, 0); //specialAction
WriteToBitStream(bsOnFoot, BS_VECTOR, vecSpeed); //moveSpeed
WriteToBitStream(bsOnFoot, BS_BOOL, false); //hasSurfInfo
WriteToBitStream(bsOnFoot, BS_BOOL, false); //hasAnimation
//WriteToBitStream(bsOnFoot, BS_INT, 0x800404A5); //animation
bsAim = InitBitStream();
WriteToBitStream(bsAim, BS_UCHAR, ID_AIM_SYNC); //PacketID
WriteToBitStream(bsAim, BS_SHORT, slot); //playerId
WriteToBitStream(bsAim, BS_UCHAR, 8); //CamMode
WriteToBitStream(bsAim, BS_FLOAT, vecAim[0]); //AimF1.X
WriteToBitStream(bsAim, BS_FLOAT, vecAim[1]); //AimF1.Y
WriteToBitStream(bsAim, BS_FLOAT, vecAim[2]); //AimF1.Z
WriteToBitStream(bsAim, BS_FLOAT, vecFrom[0]);
WriteToBitStream(bsAim, BS_FLOAT, vecFrom[1]);
WriteToBitStream(bsAim, BS_FLOAT, vecFrom[2]);
WriteToBitStream(bsAim, BS_FLOAT, 0); //fAimZ
WriteToBitStream(bsAim, BS_UCHAR, 0xFF); //ExtZoom : 6 / weapoonState : 2
WriteToBitStream(bsAim, BS_UCHAR, 0);
for (new i = 0; i < (MAX_SLOTS - 4); i++)
{
if (IsPlayerConnected(i))
{
if (worldId == -1 || (GetPlayerVirtualWorld(i) == worldId))
{
if (interiorId == -1 || (GetPlayerInterior(i) == interiorId))
{
if (GetPlayerDistanceFromPoint(i, vecFrom[0], vecFrom[1], vecFrom[2]) <= stream_distance)
{
SendRPC(i, RPC_ServerJoin, bsJoin);
SendRPC(i, RPC_WorldPlayerAdd, bsAdd);
SendData(i, bsOnFoot);
SendData(i, bsAim);
}
}
}
}
}
ReleaseBitStream(bsJoin);
ReleaseBitStream(bsAdd);
ReleaseBitStream(bsOnFoot);
ReleaseBitStream(bsAim);
...
...
Код:
#define RPC_WorldPlayerAdd 32 #define RPC_WorldPlayerRemove 163 #define RPC_ServerJoin 137 #define RPC_ServerQuit 138 #define ID_PLAYER_SYNC 212 #define ID_AIM_SYNC 218
The minor updates like from 0.3z to 0.3z-R2 should not affect these.
RAK plugin only gives access to network engine (and only for sending data), so it doesn't relay on any
memory addresses like kurta999's one, but it still can stop working if major change in structures will happen (I think I probably will have to update it for 0.3.7, not sure).
And...
Код:
native AddTickSignal(index); native RemoveTickSignal(index);
The RPG.inc functions:
Код:
RPG_FireAimQuat(Float:vecFrom[3], Float:vecAim[3], Float:quat[4], Float:vecSpeed[3], skinId = 0, liveTime = 1000, worldId = -1, interiorId = -1, Float:stream_distance = 300.0); RPG_FireQuat(Float:vecPos[3], Float:quat[4], Float:vecSpeed[3], skinId = 0, liveTime = 1000, worldId = -1, interiorId = -1, Float:stream_distance = 300.0); RPG_FireAim(Float:vecFrom[3], Float:vecAim[3], Float:vecSpeed[3], skinId = 0, liveTime = 1000, worldId = -1, interiorId = -1, Float:stream_distance = 300.0); RPG_FireFromTo(Float:vecFrom[3], Float:vecTo[3], Float:vecSpeed[3], skinId = 0, liveTime = 1000, worldId = -1, interiorId = -1, Float:stream_distance = 300.0); RPG_FireRot(Float:vecPos[3], Float:vecSpeed[3], Float:vecRot[3], skinId = 0, liveTime = 1000, worldId = -1, interiorId = -1, Float:stream_distance = 300.0); RPG_Fire(playerid);
vecTo - end position (where NPC should aim at)
vecAim - the aim vector determines missle direction (where NPC should aim)
quat - the Quaternion/orientation of NPC
vecSpeed - the 3D vector speed of NPC
skinId - the skin identifier of NPC
liveTime - how long should NPC live in ms - this value should always be >= 1000ms otherwise it won't shoot any rocket (could not make it in time)
worldId - determines in which virtual world you want to sync RPG (-1 = all)
interiorId - determines in which interior you want to sync RPG (-1 = all)
stream_distance - stream distance of RPG
RPG_Fire(playerid) - does the thing from *******.
The RAKTOOLS.inc functions:
Код:
stock TogglePlayerHUD(playerid, bool:toggle)
then this doesn't add black bars bottom/top, just hides HUD. This option may not work in future samp versions.
Important:
RAK plugin just provides access to network engine. All the logic for RPG was written in PAWN and you can modify RPG.inc (it also includes static math functions) or create
new functions.
Download (Plugin source + includes + Windows & Linux x32 binaries):
http://www.mediafire.com/download/7d...lney8fv/RPG.7z


i'll test it later.

