Yay double posting
So I got some other help on this and it was suggested to me to use .getDatablock().maxForwardSpeed in order to change back to the default speed when not sprinting. I also tried going into coding the freezing when you equip and unequip tools. Here's what I got:
function PlayerArmor::onTrigger(%this, %obj, %trigger, %val)
{
%db = %obj.getDatablock();
if(%trigger == 4 && %val == 1)
{
%obj.setMaxForwardSpeed(11);
}
if(%trigger == 4 && %val == 0)
{
%obj.setMaxForwardSpeed(%db.maxFowardSpeed);
}
parent::onTrigger(%this, %obj, %trigger, %val);
}
function serverCmdUseTool(%client, %slot)
{
if (isObject(%client.player) && %client.isPlayerType == 1)
{
%client.player.setMaxForwardSpeed(0);
}
}
function serverCmdUnUseTool(%client)
{
if (isObject(%client.player) && %client.isPlayerType == 1)
{
%client.player.setMaxForwardSpeed(8);
}
}
Now I got more issues:
1. Sprinting still doesn't work. But if I do just %obj.setMaxForwardSpeed(8); on the second if statement it works fine. Did I not store the variable right?
2. I'm overriding the default function for serverCmdUseTool and UnUseTool because when I hit q with any playertype I can scroll through items but not actually use any, and if I take out the brick tool it says even when I hit q again. So I made the isPlayerType variable in my playertype to check to make sure they are the right playertype, but I am assuming I'm not calling that correctly either.