function setDogName(thePlayer, commandName, newName) local skinID = getElementModel(thePlayer) if skinID == 129 then if (getElementData(thePlayer, "hasDogName") == false) then if not newName then outputChatBox("SYNTAX: /" .. commandName .. " [Dog Name]", thePlayer, 255, 194, 14) else if (getElementData(thePlayer, "hasDogName") == false) then exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "legitnamechange", 1, false) local actualPlayerName = getPlayerName(thePlayer) setElementData(thePlayer, "playername", actualPlayerName) setElementData(thePlayer, "hasDogName", true) --outputDebugString(actualPlayerName) setPlayerName(thePlayer, newName) exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "legitnamechange", 0, false) outputChatBox("Your should of been changed to " .. newName .. ".", thePlayer) outputChatBox("If your name is not changed, then the name " .. newName .. " is currently in use right now.", thePlayer) end end elseif (getElementData(thePlayer, "hasDogName") == true) then exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "legitnamechange", 1, false) local actualPlayerName = getElementData(thePlayer, "playername") --outputDebugString(actualPlayerName) setPlayerName(thePlayer, actualPlayerName) outputDebugString(actualPlayerName) setElementData(thePlayer, "hasDogName", false) exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "legitnamechange", 0, false) outputChatBox("Your name has been set back to " .. actualPlayerName .. ".", thePlayer) else outputChatBox("[SDN-ERR-555] Report on mantis.", thePlayer, 255, 0, 0) end end end addCommandHandler("setdogname", setDogName)