You'd probably have to store the weapon and ammo in a file with the player's steam id, because your code assumes that only the same 32 people keep the same player ids when they enter and leave the server, and that isn't true.
What you'd have to do is on client disconnect, you'd have to search the file for the player's steam id, and if it exists, overwrite the line with the new gun and ammo, and if it doesn't exist, create a new line.
On client connect, you'd read the file for the steam id, and if it wasn't there, you wouldn't do anything, but if it was, you'd get the weapon and ammo information from the file and then give it to him.
At least, that's the logic I'd follow if I were trying to make that. Good luck!