If you just want a new one to respawn when the other one is gone, just use an object_create. that way, it can only create one when the other one is gone (create_anew deletes the old one, and replaces it)
Both of those posted have large problems. Its only checking player0, and sali's, if player0 doesnt pick it up before it despawns, it will never respawn.
Anyways, easiest way is to just have a continuous script with object_create, that only runs on the host machine (use host testing) because if clients run the script, they will create fakes that only they can see, etc.
(global boolean host false)
(script startup host_check
(sleep 5)
(if (!= (unit_get_health HOST_TESTING_VEHICLE) -1) (set host true))
)
(script continuous respawn_weapon
(sleep 30)
(if host (object_create RANDOMWEAPON))
)
If you have a random pit that you want it to automatically respawn from, just place a trigger volume down there with an object_destroy or object_create_anew.