mirror of
https://github.com/Resxt/Plutonium-T6-Scripts.git
synced 2025-04-19 13:42:54 +00:00
chat_command_info 1.0.1
Fixed some wrong attachments being listed. For example pistol would list "silencer_shotgun" when the expected name is "silencer". Now all listed attachments only contain the content before the first underscore, which works. Added print of the attachments to the console if the debug mode is on
This commit is contained in:
parent
384b32f33a
commit
84e69a87f7
@ -80,6 +80,7 @@ ListWeapons(displayMode)
|
|||||||
ListAttachments(weaponName)
|
ListAttachments(weaponName)
|
||||||
{
|
{
|
||||||
weaponIndex = 0;
|
weaponIndex = 0;
|
||||||
|
finalWeaponName = "";
|
||||||
|
|
||||||
if (IsDefined(weaponName))
|
if (IsDefined(weaponName))
|
||||||
{
|
{
|
||||||
@ -92,13 +93,36 @@ ListAttachments(weaponName)
|
|||||||
{
|
{
|
||||||
return WeaponDoesNotExistError(weaponName);
|
return WeaponDoesNotExistError(weaponName);
|
||||||
}
|
}
|
||||||
|
|
||||||
weaponIndex = getbaseweaponitemindex(weaponName);
|
weaponIndex = getbaseweaponitemindex(weaponName);
|
||||||
|
finalWeaponName = weaponName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
finalWeaponName = self getcurrentweapon();
|
||||||
weaponIndex = getbaseweaponitemindex(self getcurrentweapon());
|
weaponIndex = getbaseweaponitemindex(self getcurrentweapon());
|
||||||
}
|
}
|
||||||
|
|
||||||
self thread TellPlayer(StrTok(level.tbl_weaponids[weaponIndex]["attachment"], " "), 2);
|
attachments = StrTok(level.tbl_weaponids[weaponIndex]["attachment"], " ");
|
||||||
|
attachmentsFinal = [];
|
||||||
|
|
||||||
|
// remove everything after _ in attachments name as this was always returning wrong names
|
||||||
|
// for example it would return silencer_shotgun when the actual codename is just silencer etc
|
||||||
|
foreach (attachment in attachments)
|
||||||
|
{
|
||||||
|
attachmentsFinal = AddElementToArray(attachmentsFinal, StrTok(attachment, "_")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
self thread TellPlayer(attachmentsFinal, 2);
|
||||||
|
|
||||||
|
if (DebugIsOn())
|
||||||
|
{
|
||||||
|
Print("-------------------------------");
|
||||||
|
Print("Available attachments for " + getweapondisplayname(finalWeaponName) + " (" + StrTok(finalWeaponName, "_mp")[0] + "_mp" + ")");
|
||||||
|
|
||||||
|
foreach (attachment in attachmentsFinal)
|
||||||
|
{
|
||||||
|
Print(attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user