Skip to content

Commit

Permalink
Protobuf fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Minekus committed Aug 16, 2013
1 parent e38086f commit cda1e5a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 15 deletions.
Binary file modified addons/sourcemod/plugins/atac-blind.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/atac-drug.smx
Binary file not shown.
30 changes: 23 additions & 7 deletions addons/sourcemod/scripting/atac-blind.sp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,29 @@ public AtacPunishment_Blind(victim, attacker)
{
PrintToChatAll("%c[ATAC]%c %t", CLR_GREEN, CLR_DEFAULT, "Blinded", attacker, ATAC_GetInfo(attacker, AtacInfo_Kills), ATAC_GetSetting(AtacSetting_KillsLimit));

new iDuration = 1536;
new iHoldTime = 1536;
new iFlags = (0x0002 | 0x0008);
new iColor[4] = {0, 0, 0, 0};
iColor[3] = GetConVarInt(g_hAmount);

new Handle:hMessage = StartMessageOne("Fade", attacker);
BfWriteShort(hMessage, 1536);
BfWriteShort(hMessage, 1536);
BfWriteShort(hMessage, (0x0002 | 0x0008));
BfWriteByte(hMessage, 0);
BfWriteByte(hMessage, 0);
BfWriteByte(hMessage, 0);
BfWriteByte(hMessage, GetConVarInt(g_hAmount));
if(GetUserMessageType() == UM_Protobuf)
{
PbSetInt(hMessage, "duration", iDuration);
PbSetInt(hMessage, "hold_time", iHoldTime);
PbSetInt(hMessage, "flags", iFlags);
PbSetColor(hMessage, "clr", iColor);
}
else
{
BfWriteShort(hMessage, iDuration);
BfWriteShort(hMessage, iHoldTime);
BfWriteShort(hMessage, iFlags);
BfWriteByte(hMessage, iColor[0]);
BfWriteByte(hMessage, iColor[1]);
BfWriteByte(hMessage, iColor[2]);
BfWriteByte(hMessage, iColor[3]);
}
EndMessage();
}
33 changes: 25 additions & 8 deletions addons/sourcemod/scripting/atac-drug.sp
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,34 @@ public Action:Timer_Drug(Handle:timer, any:client)
GetClientAbsOrigin(client, flPos);

flAngles[2] = g_flDrugAngles[GetRandomInt(0, 100) % sizeof(g_flDrugAngles)];

TeleportEntity(client, flPos, flAngles, NULL_VECTOR);

new iDuration = 255;
new iHoldTime = 255;
new iFlags = 0x0002;
new iColor[4] = {0, 0, 0, 128};
iColor[0] = GetRandomInt(0, 255);
iColor[1] = GetRandomInt(0, 255);
iColor[2] = GetRandomInt(0, 255);

new Handle:hMessage = StartMessageOne("Fade", client);
BfWriteShort(hMessage, 255);
BfWriteShort(hMessage, 255);
BfWriteShort(hMessage, (0x0002));
BfWriteByte(hMessage, GetRandomInt(0, 255));
BfWriteByte(hMessage, GetRandomInt(0, 255));
BfWriteByte(hMessage, GetRandomInt(0, 255));
BfWriteByte(hMessage, 128);
if(GetUserMessageType() == UM_Protobuf)
{
PbSetInt(hMessage, "duration", iDuration);
PbSetInt(hMessage, "hold_time", iHoldTime);
PbSetInt(hMessage, "flags", iFlags);
PbSetColor(hMessage, "clr", iColor);
}
else
{
BfWriteShort(hMessage, iDuration);
BfWriteShort(hMessage, iHoldTime);
BfWriteShort(hMessage, iFlags);
BfWriteByte(hMessage, iColor[0]);
BfWriteByte(hMessage, iColor[1]);
BfWriteByte(hMessage, iColor[2]);
BfWriteByte(hMessage, iColor[3]);
}
EndMessage();

return Plugin_Continue;
Expand Down

0 comments on commit cda1e5a

Please sign in to comment.