Hiya!
Finally I have completed this script that I really wanted. It sends a player to an XYZ position:
First:
Type this into your data/talkactions/talkactions.xml file:
Then, go to data/talkactions/scripts/ and create a .lua file called sending.lua. Within it, paste this using Notepad or any text editor:
Where:
if getPlayerGroupId(cid) < 3 then
is the minimun group id to use this command.
Then, ingame, type this to teleport any player to any position:
/send "playername,x,y,z
If you find any bug, just tell it to me.
Edit: Changed "-" separator to "," because some players might have a name with "-".
Greetz
Finally I have completed this script that I really wanted. It sends a player to an XYZ position:
First:
Type this into your data/talkactions/talkactions.xml file:
PHP:
<talkaction words="/send" script="sending.lua"/>
Then, go to data/talkactions/scripts/ and create a .lua file called sending.lua. Within it, paste this using Notepad or any text editor:
PHP:
function onSay(cid, words, param)
if getPlayerGroupId(cid) < 3 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You cannot use this command")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local subparam1 = string.sub(param,sep1+1,string.len(param))
if string.find(subparam1, ',') ~= nil then
local sep2 = string.find(subparam1, ',')
local param2 = string.sub(subparam1,1,sep2-1)
local subparam2 = string.sub(subparam1,sep2+1,string.len(param))
if string.find(subparam2, ',') ~= nil then
local sep3 = string.find(subparam2, ',')
local param3 = string.sub(subparam2,1,sep3-1)
local param4 = string.sub(subparam2,sep3+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player")
elseif (param2 == "") or (isNumber(param2) == FALSE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type X")
elseif (param3 == "") or (isNumber(param3) == FALSE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type Y")
elseif (param4 == "") or (isNumber(param4) == FALSE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type Z")
elseif words == "/send" then
posicion = {x = param2, y = param3, z = param4}
doTeleportThing(target, posicion, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have sent " .. getCreatureName(target) .. " to position: x= " .. param2 .. ", y= " .. param3 .. ", z= " .. param4 .. ".")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Wrong format: /send \"Name,X,Y,Z")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Wrong format: /send \"Name,X,Y,Z")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Wrong format: /send \"Name,X,Y,Z")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must set a player and XYZ position")
end
end
Where:
if getPlayerGroupId(cid) < 3 then
is the minimun group id to use this command.
Then, ingame, type this to teleport any player to any position:
/send "playername,x,y,z
If you find any bug, just tell it to me.
Edit: Changed "-" separator to "," because some players might have a name with "-".
Greetz
Last edited: