Sweet2770 Posted October 30, 2023 Share Posted October 30, 2023 Hi SL I have a script that gives an item in the object to a person... But my plan is to give that items to only one specific person so another one cant take it. Do anyone know which functions I need to do that? Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted October 30, 2023 Share Posted October 30, 2023 In the touch_start event, use llDetectedKey(0) to check who touched the object. If the key isn't the one you want, don't give the item. Link to comment Share on other sites More sharing options...
Sweet2770 Posted October 30, 2023 Author Share Posted October 30, 2023 Okay I also thought it was something about llDetectedKey(0). But how do the script knows who that person is i want to give the item to? Link to comment Share on other sites More sharing options...
Qie Niangao Posted October 30, 2023 Share Posted October 30, 2023 Probably the existing script uses llGiveInventory() inside a touch_start() event. It seems you want to check whether the person who touched is the person you want to give the item to, so you need to "guard" that llGiveInventory with a conditional, something like: if ("Sweet2770 Resident" == llDetectedName(0)) { llGiveInventory… } (Ah, while I was typing Wulfie answered. I just used llDetectedName instead of llDetectedKey because it might be handier than looking up the key of the intended recipient, although that's also pretty easy especially because they're in the same region, touching stuff.) Link to comment Share on other sites More sharing options...
Sweet2770 Posted October 30, 2023 Author Share Posted October 30, 2023 ooh okay now I got it Thank you so much Qie and Wulfie Link to comment Share on other sites More sharing options...
Sweet2770 Posted October 30, 2023 Author Share Posted October 30, 2023 Just one more question, im still learning scripting touch_start(integer total_number) { if("sweet2770 Resident"== llDetectedKey(0)) { llGiveInventory(user, llGetInventoryName(INVENTORY_NOTECARD, 0) ); } what is wrong here? Link to comment Share on other sites More sharing options...
Sweet2770 Posted October 30, 2023 Author Share Posted October 30, 2023 (edited) ups lol. that most be cus i used detectedkey instead of detctedname but i also need to change "user" in llGiveInventory Edited October 30, 2023 by Sweet2770 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now