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 };
#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
native AddTickSignal(index); native RemoveTickSignal(index);
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);
stock TogglePlayerHUD(playerid, bool:toggle)
What's that HUD function? It really hides player HUD? But the screen become strange, is there any way to disable the screen resolution change? This plugin is client-sided?
|
This plugin is only server sided. That hud function activates cutscene mode. If you have 16:9 aspect ratio like 1080p/720p you shouldn't see these black bars.
|
Ahh I love it. Even though I'm not using a widescreen, it's pretty badass. I don't mind the bars, but wouldn't cutscene mode alter TextDraw positions?
|
@Edit: Is there any way to force players go to ESC Menu using RPC?
|
I'm not sure. I don't remember, but I think no. You can always try sending random RPC/Packets with random BitStream data and length and see what will happen in your game, maybe there is some hidden function like that. The range of RPC IDs is from 0 to 255, same thing for packets, so not so many.
|
enum PacketEnumeration : unsigned char
{
ID_PLAYER_SYNC = 212,
ID_MARKERS_SYNC = 213,
ID_UNOCCUPIED_SYNC = 214,
ID_TRAILER_SYNC = 215,
ID_PASSENGER_SYNC = 216,
ID_SPECTATOR_SYNC = 217,
ID_AIM_SYNC = 218,
ID_VEHICLE_SYNC = 219,
ID_RCON_COMMAND = 220,
ID_RCON_RESPONCE = 221,
ID_WEAPONS_UPDATE = 222,
ID_STATS_UPDATE = 223,
ID_BULLET_SYNC = 224,
};
/*
Updated to 0.3z by P3ti
*/
#include "main.h"
int RPC_ServerJoin = 137;
int RPC_ServerQuit = 138;
int RPC_InitGame = 139;
int RPC_ClientJoin = 25;
int RPC_NPCJoin = 54;
int RPC_Death = 53;
int RPC_RequestClass = 128;
int RPC_RequestSpawn = 129;
int RPC_SetInteriorId = 118;
int RPC_Spawn = 52;
int RPC_Chat = 101;
int RPC_EnterVehicle = 26;
int RPC_ExitVehicle = 154;
int RPC_DamageVehicle = 106;
int RPC_MenuSelect = 132;
int RPC_MenuQuit = 140;
int RPC_ScmEvent = 96;
int RPC_AdminMapTeleport = 255;
int RPC_WorldPlayerAdd = 32;
int RPC_WorldPlayerDeath = 166;
int RPC_WorldPlayerRemove = 163;
int RPC_WorldVehicleAdd = 164;
int RPC_WorldVehicleRemove = 165;
int RPC_SetCheckpoint = 107;
int RPC_DisableCheckpoint = 37;
int RPC_SetRaceCheckpoint = 38;
int RPC_DisableRaceCheckpoint = 39;
int RPC_UpdateScoresPingsIPs = 155;
int RPC_SvrStats = 102;
int RPC_GameModeRestart = 40;
int RPC_ConnectionRejected = 130;
int RPC_ClientMessage = 93;
int RPC_WorldTime = 94;
int RPC_Pickup = 95;
int RPC_DestroyPickup = 63;
int RPC_DestroyWeaponPickup = 97;
int RPC_Weather = 152;
int RPC_SetTimeEx = 255;
int RPC_ToggleClock = 30;
int RPC_ServerCommand = 50;
int RPC_PickedUpPickup = 131;
int RPC_PickedUpWeapon = 255;
int RPC_VehicleDestroyed = 136;
int RPC_DialogResponse = 62;
int RPC_PlayAudioStream = 41;
int RPC_StopAudioStream = 42;
int RPC_ClickPlayer = 23;
int RPC_PlayerUpdate = 60;
int RPC_ClickTextDraw = 83;
int RPC_MapMarker = 119;
int RPC_PlayerGiveTakeDamage = 115; // bool Give/Take, playerid, amount, weaponid
int RPC_EnterEditObject = 27;
int RPC_EditObject = 117;
int RPC_ScrSetSpawnInfo = 68;
int RPC_ScrSetPlayerTeam = 69;
int RPC_ScrSetPlayerSkin = 153;
int RPC_ScrSetPlayerName = 11;
int RPC_ScrSetPlayerPos = 12;
int RPC_ScrSetPlayerPosFindZ = 13;
int RPC_ScrSetPlayerHealth = 14;
int RPC_ScrPutPlayerInVehicle = 70;
int RPC_ScrRemovePlayerFromVehicle = 71;
int RPC_ScrSetPlayerColor = 72;
int RPC_ScrDisplayGameText = 73;
int RPC_ScrSetInterior = 156;
int RPC_ScrSetCameraPos = 157;
int RPC_ScrSetCameraLookAt = 158;
int RPC_ScrSetVehiclePos = 159;
int RPC_ScrSetVehicleZAngle = 160;
int RPC_ScrVehicleParams = 161;
int RPC_ScrSetCameraBehindPlayer = 162;
int RPC_ScrTogglePlayerControllable = 15;
int RPC_ScrPlaySound = 16;
int RPC_ScrSetWorldBounds = 17;
int RPC_ScrHaveSomeMoney = 18;
int RPC_ScrSetPlayerFacingAngle = 19;
int RPC_ScrResetMoney = 20;
int RPC_ScrResetPlayerWeapons = 21;
int RPC_ScrGivePlayerWeapon = 22;
int RPC_ScrRespawnVehicle = 255;
int RPC_ScrLinkVehicle = 65;
int RPC_ScrSetPlayerArmour = 66;
int RPC_ScrDeathMessage = 55;
int RPC_ScrSetMapIcon = 56;
int RPC_ScrDisableMapIcon = 144;
int RPC_ScrSetWeaponAmmo = 145;
int RPC_ScrSetGravity = 146;
int RPC_ScrSetVehicleHealth = 147;
int RPC_ScrAttachTrailerToVehicle = 148;
int RPC_ScrDetachTrailerFromVehicle = 149;
int RPC_ScrCreateObject = 44;
int RPC_ScrSetObjectPos = 45;
int RPC_ScrSetObjectRotation = 46;
int RPC_ScrDestroyObject = 47;
int RPC_ScrCreateExplosion = 79;
int RPC_ScrShowNameTag = 80;
int RPC_ScrMoveObject = 99;
int RPC_ScrStopObject = 122;
int RPC_ScrNumberPlate = 123;
int RPC_ScrTogglePlayerSpectating = 124;
int RPC_ScrSetPlayerSpectating = 255;
int RPC_ScrPlayerSpectatePlayer = 126;
int RPC_ScrPlayerSpectateVehicle = 127;
int RPC_ScrRemoveComponent = 57;
int RPC_ScrForceSpawnSelection = 74;
int RPC_ScrAttachObjectToPlayer = 75;
int RPC_ScrInitMenu = 76;
int RPC_ScrShowMenu = 77;
int RPC_ScrHideMenu = 78;
int RPC_ScrSetPlayerWantedLevel = 133;
int RPC_ScrShowTextDraw = 134;
int RPC_ScrHideTextDraw = 135;
int RPC_ScrEditTextDraw = 105;
int RPC_ScrAddGangZone = 108;
int RPC_ScrRemoveGangZone = 120;
int RPC_ScrFlashGangZone = 121;
int RPC_ScrStopFlashGangZone = 85;
int RPC_ScrApplyAnimation = 86;
int RPC_ScrClearAnimations = 87;
int RPC_ScrSetSpecialAction = 88;
int RPC_ScrEnableStuntBonus = 104;
int RPC_ScrSetFightingStyle = 89;
int RPC_ScrSetPlayerVelocity = 90;
int RPC_ScrSetVehicleVelocity = 91;
int RPC_ScrToggleWidescreen = 255;
int RPC_ScrSetVehicleTireStatus = 255;
int RPC_ScrSetPlayerDrunkLevel = 35;
int RPC_ScrDialogBox = 61;
int RPC_ScrCreate3DTextLabel = 36;
Don't waste your time, this from raksamp:
Packet IDs: pawn Code:
pawn Code:
|
This looks like a great plugin, and I am really looking into it to replace the RNPC plugin! But, this would be even more great if it had a better documentation, I am not really clear of what we can achieve with this exactly, and a in-depth look on the functions would be awesome. This attracts a lot my attention and I am going to test it now to find out myself the limits of your work.
Nice job, you could do better in the documentation aspect though. |
Yes, I am very sure, and if you think what I'm talking about is incorrect then you're in complete freedom to correct me, but if not so, mind your own business.
|
What? Are you sure that you know what you're talking about? lol
This plugin has nothing to do with NPC, its about RPC, Bitstreams etc, i think that the author should re-name the plugin to BitStream cause its the main purposal of it. Its not NPC's plugin, it just allow you to control a bit more of clients game. |