How do I change variables at collision with Player? Please Help.

How do I change variables, when the player collides with an object. I want to make if the player collides with an item, then the variable FireRate of the cannon changes.
Can you help me, please?

public void OnCollisionEnter(Collision col){
firerate = 10;

function OnTriggerEnter (col : Collider) {
    firerate = 10;

Have a great day!