Hi this is my first code I wrote learning function. I'm sure that someone will need it.
Sorry for the construction of sentences, do not know English ...
Sorry for the construction of sentences, do not know English ...
Code:
<action actionid="[COLOR="#FF8C00"]1001[/COLOR]" event="script" value="[COLOR="#FF8C00"]rookgaard/door/sorcerer.lua[/COLOR]"/>
Code:
[COLOR="#0000CD"]function [/COLOR]onUse(cid, item)
[COLOR="#0000CD"]local [/COLOR]sqm = getPlayerPosition(cid)
[COLOR="#0000CD"]local [/COLOR]leave = {x=[COLOR="#FF8C00"]578[/COLOR], y=[COLOR="#FF8C00"]495[/COLOR], z=[COLOR="#FF8C00"]7[/COLOR]}
[COLOR="#0000CD"]local [/COLOR]entrance = {x=[COLOR="#FF8C00"]578[/COLOR], y=[COLOR="#FF8C00"]496[/COLOR], z=[COLOR="#FF8C00"]7[/COLOR]}
[COLOR="#0000CD"]if[/COLOR] getPlayerVocation(cid) == [COLOR="#FF0000"]1[/COLOR] then
[COLOR="#0000CD"]if[/COLOR] sqm.x == [COLOR="#FF8C00"]578[/COLOR] and sqm.y == [COLOR="#FF8C00"]496[/COLOR] and sqm.z == [COLOR="#FF8C00"]7[/COLOR] then
doTeleportThing(cid, leave)
[COLOR="#0000CD"]else[/COLOR]
doTeleportThing(cid, entrance)
doTransformItem(item.uid, [COLOR="#FF8C00"]1258[/COLOR])
[COLOR="#0000CD"]end[/COLOR]
[COLOR="#0000CD"]else[/COLOR]
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR , "Sorry, you are not a Druid.")
[COLOR="#0000CD"]end[/COLOR]
[COLOR="#0000CD"]end[/COLOR]
Configurations
Vocation ID
Vocation ID
Code:
[COLOR="#0000CD"]if[/COLOR] getPlayerVocation(cid) == 1 then
Position where we throw out (the door)
Code:
[COLOR="#0000CD"]local[/COLOR] leave = {x=578, y=495, z=7}
Position of the door
Code:
[COLOR="#0000CD"]local[/COLOR] entrance = {x=578, y=496, z=7}
Then position position of the door (the function checks to see if you are standing at the door, if so click on the door and throw you out before or not depends on how you set ...)
Code:
[COLOR="#0000CD"]if[/COLOR] sqm.x == 578 and sqm.y == 496 and sqm.z == 7
Open door id
Code:
doTransformItem(item.uid, 1258)
Photo's
![6h6bms.png](/proxy.php?image=http%3A%2F%2Fi39.tinypic.com%2F6h6bms.png&hash=ff563cf2a72f51b4e629dc98171d40d2)
![1hyumt.png](/proxy.php?image=http%3A%2F%2Fi41.tinypic.com%2F1hyumt.png&hash=f17592888d8767a8a468bf4cf9465b50)
Last edited: