OosKar
Известный
- 11
- 0
Can I apply some animations through sf? I've tried everything, but I can not solve it. What could be the problem?
I developed the code for reading animation, and everything is working fine.
EmulationRPC, Similar structure: (SR_team)
Raklogger.json
Raklogger.txt
events.lua ([URL = 'https: //github.com/THE-FYP/SAMP.Lua/blob/master/samp/events.lua#L122'] SAMP.Lua / events.lua at master · THE-FYP / SAMP.Lua · GitHub ( SAMP.Lua / samp / events at master · THE-FYP / SAMP.Lua · GitHub (https://github.com/THE-FYP/SAMP.Lua/blob / master / samp / events) [/ sup] .lua # L122) [/ sup] [/ URL])
Код:
int ID = SF-> getSAMP () -> getPlayers () -> sLocalPlayerID;
string category = "DILDO";
string animationName = "DILDO_G";
char * categoryC = "DILDO";
char * animationNameC = "DILDO_G";
char categoryCH [256] = "DILDO";
char animationNameCH [256] = "DILDO_G";
float animationSpeed = 4.1;
BitStream bitStream;
bitStream.ResetWritePointer ();
bitStream.Write (int32 (ID)); // (int16 (ID)) // (BYTE (ID))
bitStream.Write (DWORD (category.length ())); // (BYTE (category.length ())) // (strlen (categoryC))
bitStream.Write ((PCHAR) category.c_str, category.length ()); // (categoryCH) // (category) // (categoryC) ((PCHAR) category, length)
bitStream.Write (DWORD (animationName.length ())); // The same as above.
bitStream.Write ((PCHAR) animationName.c_str, animationName.length ());
bitStream.Write (animationSpeed);
bitStream.Write (false);
bitStream.Write (false);
bitStream.Write (false);
bitStream.Write (false);
bitStream.Write (int (0));
SF-> getRakNet () -> emulateRecvRPC (ScriptRPCEnumeration :: RPC_ScrApplyAnimation, & bitStream);
I developed the code for reading animation, and everything is working fine.
Код:
bool CALLBACK incomingRPC (stRakNetHookParams * params) {
if (params-> packetId == ScriptRPCEnumeration :: RPC_ScrApplyAnimation) {
byte fileAnimationLength = 0, animationNameLength = 0;
char fileAnimationName [256], animationName [256];
byte timeFlag = 0; // animationLoop = 0,
float animationSpeed = 0;
short unsigned int id = 0;
bool animationLoop = false, lockX = false, lockY = false, freeze = false;
size_t lengthFile = 0;
params-> bitStream-> ResetReadPointer ();
params-> bitStream-> Read (id);
params-> bitStream-> Read (fileAnimationLength);
params-> bitStream-> Read (fileAnimationName, fileAnimationLength);
params-> bitStream-> Read (animationNameLength);
params-> bitStream-> Read (animationName, animationNameLength);
params-> bitStream-> Read (animationSpeed);
params-> bitStream-> Read (animationLoop);
params-> bitStream-> Read (lockY);
params-> bitStream-> Read (lockX);
params-> bitStream-> Read (freeze);
params-> bitStream-> Read (timeFlag);
params-> bitStream-> ResetReadPointer ();
fileAnimationName [fileAnimationLength] = '\ 0';
animationName [animationNameLength] = '\ 0';
SF-> getSAMP () -> getChat () -> AddChatMessage (-1,
"Player:% i | FileZ:% i | File:% s | NameZ:% i | Name:% s | Speed:%. 1f | Loop:% s | Y:% s | Z:% s | Freeze:% s | Time:% i ",
id,
fileAnimationLength,
fileAnimationName,
animationNameLength,
animationName,
animationSpeed,
animationLoop? ("true"): ("false"),
lockY? ("true"): ("false"),
lockX? ("true"): ("false"),
freeze? ("true"): ("false"),
timeFlag);
}
return true;
}
EmulationRPC, Similar structure: (SR_team)
Код:
Number of bytes / name
_____________________________________________________
2 / id of the player to which the animation is applied
1 / length of animation file name
n / animation file name
1 / animation name length
n / animation name
4 / animation speed float
1 / animation looping 1/0
1 / lock y 1/0
1 / lock x 1/0
1 / freeze player 1/0
4 / some dwTime flag, usually 0 * /
Raklogger.json
Код:
{
"id": "86",
"name": "RPC_ScrApplyAnimation",
"lenBytes": "24",
"lenBits": "188",
"unreadBits": "188",
"data": "000007414952504F5254046E756C6C333383400000000000",
"datetime": "30.10.2017-21: 40: 17",
"params": ""
},
Raklogger.txt
Код:
[RPC Recv] RPC_ScrApplyAnimation [86] (length: 31 bytes, 244 bits)
> dump:
0000 00 00 07 42 44 5F 46 49 52 45 0B 42 44 5F 50 41 ... BD_FIRE.BD_PA
0010 4E 49 43 5F 30 31 64 3B 83 40 00 00 00 00 NIC_01d; ƒ @ .....
events.lua ([URL = 'https: //github.com/THE-FYP/SAMP.Lua/blob/master/samp/events.lua#L122'] SAMP.Lua / events.lua at master · THE-FYP / SAMP.Lua · GitHub ( SAMP.Lua / samp / events at master · THE-FYP / SAMP.Lua · GitHub (https://github.com/THE-FYP/SAMP.Lua/blob / master / samp / events) [/ sup] .lua # L122) [/ sup] [/ URL])
Код:
INCOMING_RPCS [RPC.APPLYANIMATION] = {'onApplyPlayerAnimation', {playerId = 'int16'}, {animLib = 'string8'}, {animName = 'string8'}, {loop = 'bool'}, {lockX = 'bool' }, {lockY = 'bool'}, {freeze = 'bool'}, {time = 'int32'}} [/ code] [/ code] [/ code] [/ sup]