The simplistic Referral Code method used in Zen Cart is nothing more than creating a normal Discount Coupon(s) and turning on the Referral setting so that the 1st Discount Coupon used by a customer is added as the Referral Code to the Customer's record ...

This can then be called up with the Referral Report to see all orders made by any customers who were initially setup with that Discount Coupon code as their referral code ...

In the report, you can also see what order(s) the Discount Coupon was applied to for each of the customers who used them ...

For your purposes of wanting to give XX amount off to these people who hand out these Discount Coupons you would probably want to customize the report further to manage things easier ...

You can test this out by turning on in the Customers settings:
Customers Referral Status
Customers Referral Code is created from
0= Off
1= 1st Discount Coupon Code used
2= Customer can add during create account or edit if blank

NOTE: Once the Customers Referral Code has been set it can only be changed in the Admin Customer
Then create a Discount Coupon for testing with ...

Now, create a customer ...

If you set the Referral Code was set by 1st Discount Coupon used, once the order is complete the Discount Coupon will be added to the customer's account as the Referral Code ...

If you set it where the Customer can add the referral code during the creation of the account, it will be asked for during creating the account ... until it has been filled in, the customer can still add ...

Writing code to customize the existing creating of an account where a new code is generated to give to a new customer to hand out to friends would mean changing the existing code to add in this feature ...

1 create a new discount coupon for the customer to have a referral code to hand out to friends

2 include an explination to the customer in the email that they now have this code to pass out to friends

3 customize the report as needed to track usage of the Discount Coupon

4 Decide if you are manually giving the referring customer 25% of the customers that come to the store and use the coupon to the referring customer in the form of either a Discount Coupon or Gift Certificate ...

Be aware, Discount Coupons can be setup expire and Gift Certificates are "cash" and never expire ...

This would be a neat project to write ... but it would take some time and thought to manage it all ...