SphereCommunity
Leave House Function or ContextMenu - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Leave House Function or ContextMenu (/Thread-Leave-House-Function-or-ContextMenu)

Pages: 1 2


Leave House Function or ContextMenu - Reflex - 04-21-2012 07:54 PM

Hello, I am trying to create a command or statement or contextmenu that allows you to leave a house so players can't get stuck in houses. I can't figure out how to have the player scan the area for the nearest house sign then grab the house sign's P. Currently I am trying to use a contextmenu to do so but I would also like them to be able to type something like on=I wish to leave this house and then it teleports them to under the house sign. Here is my current code..

Code:
[EVENTS e_all_players]
ON=@ContextMenuRequest
if (<isonhouse> == 1)
SRC.AddContextEntry 1001,6207,0
SRC.AddContextEntry 1000,5000,0
else
SRC.AddContextEntry 1000,5000,0
endif

ON=@ContextMenuSelect
IF (<ARGN>==1000)
    f_playerinfo_d_chooser
ENDIF

IF (<ARGN>==1001)
REF1=?????
src.go <REF1>
ENDIF



RE: Leave House Function or ContextMenu - Shaklaban - 04-21-2012 09:28 PM

you can look to i ban thee or remove thyself commands in your house system.


RE: Leave House Function or ContextMenu - Reflex - 04-22-2012 04:23 AM

Yea I tried that.. I still cant figure it out.. it's not making sense to me because those require targets and grab information from the target..? So Im confused


RE: Leave House Function or ContextMenu - Shaklaban - 04-22-2012 05:08 AM

hmm if you put that part here we can help. its probably grab region from the target then find uid of table from the region. in community pack's house system, uid of table holded on houses (region) more2:


RE: Leave House Function or ContextMenu - Reflex - 04-22-2012 05:27 AM

House Script

Code:
ON=Remove thyself
ON=Te expulso
if !(<DEF.scp.House_BanEngine>)
    return 0
endif
REF1=<UID.<SRC.REGION.UID>.MORE2>
if (<REF1.HousePlayerAccess <SRC>> >= 2)
    SRC.TARGETF f_house_eject <REF1>
    SRC.SYSMESSAGE @,,1 Select the individual to eject from this house.
endif

//end of remove thyself next is function it calls//

[FUNCTION f_house_eject]
REF1=<ARGS>
if (<ARGO.ISITEM>)
    SRC.SYSMESSAGE @,,1 You cannot eject that from the house!
    return 1
elif (<ARGO.REGION.UID> != <REF1.REGION.UID>)
    SRC.SYSMESSAGE @,,1 <ARGO.NAME> is not in your house.
    return 1
elif (<ARGO>==<SRC>)
    SRC.SYSMESSAGE @,,1 You can't eject yourself!
    return 1
elif (<REF1.IsOwner <ARGO>>)
    SRC.SYSMESSAGE @,,1 You can't eject the house owner!
    return 1
elif (<REF1.IsCoOwner <ARGO>>)
    SRC.SYSMESSAGE @,,1 You can't eject a house co-owner!
    return 1
elif (<REF1.IsFriend <ARGO>>)
    SRC.SYSMESSAGE @,,1 You can't eject a house friend!
    return 1
endif
ARGO.GO <REF1.P>
ARGO.FIX
SRC.SYSMESSAGE @,,1 <ARGO.NAME> has been ejected from this house.
ARGO.SYSMESSAGE @,,1 You have been ejected from this house. If you persist in entering, you may be banned from the house.



RE: Leave House Function or ContextMenu - Shaklaban - 04-22-2012 06:10 AM

then you can set ref1=<UID.<SRC.REGION.UID>.MORE2> in contextmenu.


RE: Leave House Function or ContextMenu - Reflex - 04-22-2012 06:44 AM

Can you please explain scripts when you respond because I dont understand what so ever.. ? If this is what you're referring to I dont understand how the ref1 works at all and Ive tried this but it doesnt work.

Code:
[EVENTS e_all_players]
ON=@ContextMenuRequest
if (<isonhouse> == 1)
SRC.AddContextEntry 1001,6207,0
SRC.AddContextEntry 1000,5000,0
else
SRC.AddContextEntry 1000,5000,0
endif

ON=@ContextMenuSelect
IF (<ARGN>==1000)
    f_playerinfo_d_chooser
ENDIF

IF (<ARGN>==1001)
REF1=<UID.<SRC.REGION.UID>.MORE2>
src.go <REF1>
src.say this is working
ENDIF



RE: Leave House Function or ContextMenu - Shaklaban - 04-23-2012 12:10 AM

ref1 is just reference, you can assign it to an uid. in that case ref1 is the regions (multi of house) more2 value. more2 of the house is equals to uid of table of the house.


RE: Leave House Function or ContextMenu - Reflex - 04-23-2012 11:20 AM

Doesn't work from a contextmenu or at least it isn't for me

IF (<ARGN>==1001)
REF1=<UID.<SRC.REGION.UID>.MORE2>
src.go <REF1>
src.say argn 1001 is being called.
ENDIF


RE: Leave House Function or ContextMenu - Shaklaban - 04-23-2012 03:34 PM

you need to use:

src.go <ref1.p>
src.move s 1