|
private |
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on server, RPC is executed on all clients.
target | object on which remote procedure is called, when NULL, RPC is evaluated by CGame as global |
rpc_type | user defined identification of RPC |
params | custom params array |
recipient | specified 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);
// or shortcut
GetGame().RPCSingleParam(player, RPC_LOW_BLOOD_PRESSURE_EFFECT, p);
...
// on client
class PlayerBase
{
// override OnRPC function
{
// 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 proto bool Read(void value_in) Result for an object found in CGame.IsBoxCollidingGeometryProxy. Определения IsBoxCollidingGeometryProxyClasses.c:28 proto native CGame GetGame() |
Используется в ContaminatedArea_Dynamic::EEOnCECreate(), ManBase::OnSelectPlayer(), ContaminatedArea_Dynamic::PlayFX(), MissionBase::RandomArtillery(), IEntity::RPC() и SendRPC().