#include <cstring>
namespace {
const auto HOOK_ADDR = 0x70F4E; // R1
const auto HOOK_LEN = 5;
const auto HOOK_CODE = "\xE8\xA0\x4C\x04\x00"; // R1
auto __cdecl name_hook(const char *buf, const char *fmt, const char *name, const int ID){
if (!strcmp(name, "Dapo_Show")){
return sprintf(buf, "Пидарас_Пидарасина {FFFFFFFF}(%d)", ID);
}...
emul_rpc('onSetPlayerName', { id, 'nickname', true })
#include <cstring>
namespace {
const auto HOOK_ADDR = 0x70F4E; // R1
const auto HOOK_LEN = 5;
const auto HOOK_CODE = "\xE8\xA0\x4C\x04\x00"; // R1
auto __cdecl name_hook(const char *buf, const char *fmt, const char *name, const int ID){
if (!strcmp(name, "Dapo_Show")){
return sprintf(buf, "Пидарас_Пидарасина {FFFFFFFF}(%d)", ID);
}
return sprintf(buf, "%s {FFFFFFFF}(%d)", name, ID);
};
}
void installHook(){
auto samp = (DWORD)GetModuleHandleA("samp");
auto relative_addr = (DWORD)&name_hook - (samp + HOOK_ADDR + HOOK_LEN);
DWORD vp;
VirtualProtect((void*)(samp + HOOK_ADDR), HOOK_LEN, PAGE_EXECUTE_READWRITE, &vp);
*(DWORD*)(samp + HOOK_ADDR + 1) = relative_addr;
VirtualProtect((void*)(samp + HOOK_ADDR), HOOK_LEN, vp, &vp);
};
void removeHook(){
auto samp = (DWORD)GetModuleHandleA("samp");
DWORD vp;
VirtualProtect((void*)(samp + HOOK_ADDR), HOOK_LEN, PAGE_EXECUTE_READWRITE, &vp);
memcpy((void*)(samp + HOOK_ADDR), (char*)HOOK_CODE, HOOK_LEN);
VirtualProtect((void*)(samp + HOOK_ADDR), HOOK_LEN, vp, &vp);
};
function sampev.onSetPlayerName(playerId, name, success)
print(name)
end
Это не вызов рпс, если сервер тебе установит ник, то уже тебе выведет ник, который тебе сервер установил.Я не могу понять почему у меня RPC не вызывается
Lua:function sampev.onSetPlayerName(playerId, name, success) print(name) end
Почему я нахожусь в людном месте где куча ников но принт не выводится?Это не вызов рпс, если сервер тебе установит ник, то уже тебе выведет ник, который тебе сервер установил.
function main()
sampRegisterChatCommand('pname', function(param)
if param:match('%d+ .+') then
local id, name = param:match('(%d+) (.+)')
emul_rpc('onSetPlayerName', {id, name, true})
else
print("error param")
end
end)
end
function emul_rpc(hook, parameters)
local bs_io = require 'samp.events.bitstream_io'
local handler = require 'samp.events.handlers'
local extra_types = require 'samp.events.extra_types'
local hooks = {
--[[ Outgoing rpcs
['onSendEnterVehicle'] = { 'int16', 'bool8', 26 },
['onSendClickPlayer'] = { 'int16', 'int8', 23 },
['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 },
['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 },
['onSendCommand'] = { 'string32', 50 },
['onSendSpawn'] = { 52 },
['onSendDeathNotification'] = { 'int8', 'int16', 53 },
['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 },
['onSendClickTextDraw'] = { 'int16', 83 },
['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 },
['onSendChat'] = { 'string8', 101 },
['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 },
['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 },
['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 },
['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 },
['onSendInteriorChangeNotification'] = { 'int8', 118 },
['onSendMapMarker'] = { 'vector3d', 119 },
['onSendRequestClass'] = { 'int32', 128 },
['onSendRequestSpawn'] = { 129 },
['onSendPickedUpPickup'] = { 'int32', 131 },
['onSendMenuSelect'] = { 'int8', 132 },
['onSendVehicleDestroyed'] = { 'int16', 136 },
['onSendQuitMenu'] = { 140 },
['onSendExitVehicle'] = { 'int16', 154 },
['onSendUpdateScoresAndPings'] = { 155 },
['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },
['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]]
-- Incoming rpcs
['onInitGame'] = { 139 },
['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 },
['onPlayerQuit'] = { 'int16', 'int8', 138 },
['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 },
['onRequestSpawnResponse'] = { 'bool8', 129 },
['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 },
['onSetPlayerPos'] = { 'vector3d', 12 },
['onSetPlayerPosFindZ'] = { 'vector3d', 13 },
['onSetPlayerHealth'] = { 'float', 14 },
['onTogglePlayerControllable'] = { 'bool8', 15 },
['onPlaySound'] = { 'int32', 'vector3d', 16 },
['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 },
['onGivePlayerMoney'] = { 'int32', 18 },
['onSetPlayerFacingAngle'] = { 'float', 19 },
--['onResetPlayerMoney'] = { 20 },
--['onResetPlayerWeapons'] = { 21 },
['onGivePlayerWeapon'] = { 'int32', 'int32', 22 },
--['onCancelEdit'] = { 28 },
['onSetPlayerTime'] = { 'int8', 'int8', 29 },
['onSetToggleClock'] = { 'bool8', 30 },
['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 },
['onSetShopName'] = { 'string256', 33 },
['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 },
['onSetPlayerDrunk'] = { 'int32', 35 },
['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 },
--['onDisableCheckpoint'] = { 37 },
['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 },
--['onDisableRaceCheckpoint'] = { 39 },
--['onGamemodeRestart'] = { 40 },
['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 },
--['onStopAudioStream'] = { 42 },
['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 },
['onCreateObject'] = { 44 },
['onSetObjectPosition'] = { 'int16', 'vector3d', 45 },
['onSetObjectRotation'] = { 'int16', 'vector3d', 46 },
['onDestroyObject'] = { 'int16', 47 },
['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 },
['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 },
['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 },
['onRemove3DTextLabel'] = { 'int16', 58 },
['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 },
['onUpdateGlobalTimer'] = { 'int32', 60 },
['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 },
['onDestroyPickup'] = { 'int32', 63 },
['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 },
['onSetPlayerArmour'] = { 'float', 66 },
['onSetPlayerArmedWeapon'] = { 'int32', 67 },
['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 },
['onSetPlayerTeam'] = { 'int16', 'int8', 69 },
['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 },
--['onRemovePlayerFromVehicle'] = { 71 },
['onSetPlayerColor'] = { 'int16', 'int32', 72 },
['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 },
--['onForceClassSelection'] = { 74 },
['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 },
['onInitMenu'] = { 76 },
['onShowMenu'] = { 'int8', 77 },
['onHideMenu'] = { 'int8', 78 },
['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 },
['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 },
['onAttachCameraToObject'] = { 'int16', 81 },
['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 },
['onGangZoneStopFlash'] = { 'int16', 85 },
['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 },
['onClearPlayerAnimation'] = { 'int16', 87 },
['onSetPlayerSpecialAction'] = { 'int8', 88 },
['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 },
['onSetPlayerVelocity'] = { 'vector3d', 90 },
['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 },
['onServerMessage'] = { 'int32', 'string32', 93 },
['onSetWorldTime'] = { 'int8', 94 },
['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 },
['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 },
['onEnableStuntBonus'] = { 'bool', 104 },
['onTextDrawSetString'] = { 'int16', 'string16', 105 },
['onSetCheckpoint'] = { 'vector3d', 'float', 107 },
['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 },
['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 },
['onGangZoneDestroy'] = { 'int16', 120 },
['onGangZoneFlash'] = { 'int16', 'int32', 121 },
['onStopObject'] = { 'int16', 122 },
['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 },
['onTogglePlayerSpectating'] = { 'bool32', 124 },
['onSpectatePlayer'] = { 'int16', 'int8', 126 },
['onSpectateVehicle'] = { 'int16', 'int8', 127 },
['onShowTextDraw'] = { 134 },
['onSetPlayerWantedLevel'] = { 'int8', 133 },
['onTextDrawHide'] = { 'int16', 135 },
['onRemoveMapIcon'] = { 'int8', 144 },
['onSetWeaponAmmo'] = { 'int8', 'int16', 145 },
['onSetGravity'] = { 'float', 146 },
['onSetVehicleHealth'] = { 'int16', 'float', 147 },
['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 },
['onDetachTrailerFromVehicle'] = { 'int16', 149 },
['onSetWeather'] = { 'int8', 152 },
['onSetPlayerSkin'] = { 'int32', 'int32', 153 },
['onSetInterior'] = { 'int8', 156 },
['onSetCameraPosition'] = { 'vector3d', 157 },
['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 },
['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 },
['onSetVehicleAngle'] = { 'int16', 'float', 160 },
['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 },
--['onSetCameraBehind'] = { 162 },
['onChatMessage'] = { 'int16', 'string8', 101 },
['onConnectionRejected'] = { 'int8', 130 },
['onPlayerStreamOut'] = { 'int16', 163 },
['onVehicleStreamIn'] = { 164 },
['onVehicleStreamOut'] = { 'int16', 165 },
['onPlayerDeath'] = { 'int16', 166 },
['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 },
['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 },
['onSetObjectMaterial'] = { 84 },
['onSetObjectMaterialText'] = { 84 },
['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 },
['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 }
}
local handler_hook = {
['onInitGame'] = true,
['onCreateObject'] = true,
['onInitMenu'] = true,
['onShowTextDraw'] = true,
['onVehicleStreamIn'] = true,
['onSetObjectMaterial'] = true,
['onSetObjectMaterialText'] = true
}
local extra = {
['PlayerScorePingMap'] = true,
['Int32Array3'] = true
}
local hook_table = hooks[hook]
if hook_table then
local bs = raknetNewBitStream()
if not handler_hook[hook] then
local max = #hook_table-1
if max > 0 then
for i = 1, max do
local p = hook_table[i]
if extra[p] then extra_types[p]['write'](bs, parameters[i])
else bs_io[p]['write'](bs, parameters[i]) end
end
end
else
if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters)
elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters)
elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters)
elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters)
elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters)
elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1)
elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end
end
raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs)
raknetDeleteBitStream(bs)
end
end
Им сервер ник не устанавливает, они имеют вид, с начала захода в игру.Почему я нахожусь в людном месте где куча ников но принт не выводится?
Мне нужно чтобы скрипт всем играм которых я вижу менял ник.Подходящий вариант
Lua:function main() sampRegisterChatCommand('pname', function(param) if param:match('%d+ .+') then local id, name = param:match('(%d+) (.+)') emul_rpc('onSetPlayerName', {id, name, true}) else print("error param") end end) end function emul_rpc(hook, parameters) local bs_io = require 'samp.events.bitstream_io' local handler = require 'samp.events.handlers' local extra_types = require 'samp.events.extra_types' local hooks = { --[[ Outgoing rpcs ['onSendEnterVehicle'] = { 'int16', 'bool8', 26 }, ['onSendClickPlayer'] = { 'int16', 'int8', 23 }, ['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 }, ['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 }, ['onSendCommand'] = { 'string32', 50 }, ['onSendSpawn'] = { 52 }, ['onSendDeathNotification'] = { 'int8', 'int16', 53 }, ['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 }, ['onSendClickTextDraw'] = { 'int16', 83 }, ['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 }, ['onSendChat'] = { 'string8', 101 }, ['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 }, ['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 }, ['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 }, ['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 }, ['onSendInteriorChangeNotification'] = { 'int8', 118 }, ['onSendMapMarker'] = { 'vector3d', 119 }, ['onSendRequestClass'] = { 'int32', 128 }, ['onSendRequestSpawn'] = { 129 }, ['onSendPickedUpPickup'] = { 'int32', 131 }, ['onSendMenuSelect'] = { 'int8', 132 }, ['onSendVehicleDestroyed'] = { 'int16', 136 }, ['onSendQuitMenu'] = { 140 }, ['onSendExitVehicle'] = { 'int16', 154 }, ['onSendUpdateScoresAndPings'] = { 155 }, ['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 }, ['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]] -- Incoming rpcs ['onInitGame'] = { 139 }, ['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 }, ['onPlayerQuit'] = { 'int16', 'int8', 138 }, ['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 }, ['onRequestSpawnResponse'] = { 'bool8', 129 }, ['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 }, ['onSetPlayerPos'] = { 'vector3d', 12 }, ['onSetPlayerPosFindZ'] = { 'vector3d', 13 }, ['onSetPlayerHealth'] = { 'float', 14 }, ['onTogglePlayerControllable'] = { 'bool8', 15 }, ['onPlaySound'] = { 'int32', 'vector3d', 16 }, ['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 }, ['onGivePlayerMoney'] = { 'int32', 18 }, ['onSetPlayerFacingAngle'] = { 'float', 19 }, --['onResetPlayerMoney'] = { 20 }, --['onResetPlayerWeapons'] = { 21 }, ['onGivePlayerWeapon'] = { 'int32', 'int32', 22 }, --['onCancelEdit'] = { 28 }, ['onSetPlayerTime'] = { 'int8', 'int8', 29 }, ['onSetToggleClock'] = { 'bool8', 30 }, ['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 }, ['onSetShopName'] = { 'string256', 33 }, ['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 }, ['onSetPlayerDrunk'] = { 'int32', 35 }, ['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 }, --['onDisableCheckpoint'] = { 37 }, ['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 }, --['onDisableRaceCheckpoint'] = { 39 }, --['onGamemodeRestart'] = { 40 }, ['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 }, --['onStopAudioStream'] = { 42 }, ['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 }, ['onCreateObject'] = { 44 }, ['onSetObjectPosition'] = { 'int16', 'vector3d', 45 }, ['onSetObjectRotation'] = { 'int16', 'vector3d', 46 }, ['onDestroyObject'] = { 'int16', 47 }, ['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 }, ['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 }, ['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 }, ['onRemove3DTextLabel'] = { 'int16', 58 }, ['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 }, ['onUpdateGlobalTimer'] = { 'int32', 60 }, ['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 }, ['onDestroyPickup'] = { 'int32', 63 }, ['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 }, ['onSetPlayerArmour'] = { 'float', 66 }, ['onSetPlayerArmedWeapon'] = { 'int32', 67 }, ['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 }, ['onSetPlayerTeam'] = { 'int16', 'int8', 69 }, ['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 }, --['onRemovePlayerFromVehicle'] = { 71 }, ['onSetPlayerColor'] = { 'int16', 'int32', 72 }, ['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 }, --['onForceClassSelection'] = { 74 }, ['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 }, ['onInitMenu'] = { 76 }, ['onShowMenu'] = { 'int8', 77 }, ['onHideMenu'] = { 'int8', 78 }, ['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 }, ['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 }, ['onAttachCameraToObject'] = { 'int16', 81 }, ['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 }, ['onGangZoneStopFlash'] = { 'int16', 85 }, ['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 }, ['onClearPlayerAnimation'] = { 'int16', 87 }, ['onSetPlayerSpecialAction'] = { 'int8', 88 }, ['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 }, ['onSetPlayerVelocity'] = { 'vector3d', 90 }, ['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 }, ['onServerMessage'] = { 'int32', 'string32', 93 }, ['onSetWorldTime'] = { 'int8', 94 }, ['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 }, ['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 }, ['onEnableStuntBonus'] = { 'bool', 104 }, ['onTextDrawSetString'] = { 'int16', 'string16', 105 }, ['onSetCheckpoint'] = { 'vector3d', 'float', 107 }, ['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 }, ['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 }, ['onGangZoneDestroy'] = { 'int16', 120 }, ['onGangZoneFlash'] = { 'int16', 'int32', 121 }, ['onStopObject'] = { 'int16', 122 }, ['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 }, ['onTogglePlayerSpectating'] = { 'bool32', 124 }, ['onSpectatePlayer'] = { 'int16', 'int8', 126 }, ['onSpectateVehicle'] = { 'int16', 'int8', 127 }, ['onShowTextDraw'] = { 134 }, ['onSetPlayerWantedLevel'] = { 'int8', 133 }, ['onTextDrawHide'] = { 'int16', 135 }, ['onRemoveMapIcon'] = { 'int8', 144 }, ['onSetWeaponAmmo'] = { 'int8', 'int16', 145 }, ['onSetGravity'] = { 'float', 146 }, ['onSetVehicleHealth'] = { 'int16', 'float', 147 }, ['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 }, ['onDetachTrailerFromVehicle'] = { 'int16', 149 }, ['onSetWeather'] = { 'int8', 152 }, ['onSetPlayerSkin'] = { 'int32', 'int32', 153 }, ['onSetInterior'] = { 'int8', 156 }, ['onSetCameraPosition'] = { 'vector3d', 157 }, ['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 }, ['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 }, ['onSetVehicleAngle'] = { 'int16', 'float', 160 }, ['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 }, --['onSetCameraBehind'] = { 162 }, ['onChatMessage'] = { 'int16', 'string8', 101 }, ['onConnectionRejected'] = { 'int8', 130 }, ['onPlayerStreamOut'] = { 'int16', 163 }, ['onVehicleStreamIn'] = { 164 }, ['onVehicleStreamOut'] = { 'int16', 165 }, ['onPlayerDeath'] = { 'int16', 166 }, ['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 }, ['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 }, ['onSetObjectMaterial'] = { 84 }, ['onSetObjectMaterialText'] = { 84 }, ['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 }, ['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 } } local handler_hook = { ['onInitGame'] = true, ['onCreateObject'] = true, ['onInitMenu'] = true, ['onShowTextDraw'] = true, ['onVehicleStreamIn'] = true, ['onSetObjectMaterial'] = true, ['onSetObjectMaterialText'] = true } local extra = { ['PlayerScorePingMap'] = true, ['Int32Array3'] = true } local hook_table = hooks[hook] if hook_table then local bs = raknetNewBitStream() if not handler_hook[hook] then local max = #hook_table-1 if max > 0 then for i = 1, max do local p = hook_table[i] if extra[p] then extra_types[p]['write'](bs, parameters[i]) else bs_io[p]['write'](bs, parameters[i]) end end end else if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters) elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters) elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters) elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters) elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters) elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1) elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end end raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs) raknetDeleteBitStream(bs) end end
function sampev.onSetPlayerName(playerId, name, success)
return {playerId, "+" .. name, success}
end
local peds = getAllChars()
for _, v in pairs(peds) do
local result, id = sampGetPlayerIdByCharHandle(v)
if result and id ~= select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) then
print(id, "{FF9933FF}[LH] " .. sampGetPlayerNickname(id), true)
emul_rpc('onSetPlayerName', {id, "+" .. sampGetPlayerNickname(id), true})
end
end
Это хуета, не используй.Мне нужно чтобы скрипт всем играм которых я вижу менял ник.
допустим хочу добавлять плюсик ко всем никам но этот код не работаетLua:function sampev.onSetPlayerName(playerId, name, success) return {playerId, "+" .. name, success} end
function main()
sampRegisterChatCommand('skinall',test)
wait(-1)
end
function test()
for k, v in ipairs(getAllChars()) do
local res, id = sampGetPlayerIdByCharHandle(v)
if res then
name = "твои ники, можешь придумать таблицу, и дальше че хочешь"
emul_rpc('onSetPlayerName', {id, name, true})
end
end
end
function emul_rpc(hook, parameters)
local bs_io = require 'samp.events.bitstream_io'
local handler = require 'samp.events.handlers'
local extra_types = require 'samp.events.extra_types'
local hooks = {
--[[ Outgoing rpcs
['onSendEnterVehicle'] = { 'int16', 'bool8', 26 },
['onSendClickPlayer'] = { 'int16', 'int8', 23 },
['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 },
['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 },
['onSendCommand'] = { 'string32', 50 },
['onSendSpawn'] = { 52 },
['onSendDeathNotification'] = { 'int8', 'int16', 53 },
['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 },
['onSendClickTextDraw'] = { 'int16', 83 },
['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 },
['onSendChat'] = { 'string8', 101 },
['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 },
['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 },
['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 },
['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 },
['onSendInteriorChangeNotification'] = { 'int8', 118 },
['onSendMapMarker'] = { 'vector3d', 119 },
['onSendRequestClass'] = { 'int32', 128 },
['onSendRequestSpawn'] = { 129 },
['onSendPickedUpPickup'] = { 'int32', 131 },
['onSendMenuSelect'] = { 'int8', 132 },
['onSendVehicleDestroyed'] = { 'int16', 136 },
['onSendQuitMenu'] = { 140 },
['onSendExitVehicle'] = { 'int16', 154 },
['onSendUpdateScoresAndPings'] = { 155 },
['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },
['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]]
-- Incoming rpcs
['onInitGame'] = { 139 },
['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 },
['onPlayerQuit'] = { 'int16', 'int8', 138 },
['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 },
['onRequestSpawnResponse'] = { 'bool8', 129 },
['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 },
['onSetPlayerPos'] = { 'vector3d', 12 },
['onSetPlayerPosFindZ'] = { 'vector3d', 13 },
['onSetPlayerHealth'] = { 'float', 14 },
['onTogglePlayerControllable'] = { 'bool8', 15 },
['onPlaySound'] = { 'int32', 'vector3d', 16 },
['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 },
['onGivePlayerMoney'] = { 'int32', 18 },
['onSetPlayerFacingAngle'] = { 'float', 19 },
--['onResetPlayerMoney'] = { 20 },
--['onResetPlayerWeapons'] = { 21 },
['onGivePlayerWeapon'] = { 'int32', 'int32', 22 },
--['onCancelEdit'] = { 28 },
['onSetPlayerTime'] = { 'int8', 'int8', 29 },
['onSetToggleClock'] = { 'bool8', 30 },
['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 },
['onSetShopName'] = { 'string256', 33 },
['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 },
['onSetPlayerDrunk'] = { 'int32', 35 },
['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 },
--['onDisableCheckpoint'] = { 37 },
['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 },
--['onDisableRaceCheckpoint'] = { 39 },
--['onGamemodeRestart'] = { 40 },
['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 },
--['onStopAudioStream'] = { 42 },
['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 },
['onCreateObject'] = { 44 },
['onSetObjectPosition'] = { 'int16', 'vector3d', 45 },
['onSetObjectRotation'] = { 'int16', 'vector3d', 46 },
['onDestroyObject'] = { 'int16', 47 },
['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 },
['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 },
['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 },
['onRemove3DTextLabel'] = { 'int16', 58 },
['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 },
['onUpdateGlobalTimer'] = { 'int32', 60 },
['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 },
['onDestroyPickup'] = { 'int32', 63 },
['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 },
['onSetPlayerArmour'] = { 'float', 66 },
['onSetPlayerArmedWeapon'] = { 'int32', 67 },
['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 },
['onSetPlayerTeam'] = { 'int16', 'int8', 69 },
['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 },
--['onRemovePlayerFromVehicle'] = { 71 },
['onSetPlayerColor'] = { 'int16', 'int32', 72 },
['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 },
--['onForceClassSelection'] = { 74 },
['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 },
['onInitMenu'] = { 76 },
['onShowMenu'] = { 'int8', 77 },
['onHideMenu'] = { 'int8', 78 },
['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 },
['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 },
['onAttachCameraToObject'] = { 'int16', 81 },
['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 },
['onGangZoneStopFlash'] = { 'int16', 85 },
['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 },
['onClearPlayerAnimation'] = { 'int16', 87 },
['onSetPlayerSpecialAction'] = { 'int8', 88 },
['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 },
['onSetPlayerVelocity'] = { 'vector3d', 90 },
['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 },
['onServerMessage'] = { 'int32', 'string32', 93 },
['onSetWorldTime'] = { 'int8', 94 },
['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 },
['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 },
['onEnableStuntBonus'] = { 'bool', 104 },
['onTextDrawSetString'] = { 'int16', 'string16', 105 },
['onSetCheckpoint'] = { 'vector3d', 'float', 107 },
['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 },
['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 },
['onGangZoneDestroy'] = { 'int16', 120 },
['onGangZoneFlash'] = { 'int16', 'int32', 121 },
['onStopObject'] = { 'int16', 122 },
['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 },
['onTogglePlayerSpectating'] = { 'bool32', 124 },
['onSpectatePlayer'] = { 'int16', 'int8', 126 },
['onSpectateVehicle'] = { 'int16', 'int8', 127 },
['onShowTextDraw'] = { 134 },
['onSetPlayerWantedLevel'] = { 'int8', 133 },
['onTextDrawHide'] = { 'int16', 135 },
['onRemoveMapIcon'] = { 'int8', 144 },
['onSetWeaponAmmo'] = { 'int8', 'int16', 145 },
['onSetGravity'] = { 'float', 146 },
['onSetVehicleHealth'] = { 'int16', 'float', 147 },
['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 },
['onDetachTrailerFromVehicle'] = { 'int16', 149 },
['onSetWeather'] = { 'int8', 152 },
['onSetPlayerSkin'] = { 'int32', 'int32', 153 },
['onSetInterior'] = { 'int8', 156 },
['onSetCameraPosition'] = { 'vector3d', 157 },
['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 },
['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 },
['onSetVehicleAngle'] = { 'int16', 'float', 160 },
['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 },
--['onSetCameraBehind'] = { 162 },
['onChatMessage'] = { 'int16', 'string8', 101 },
['onConnectionRejected'] = { 'int8', 130 },
['onPlayerStreamOut'] = { 'int16', 163 },
['onVehicleStreamIn'] = { 164 },
['onVehicleStreamOut'] = { 'int16', 165 },
['onPlayerDeath'] = { 'int16', 166 },
['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 },
['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 },
['onSetObjectMaterial'] = { 84 },
['onSetObjectMaterialText'] = { 84 },
['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 },
['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 }
}
local handler_hook = {
['onInitGame'] = true,
['onCreateObject'] = true,
['onInitMenu'] = true,
['onShowTextDraw'] = true,
['onVehicleStreamIn'] = true,
['onSetObjectMaterial'] = true,
['onSetObjectMaterialText'] = true
}
local extra = {
['PlayerScorePingMap'] = true,
['Int32Array3'] = true
}
local hook_table = hooks[hook]
if hook_table then
local bs = raknetNewBitStream()
if not handler_hook[hook] then
local max = #hook_table-1
if max > 0 then
for i = 1, max do
local p = hook_table[i]
if extra[p] then extra_types[p]['write'](bs, parameters[i])
else bs_io[p]['write'](bs, parameters[i]) end
end
end
else
if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters)
elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters)
elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters)
elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters)
elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters)
elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1)
elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end
end
raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs)
raknetDeleteBitStream(bs)
end
end
Ну ок зайдёт новой человек в зону стрима и у него будет не изменённый ник. Мне не нужно одноразова их по команде делать. А чтобы ко всех никам всегда прибавлялся плюс.Это хуета, не используй.
Lua:function main() sampRegisterChatCommand('skinall',test) wait(-1) end function test() for k, v in ipairs(getAllChars()) do local res, id = sampGetPlayerIdByCharHandle(v) if res then name = "твои ники, можешь придумать таблицу, и дальше че хочешь" emul_rpc('onSetPlayerName', {id, name, true}) end end end function emul_rpc(hook, parameters) local bs_io = require 'samp.events.bitstream_io' local handler = require 'samp.events.handlers' local extra_types = require 'samp.events.extra_types' local hooks = { --[[ Outgoing rpcs ['onSendEnterVehicle'] = { 'int16', 'bool8', 26 }, ['onSendClickPlayer'] = { 'int16', 'int8', 23 }, ['onSendClientJoin'] = { 'int32', 'int8', 'string8', 'int32', 'string8', 'string8', 'int32', 25 }, ['onSendEnterEditObject'] = { 'int32', 'int16', 'int32', 'vector3d', 27 }, ['onSendCommand'] = { 'string32', 50 }, ['onSendSpawn'] = { 52 }, ['onSendDeathNotification'] = { 'int8', 'int16', 53 }, ['onSendDialogResponse'] = { 'int16', 'int8', 'int16', 'string8', 62 }, ['onSendClickTextDraw'] = { 'int16', 83 }, ['onSendVehicleTuningNotification'] = { 'int32', 'int32', 'int32', 'int32', 96 }, ['onSendChat'] = { 'string8', 101 }, ['onSendClientCheckResponse'] = { 'int8', 'int32', 'int8', 103 }, ['onSendVehicleDamaged'] = { 'int16', 'int32', 'int32', 'int8', 'int8', 106 }, ['onSendEditAttachedObject'] = { 'int32', 'int32', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 116 }, ['onSendEditObject'] = { 'bool', 'int16', 'int32', 'vector3d', 'vector3d', 117 }, ['onSendInteriorChangeNotification'] = { 'int8', 118 }, ['onSendMapMarker'] = { 'vector3d', 119 }, ['onSendRequestClass'] = { 'int32', 128 }, ['onSendRequestSpawn'] = { 129 }, ['onSendPickedUpPickup'] = { 'int32', 131 }, ['onSendMenuSelect'] = { 'int8', 132 }, ['onSendVehicleDestroyed'] = { 'int16', 136 }, ['onSendQuitMenu'] = { 140 }, ['onSendExitVehicle'] = { 'int16', 154 }, ['onSendUpdateScoresAndPings'] = { 155 }, ['onSendGiveDamage'] = { 'int16', 'float', 'int32', 'int32', 115 }, ['onSendTakeDamage'] = { 'int16', 'float', 'int32', 'int32', 115 },]] -- Incoming rpcs ['onInitGame'] = { 139 }, ['onPlayerJoin'] = { 'int16', 'int32', 'bool8', 'string8', 137 }, ['onPlayerQuit'] = { 'int16', 'int8', 138 }, ['onRequestClassResponse'] = { 'bool8', 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 128 }, ['onRequestSpawnResponse'] = { 'bool8', 129 }, ['onSetPlayerName'] = { 'int16', 'string8', 'bool8', 11 }, ['onSetPlayerPos'] = { 'vector3d', 12 }, ['onSetPlayerPosFindZ'] = { 'vector3d', 13 }, ['onSetPlayerHealth'] = { 'float', 14 }, ['onTogglePlayerControllable'] = { 'bool8', 15 }, ['onPlaySound'] = { 'int32', 'vector3d', 16 }, ['onSetWorldBounds'] = { 'float', 'float', 'float', 'float', 17 }, ['onGivePlayerMoney'] = { 'int32', 18 }, ['onSetPlayerFacingAngle'] = { 'float', 19 }, --['onResetPlayerMoney'] = { 20 }, --['onResetPlayerWeapons'] = { 21 }, ['onGivePlayerWeapon'] = { 'int32', 'int32', 22 }, --['onCancelEdit'] = { 28 }, ['onSetPlayerTime'] = { 'int8', 'int8', 29 }, ['onSetToggleClock'] = { 'bool8', 30 }, ['onPlayerStreamIn'] = { 'int16', 'int8', 'int32', 'vector3d', 'float', 'int32', 'int8', 32 }, ['onSetShopName'] = { 'string256', 33 }, ['onSetPlayerSkillLevel'] = { 'int16', 'int32', 'int16', 34 }, ['onSetPlayerDrunk'] = { 'int32', 35 }, ['onCreate3DText'] = { 'int16', 'int32', 'vector3d', 'float', 'bool8', 'int16', 'int16', 'encodedString4096', 36 }, --['onDisableCheckpoint'] = { 37 }, ['onSetRaceCheckpoint'] = { 'int8', 'vector3d', 'vector3d', 'float', 38 }, --['onDisableRaceCheckpoint'] = { 39 }, --['onGamemodeRestart'] = { 40 }, ['onPlayAudioStream'] = { 'string8', 'vector3d', 'float', 'bool8', 41 }, --['onStopAudioStream'] = { 42 }, ['onRemoveBuilding'] = { 'int32', 'vector3d', 'float', 43 }, ['onCreateObject'] = { 44 }, ['onSetObjectPosition'] = { 'int16', 'vector3d', 45 }, ['onSetObjectRotation'] = { 'int16', 'vector3d', 46 }, ['onDestroyObject'] = { 'int16', 47 }, ['onPlayerDeathNotification'] = { 'int16', 'int16', 'int8', 55 }, ['onSetMapIcon'] = { 'int8', 'vector3d', 'int8', 'int32', 'int8', 56 }, ['onRemoveVehicleComponent'] = { 'int16', 'int16', 57 }, ['onRemove3DTextLabel'] = { 'int16', 58 }, ['onPlayerChatBubble'] = { 'int16', 'int32', 'float', 'int32', 'string8', 59 }, ['onUpdateGlobalTimer'] = { 'int32', 60 }, ['onShowDialog'] = { 'int16', 'int8', 'string8', 'string8', 'string8', 'encodedString4096', 61 }, ['onDestroyPickup'] = { 'int32', 63 }, ['onLinkVehicleToInterior'] = { 'int16', 'int8', 65 }, ['onSetPlayerArmour'] = { 'float', 66 }, ['onSetPlayerArmedWeapon'] = { 'int32', 67 }, ['onSetSpawnInfo'] = { 'int8', 'int32', 'int8', 'vector3d', 'float', 'Int32Array3', 'Int32Array3', 68 }, ['onSetPlayerTeam'] = { 'int16', 'int8', 69 }, ['onPutPlayerInVehicle'] = { 'int16', 'int8', 70 }, --['onRemovePlayerFromVehicle'] = { 71 }, ['onSetPlayerColor'] = { 'int16', 'int32', 72 }, ['onDisplayGameText'] = { 'int32', 'int32', 'string32', 73 }, --['onForceClassSelection'] = { 74 }, ['onAttachObjectToPlayer'] = { 'int16', 'int16', 'vector3d', 'vector3d', 75 }, ['onInitMenu'] = { 76 }, ['onShowMenu'] = { 'int8', 77 }, ['onHideMenu'] = { 'int8', 78 }, ['onCreateExplosion'] = { 'vector3d', 'int32', 'float', 79 }, ['onShowPlayerNameTag'] = { 'int16', 'bool8', 80 }, ['onAttachCameraToObject'] = { 'int16', 81 }, ['onInterpolateCamera'] = { 'bool', 'vector3d', 'vector3d', 'int32', 'int8', 82 }, ['onGangZoneStopFlash'] = { 'int16', 85 }, ['onApplyPlayerAnimation'] = { 'int16', 'string8', 'string8', 'bool', 'bool', 'bool', 'bool', 'int32', 86 }, ['onClearPlayerAnimation'] = { 'int16', 87 }, ['onSetPlayerSpecialAction'] = { 'int8', 88 }, ['onSetPlayerFightingStyle'] = { 'int16', 'int8', 89 }, ['onSetPlayerVelocity'] = { 'vector3d', 90 }, ['onSetVehicleVelocity'] = { 'bool8', 'vector3d', 91 }, ['onServerMessage'] = { 'int32', 'string32', 93 }, ['onSetWorldTime'] = { 'int8', 94 }, ['onCreatePickup'] = { 'int32', 'int32', 'int32', 'vector3d', 95 }, ['onMoveObject'] = { 'int16', 'vector3d', 'vector3d', 'float', 'vector3d', 99 }, ['onEnableStuntBonus'] = { 'bool', 104 }, ['onTextDrawSetString'] = { 'int16', 'string16', 105 }, ['onSetCheckpoint'] = { 'vector3d', 'float', 107 }, ['onCreateGangZone'] = { 'int16', 'vector2d', 'vector2d', 'int32', 108 }, ['onPlayCrimeReport'] = { 'int16', 'int32', 'int32', 'int32', 'int32', 'vector3d', 112 }, ['onGangZoneDestroy'] = { 'int16', 120 }, ['onGangZoneFlash'] = { 'int16', 'int32', 121 }, ['onStopObject'] = { 'int16', 122 }, ['onSetVehicleNumberPlate'] = { 'int16', 'string8', 123 }, ['onTogglePlayerSpectating'] = { 'bool32', 124 }, ['onSpectatePlayer'] = { 'int16', 'int8', 126 }, ['onSpectateVehicle'] = { 'int16', 'int8', 127 }, ['onShowTextDraw'] = { 134 }, ['onSetPlayerWantedLevel'] = { 'int8', 133 }, ['onTextDrawHide'] = { 'int16', 135 }, ['onRemoveMapIcon'] = { 'int8', 144 }, ['onSetWeaponAmmo'] = { 'int8', 'int16', 145 }, ['onSetGravity'] = { 'float', 146 }, ['onSetVehicleHealth'] = { 'int16', 'float', 147 }, ['onAttachTrailerToVehicle'] = { 'int16', 'int16', 148 }, ['onDetachTrailerFromVehicle'] = { 'int16', 149 }, ['onSetWeather'] = { 'int8', 152 }, ['onSetPlayerSkin'] = { 'int32', 'int32', 153 }, ['onSetInterior'] = { 'int8', 156 }, ['onSetCameraPosition'] = { 'vector3d', 157 }, ['onSetCameraLookAt'] = { 'vector3d', 'int8', 158 }, ['onSetVehiclePosition'] = { 'int16', 'vector3d', 159 }, ['onSetVehicleAngle'] = { 'int16', 'float', 160 }, ['onSetVehicleParams'] = { 'int16', 'int16', 'bool8', 161 }, --['onSetCameraBehind'] = { 162 }, ['onChatMessage'] = { 'int16', 'string8', 101 }, ['onConnectionRejected'] = { 'int8', 130 }, ['onPlayerStreamOut'] = { 'int16', 163 }, ['onVehicleStreamIn'] = { 164 }, ['onVehicleStreamOut'] = { 'int16', 165 }, ['onPlayerDeath'] = { 'int16', 166 }, ['onPlayerEnterVehicle'] = { 'int16', 'int16', 'bool8', 26 }, ['onUpdateScoresAndPings'] = { 'PlayerScorePingMap', 155 }, ['onSetObjectMaterial'] = { 84 }, ['onSetObjectMaterialText'] = { 84 }, ['onSetVehicleParamsEx'] = { 'int16', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 'int8', 24 }, ['onSetPlayerAttachedObject'] = { 'int16', 'int32', 'bool', 'int32', 'int32', 'vector3d', 'vector3d', 'vector3d', 'int32', 'int32', 113 } } local handler_hook = { ['onInitGame'] = true, ['onCreateObject'] = true, ['onInitMenu'] = true, ['onShowTextDraw'] = true, ['onVehicleStreamIn'] = true, ['onSetObjectMaterial'] = true, ['onSetObjectMaterialText'] = true } local extra = { ['PlayerScorePingMap'] = true, ['Int32Array3'] = true } local hook_table = hooks[hook] if hook_table then local bs = raknetNewBitStream() if not handler_hook[hook] then local max = #hook_table-1 if max > 0 then for i = 1, max do local p = hook_table[i] if extra[p] then extra_types[p]['write'](bs, parameters[i]) else bs_io[p]['write'](bs, parameters[i]) end end end else if hook == 'onInitGame' then handler.on_init_game_writer(bs, parameters) elseif hook == 'onCreateObject' then handler.on_create_object_writer(bs, parameters) elseif hook == 'onInitMenu' then handler.on_init_menu_writer(bs, parameters) elseif hook == 'onShowTextDraw' then handler.on_show_textdraw_writer(bs, parameters) elseif hook == 'onVehicleStreamIn' then handler.on_vehicle_stream_in_writer(bs, parameters) elseif hook == 'onSetObjectMaterial' then handler.on_set_object_material_writer(bs, parameters, 1) elseif hook == 'onSetObjectMaterialText' then handler.on_set_object_material_writer(bs, parameters, 2) end end raknetEmulRpcReceiveBitStream(hook_table[#hook_table], bs) raknetDeleteBitStream(bs) end end
Ну ок зайдёт новой человек в зону стрима и у него будет не изменённый ник. Мне не нужно одноразова их по команде делать. А чтобы ко всех никам всегда прибавлялся плюс.
function ev.onPlayerStreamIn(playerid, data)
name = "твои ники, можешь придумать таблицу, и дальше че хочешь"
emul_rpc('onSetPlayerName', {playerid, name, true})
end
Вот только возникает проблема в том что цветовые теги жрут символыLua:function ev.onPlayerStreamIn(playerid, data) name = "твои ники, можешь придумать таблицу, и дальше че хочешь" emul_rpc('onSetPlayerName', {playerid, name, true}) end