ID:971211
 
(See the best response by NNAAAAHH.)
Code:
No code yet.


Problem description:

Hey guys, I'm trying to make a system where, if you invite friends through the pager, you get money/exp or whatever, a reward.

Is it possible to do it like this, for it to automatically check who you invited and if they joined or would they have to join the game and manually input "referred by [key]" or etc?

Maybe something like generating a link:

byond://ipaddress?key/charname

So if they joined using your link and a save file didnt exist, you'd get rewarded?

Thanks
Well; you could do one of two things;
1) The built-in SendPage() proc to send a referal to someone; which could contain a 'code' they can enter to claim the referal.
2) Simply have a 'refered by' spot in your character creation; then give whatever to the name they give you.
Can you explain option 1 a bit more clearly please? thanks
mob/verb/Refer(t as text)//t here will be what I'm using to define the person they'll be sending the page to
client.SendPage(/*Send a page from this person's client*/"Hello [t], I would like to invite you to play [world.name]! Use this code [insert code here] to give me bonus' for inviting you!",t,"summon=1")//Send t the message; then use summon=1 to invite them to the game.
Ah okay that'll work great thanks.

Although is it possible to perhaps make it so you can choose the person from a list of keys on your pager?

Also a confirmation of whether it was sent or not? (If the key was invalid etc)
Best response
http://www.byond.com/docs/ref/info.html#/client/proc/ SendPage You can send a list of people to SendPage(), though I don't think there is a way to gain a list of people on your pager. The return value of SendPage() is the number of people successfuly paged; so you can include a simple if() statement to tell them if the person was paged or not.
What var would I check with the if statement?
You would check the return value of SendPage.

var paged = SendPage(blabla)
if(paged > 2)


Or just put it into the if() statement.
if(SendPage(blabla) > 2)
Oh alright, thanks a lot guys.