Jump to content
Xandresia

G&S script only for group

Recommended Posts

Excuse me for my English, I use a translator

I would like to have changed in this script the ONLY group members( with the right grouptag) can buy by coins (g & s currency)

one has the group does not come * sorry wrong group

 

the script ( i now that the script works whit a ather script the API Coins(RP-HUd) script)

_____________________________________________________________________________________

// Put this script in same prim as the API Coins (RP-HUD [G&S])

// ** Price in G&S Coins
integer PVP = 100
;

// ** Price in L$
integer PL = 1
;


string nom_obj;
integer active = FALSE;

display()
{
        integer cnt =  llGetInventoryNumber( INVENTORY_OBJECT );
        
        active = cnt>0;
    
        if(active){
            llSetText (" "
            +(string)
PVP+" G&S Coin \nor L$"+(string)PL+"\nAvailable: "+(string)cnt, <1,1,1>, 1);
            llSetObjectName("G&S Vendor: " +llGetInventoryName(INVENTORY_OBJECT,0));
        }else{
            llSetText("** Empty **", <1,1,1>, 1);   
        }
        
}

default {
    
    state_entry() {
        llSetPayPrice(-1,[PL,-1,-1,-1]);
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
    }
    
    run_time_permissions(integer perm)
    {
        if (perm&PERMISSION_DEBIT)
        {
            display();
        }
    }
    
    touch_start(integer num_detected) {
        if(active){
            
            llMessageLinked(LINK_SET, 700, llGetInventoryName(INVENTORY_OBJECT,0)+","+(string)PVP,llDetectedKey(0));          
        }    
    }
    
    link_message(integer sender_num, integer num, string str, key id) {                

        if(num == 701){
              
            llSay( 0 ,  "Thank you for your purchase: "+llGetInventoryName(INVENTORY_OBJECT,0)+"  delivered to "+llKey2Name(id) );
            
            llGiveInventory( id, llGetInventoryName(INVENTORY_OBJECT,0) );
            
            display();
        }
        
        if(num == 702){
           
            llSay( 0 , "Vendor is being used by: "+str );
    
        }
    }
        
    changed(integer change){      
        if (change & CHANGED_INVENTORY){
               display();
        }
      }   
      
    money(key id, integer amount)
    {
        if (active && amount==PL)
        {
              
            llSay( 0 , ""+llGetInventoryName(INVENTORY_OBJECT,0)+""+llKey2Name(id) );
            
            llGiveInventory( id, llGetInventoryName(INVENTORY_OBJECT,0) );
            
            display();
        }
        else if (amount)
        {
            llInstantMessage(id,"There was something wrong with your payment. Your money will be refunded.");
            llTransferLindenDollars(id,amount);
        }
    }
       
    transaction_result(key id, integer success, string data)
    {
        if (success) llWhisper(0,"Payment refunded");
        else llInstantMessage(llGetOwner(),"Refund failure: "+llKey2Name(llList2Key(llParseString2List(data,[","],[]),0))+" "+data);
    }      
}
 

______________________________________

Thank you ;)

Edited by Xandresia

Share this post


Link to post
Share on other sites

You could try using llGetObjectDetails(llGetKey(),[OBJECT_GROUP]) to determine the UUID of the group that your object is currently using. If you include the UUID of your group in the script as a (key) constant, you can compare it to the result. That will verify that the object is set to YOUR group. Then all you need to do is compare it to the user's group with llSameGroup(llDetectedKey(0)) to verify that the user is wearing the group's tag.

Share this post


Link to post
Share on other sites

If you are not a scripter, you may post in the InWorld Employment forum to hire a scripter who will do the work for you.  The LSL Scripting forum is a place for scripters to compare solutions to problems in scripts that they are writing themselves.  We do not write scripts here except as general examples.

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.


×
×
  • Create New...