DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ RPC()

proto native void CGame::RPC ( Object target,
int rpcType,
notnull array< ref Param > params,
bool guaranteed,
PlayerIdentity recipient = null )
private

Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on server, RPC is executed on all clients.

Аргументы
targetobject on which remote procedure is called, when NULL, RPC is evaluated by CGame as global
rpc_typeuser defined identification of RPC
paramscustom params array
recipientspecified client to send RPC to. If NULL, RPC will be send to all clients (specifying recipient increase security and decrease network traffic)
const int RPC_LOW_BLOOD_PRESSURE_EFFECT = 0;
...
// on server side, after blood pressure of player is low...
Param1<float> p = new Param1<float>(m_blood_pressure);
params.Insert(p);
GetGame().RPC(player, RPC_LOW_BLOOD_PRESSURE_EFFECT, params);
// or shortcut
GetGame().RPCSingleParam(player, RPC_LOW_BLOOD_PRESSURE_EFFECT, p);
...
// on client
{
// override OnRPC function
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
{
// dont forget to propagate this call trough class hierarchy!
super.OnRPC(rpc_type, ctx);
switch(rpc_type)
{
case RPC_LOW_BLOOD_PRESSURE_EFFECT:
Param1<float> p = Param1<float>(0);
if (ctx.Read(p))
{
float blood_pressure = p.param1;
float effect_intensity = 1.0 - blood_pressure;
ShowFancyScreenEffect(effect_intensity);
}
break;
}
}
}
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
proto native void RPC(Object target, int rpcType, notnull array< ref Param > params, bool guaranteed, PlayerIdentity recipient=null)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
override void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
Определения DayZGame.c:3012
Определения PlayerBaseClient.c:2
The class that will be instanced (moddable)
Определения gameplay.c:389
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()

Используется в ContaminatedArea_Dynamic::EEOnCECreate(), ManBase::OnSelectPlayer(), ContaminatedArea_Dynamic::PlayFX(), MissionBase::RandomArtillery(), IEntity::RPC() и SendRPC().