My laptop restarts suddenly when I plug in the charger

my laptop sometimes restarts suddenly when i plug in the charger, and while it’s plugged in it restarts when i do certain activities like watching youtube, and gamin, but it works fine for some other games, and it works perfectly when it’s on the battery no reboots. I changed the charger, the battery, the hard disk, RAMs work fine, the fan also, no overheating. can someone help?

crwdns2934089:0crwdne2934089:0 crwdns2934093:0crwdne2934093:0

crwdns2934109:0crwdne2934109:0

crwdns2889612:0crwdne2889612:0 0
crwdns2934285:0crwdne2934285:0