20.01.2014, 05:46
(
Последний раз редактировалось CuervO; 20.01.2014 в 08:35.
)
Alright, while testing and playing around with the functions on my TF gamemode I've noticed that a feature stopped working.
I emulate the spies TF2's invisibility by returning 0 at onplayerupdate, the following code seems to do the trick very well:
Now what happens is that while on the invisibility state, OnPlayerWeaponShot seems to ignore completely the player who is not being updated to the server, which actually makes sense. However, all other sources of damage apart from those called at OnPlayerWeaponShot do work and the "invisible" player receives the damage via the OnPlayerTakeDamage callback.
Video: [ame]http://www.youtube.com/watch?v=-w1fgPlzZ9g[/ame]
(Not of my authority)
You can see in the video that once he goes invisible, I proceed to shot and none impact on him. OnPlayerWeaponShot is called as hittype 0 and impacts are on the ground behind him; however when I test with my knife OnPlayerTakeDamage is called perfectly and I'm able to kill him. He's invisible for me in my client:
This worked perfectly in 0.3x since OnPlayerTakeDamage was called every time an invisible player would see other clients hitting him, even when desynced by the effect of the OnPlayerUpdate.
Would this be an intended feature that came with the Lagshot fixes? Wouldn't this also mean that lagshot fixes are not reliable on melee/spray can/fire ex/etc since they are still open to desync issues such as the one I created? Since technically the player is desynced, however his packets are still being sent to the server, why wouldn't OnPlayerWeaponShot while OnPlayerTakeDamage does?
I emulate the spies TF2's invisibility by returning 0 at onplayerupdate, the following code seems to do the trick very well:
pawn Код:
forward InvisibilityVar(playerid);
public InvisibilityVar(playerid)
{
//SafeSetPlayerPos(playerid, 0,0,0);
invisible[playerid] = 1;
UpdateAllPlayers();
//UpdateAllPlayers();
SetPVarInt(playerid,"PreInvisStep",2);
SetTimerEx("MakeInvisible",GetPlayerPing(playerid)+250, false, "ii", playerid, 1);
return 1;
}
forward MakeInvisible(playerid, in);
public MakeInvisible(playerid, in)
{
if(in == 1)
{
if(GetPlayerHealthEx(playerid) <= 0)
return 1;
InvisibleBlink(playerid);
TogglePlayerControllable(playerid,false);
if(GetPVarInt(playerid, "PreInvisStep") == 0)
{
new Float:Float[3];
GetPlayerPos(playerid, Float[0],Float[1],Float[2]);
SetPVarFloat(playerid, "PreInvisX",Float[0]);
SetPVarFloat(playerid, "PreInvisY",Float[1]);
SetPVarFloat(playerid, "PreInvisZ",Float[2]);
SetPVarInt(playerid, "PreInvisStep", 1);
SafeSetPlayerPos(playerid, Float[0],Float[1],Float[2]-20.0);
UpdateAllPlayers();
SetTimerEx("InvisibilityVar",GetPlayerPing(playerid)+100,false,"i",playerid);
}
else if(GetPVarInt(playerid, "PreInvisStep") == 2)
{
//SetPlayerVirtualWorld(playerid, 0);
SetPVarInt(playerid,"Invisible",1);
TDBigInfo(playerid, "You're now invisible.");
KillTimer(invtimer[playerid]);
invtimer[playerid] = SetTimerEx("Invisibility",200,false,"ii",playerid,1);
TogglePlayerControllable(playerid,true);
SafeSetPlayerPos(playerid, GetPVarFloat(playerid,"PreInvisX"),GetPVarFloat(playerid,"PreInvisY"), GetPVarFloat(playerid,"PreInvisZ"));
}
return 1;
}
else
{
SetPVarInt(playerid,"Invisible",0);
TogglePlayerControllable(playerid,false);
invisible[playerid] = 0;
ClearAnimations(playerid);
TogglePlayerControllable(playerid,true);
InvisibleBlink(playerid);
TDBigInfo(playerid, "You're no longer invisible.");
SetPVarInt(playerid, "PreInvisStep",0);
KillTimer(invtimer[playerid]);
invtimer[playerid] = SetTimerEx("Invisibility",250,false,"ii",playerid,0);
return 1;
}
}
pawn Код:
public OnPlayerUpdate(playerid)
{
if(invisible[playerid] == 1)
{
SetPlayerArmedWeapon(playerid, 0);
return 0;
}
}
Now what happens is that while on the invisibility state, OnPlayerWeaponShot seems to ignore completely the player who is not being updated to the server, which actually makes sense. However, all other sources of damage apart from those called at OnPlayerWeaponShot do work and the "invisible" player receives the damage via the OnPlayerTakeDamage callback.
Video: [ame]http://www.youtube.com/watch?v=-w1fgPlzZ9g[/ame]
(Not of my authority)
You can see in the video that once he goes invisible, I proceed to shot and none impact on him. OnPlayerWeaponShot is called as hittype 0 and impacts are on the ground behind him; however when I test with my knife OnPlayerTakeDamage is called perfectly and I'm able to kill him. He's invisible for me in my client:
This worked perfectly in 0.3x since OnPlayerTakeDamage was called every time an invisible player would see other clients hitting him, even when desynced by the effect of the OnPlayerUpdate.
Would this be an intended feature that came with the Lagshot fixes? Wouldn't this also mean that lagshot fixes are not reliable on melee/spray can/fire ex/etc since they are still open to desync issues such as the one I created? Since technically the player is desynced, however his packets are still being sent to the server, why wouldn't OnPlayerWeaponShot while OnPlayerTakeDamage does?