entWatch: Make a start with item transfering.
This commit is contained in:
parent
b7e019ed4a
commit
8598ac8d38
@ -48,58 +48,118 @@ public Action Command_TransferItem(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sTarget1[32];
|
||||
char sTarget2[32];
|
||||
GetCmdArg(1, sTarget1, sizeof(sTarget1));
|
||||
GetCmdArg(2, sTarget2, sizeof(sTarget2));
|
||||
char sArguments[2][32];
|
||||
GetCmdArg(1, sArguments[0], sizeof(sArguments[]));
|
||||
GetCmdArg(2, sArguments[1], sizeof(sArguments[]));
|
||||
|
||||
int target1;
|
||||
if ((target1 = FindTarget(client, sTarget1, true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
int target2;
|
||||
if ((target2 = FindTarget(client, sTarget2, true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
if (GetClientTeam(target1) != GetClientTeam(target2))
|
||||
if (strncmp(sArguments[0], "$", 1, false) == 0)
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sError: client teams dont match!", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
strcopy(sArguments[0], sizeof(sArguments[]), sArguments[0][1]);
|
||||
|
||||
bool bTransfered;
|
||||
for (int index; index < EW_GetItemCount(); index++)
|
||||
{
|
||||
CItem item = EW_GetItemData(index);
|
||||
int reciever;
|
||||
if ((reciever = FindTarget(client, sArguments[1], true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
if (item.bClient && item.iClient == target1)
|
||||
char sName[32];
|
||||
char sShort[32];
|
||||
char sColor[32];
|
||||
|
||||
bool bTransfered;
|
||||
for (int index; index < EW_GetItemCount(); index++)
|
||||
{
|
||||
if (item.bWeapon && !(item.dConfig.iSlot == SLOT_NONE || item.dConfig.iSlot == SLOT_KNIFE))
|
||||
CItem item = EW_GetItemData(index);
|
||||
|
||||
item.dConfig.GetName(sName, sizeof(sName));
|
||||
item.dConfig.GetShort(sShort, sizeof(sShort));
|
||||
item.dConfig.GetColor(sColor, sizeof(sColor));
|
||||
|
||||
if (StrContains(sName, sArguments[0], false) != -1 || StrContains(sShort, sArguments[0], false) != -1)
|
||||
{
|
||||
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
|
||||
if (item.bWeapon && !(item.dConfig.iSlot == SLOT_NONE || item.dConfig.iSlot == SLOT_KNIFE))
|
||||
{
|
||||
int iDisplay = item.dConfig.iDisplay;
|
||||
|
||||
char sWeaponClass[32];
|
||||
GetEntityClassname(item.iWeapon, sWeaponClass, sizeof(sWeaponClass));
|
||||
GivePlayerItem(item.iClient, sWeaponClass);
|
||||
if (item.bClient)
|
||||
{
|
||||
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
|
||||
|
||||
int iDisplay = item.dConfig.iDisplay;
|
||||
item.dConfig.iDisplay &= ~(1<<0);
|
||||
char sWeaponClass[32];
|
||||
GetEntityClassname(item.iWeapon, sWeaponClass, sizeof(sWeaponClass));
|
||||
GivePlayerItem(item.iClient, sWeaponClass);
|
||||
}
|
||||
|
||||
EquipPlayerWeapon(target2, item.iWeapon);
|
||||
item.dConfig.iDisplay &= ~(1<<0);
|
||||
|
||||
item.dConfig.iDisplay &= iDisplay;
|
||||
bTransfered = true;
|
||||
EquipPlayerWeapon(reciever, item.iWeapon);
|
||||
|
||||
item.dConfig.iDisplay &= iDisplay;
|
||||
bTransfered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bTransfered)
|
||||
if (!bTransfered)
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sError: no transferable items found!", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
CPrintToChatAll("\x07%s[entWatch] \x07%s%N\x07%s transfered \x07%s%s\x07%s to \x07%s%N\x07%s.", "E01B5D", "EDEDED", client, "F16767", sColor, sName, "F16767", "EDEDED", reciever, "F16767");
|
||||
LogAction(client, -1, "%L transfered %s to %L.", client, sName, reciever);
|
||||
}
|
||||
else
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sError: no transferable items found!", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
int target;
|
||||
if ((target = FindTarget(client, sArguments[0], true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
int reciever;
|
||||
if ((reciever = FindTarget(client, sArguments[1], true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
if (GetClientTeam(target) != GetClientTeam(reciever))
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sError: teams dont match!", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
bool bTransfered;
|
||||
for (int index; index < EW_GetItemCount(); index++)
|
||||
{
|
||||
CItem item = EW_GetItemData(index);
|
||||
|
||||
if (item.bClient && item.iClient == target)
|
||||
{
|
||||
if (item.bWeapon && !(item.dConfig.iSlot == SLOT_NONE || item.dConfig.iSlot == SLOT_KNIFE))
|
||||
{
|
||||
int iDisplay = item.dConfig.iDisplay;
|
||||
|
||||
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
|
||||
|
||||
char sWeaponClass[32];
|
||||
GetEntityClassname(item.iWeapon, sWeaponClass, sizeof(sWeaponClass));
|
||||
GivePlayerItem(item.iClient, sWeaponClass);
|
||||
|
||||
item.dConfig.iDisplay &= ~(1<<0);
|
||||
|
||||
EquipPlayerWeapon(reciever, item.iWeapon);
|
||||
|
||||
item.dConfig.iDisplay &= iDisplay;
|
||||
bTransfered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bTransfered)
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sError: target has no transferable items!", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
CPrintToChatAll("\x07%s[entWatch] \x07%s%N\x07%s transfered all items from \x07%s%N\x07%s to \x07%s%N\x07%s.", "E01B5D", "EDEDED", client, "F16767", "EDEDED", target, "F16767", "EDEDED", reciever, "F16767");
|
||||
LogAction(client, target, "%L transfered all items from %L to %L.", client, target, reciever);
|
||||
}
|
||||
|
||||
CPrintToChatAll("\x07%s[entWatch] \x07%s%N\x07%s transfered all items from \x07%s%N\x07%s to \x07%s%N\x07%s.", "E01B5D", "EDEDED", client, "F16767", "EDEDED", target1, "F16767", "EDEDED", target2, "F16767");
|
||||
LogAction(client, target1, "%L transfered all items from %L to %L.", client, target1, target2);
|
||||
return Plugin_Handled;
|
||||
}
|
Loading…
Reference in New Issue
Block a user