Jump to content
Sign in to follow this  
nynaeveakara

Help can't figure out how to script to add a pay percentage to partner to my pay script

Recommended Posts

Hi,

Help can't figure out how to script to add a pay percentage to partner to my pay script. I can only find how to split profits on an object vendor but I just and to send a percentage of what my cash register is paid sent to a partner. how do I do this?

Share this post


Link to post
Share on other sites

I don't want the vendor part.

 

I want this to sent 50% to another person.

 

default
{
state_entry()
{
llSetPayPrice(PAY_DEFAULT, [05,10,20,25]) ;
}

money(key giver, integer amount)
{
llSay(0, "Thank you, " + llKey2Name(giver) + " for your payment!");
if (llKey2Name(llGetOwner()) != "")
{
llInstantMessage(llGetOwner(), llKey2Name(giver) + " just paid L$" + (string)amount);

}
}
}

Share this post


Link to post
Share on other sites

You need to use the very last condition in the money event in the example to which Rolig directed you.

 

	money(key giver, integer amount)	{		if (gSplitKey != NULL_KEY)		{			integer Payout = (integer) (amount*gSplitPct);			llGiveMoney(gSplitKey,Payout);		}	}

 

Obviously you'll need to create a global key, gSplitKey and assign its value as your partner's uuid, and also a global float, gSplitPct, with a value of 0.5.  

I think I'd test for if (Payout) before trying to give the money, in case someone gives L$1 and it gets rounded down to 0.

Share this post


Link to post
Share on other sites

how do i alter it for a donation box as it has a set amount on it and even if theres no inventory items it still wants to charge a certain price

Share this post


Link to post
Share on other sites

Study the llSetPayPrice function in the LSL wiki.  What you want to do is set a default donation amount, so UNhide the pay field.  Then you can either hide all buttons or you can leave them and put suggested donation amounts on them.

        llSetPayPrice(0,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will give you a pay field with a default donation of L$0 and no fixed price buttons.

        llSetPayPrice(50,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will do the same, but set the default to L$50.  In either of those cases, the user can type in an amount of their own choice instead of accepting the default.

        llSetPayPrice(0,[50,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will give you a pay field with a default donation of L$0 and a single Quick Pay button with a suggested donation of L$50.

        llSetPayPrice(0,[50,100,250,500]);

will give you a pay field with a default donation of L$0 and four Quick Pay buttons with suggestions of L$50, L$100, L$250, and L$500.  And finally,

        llSetPayPrice(PAY_HIDE,[50, 100, 250, 500]);

will give you no write-in pay field but will give you the four buttons with suggested fixed donation levels.
 You may want to use any of those variations or something entirely different, depending on your donation strategy.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...