Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 can the person decline the warp request or only accept? Link to comment
Castillo Posted October 20, 2011 Share Posted October 20, 2011 After 1 minute it'll auto decline, it's easy to add a command to, you should do it as I gave you the main script. Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 i can look how you did it. it's almost the same as accept. am i right? EDIT; the only thing whats irritating is you have to write the whole name with colorcodes ETC. I tested it with a friend but my mate did /warpto [name] and it worked but it said warp is not allowed to. because i blocked the Freeroam warping. Link to comment
mjau Posted October 20, 2011 Share Posted October 20, 2011 Then edit the freeraom resource to not block all warping or easier jus remove the warp button .... then allow warping Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 there's also a command to warp so remove the warp button will not help. Link to comment
Castillo Posted October 20, 2011 Share Posted October 20, 2011 Rename one of the commands? Link to comment
mjau Posted October 20, 2011 Share Posted October 20, 2011 or just delete the whole warp thing from freeroam resource .... Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 what do i have to change in the script to change the playername so the player does not have to write the whole name with colorcodes ETC. Example: /warpto DFC|#2554C7OptimusPrime i want: /warpto Optimus or /warpto OptimusPrime, /warpto prime Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 or just delete the whole warp thing from freeroam resource .... I can't find it in Freeroam resource. EDIT: found it >< Link to comment
mjau Posted October 20, 2011 Share Posted October 20, 2011 Well remove hex codes i think its some kind of string.gsub but really i never tried that ... Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 maybe SolidSnake14 knows right? Link to comment
Castillo Posted October 20, 2011 Share Posted October 20, 2011 local invitations = {} function getPlayerByPartOfName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end addCommandHandler("warpto", function (thePlayer, cmd, who) if (not who or who == "") then outputChatBox("/"..cmd..": No player inserted.",thePlayer,255,0,0) return end local player = getPlayerByPartOfName(who) if (not player) then outputChatBox("/"..cmd..": This player does not exists.",thePlayer,255,0,0) return end if (invitations[thePlayer]) then outputChatBox("/"..cmd..": You already sent a warp invitation.",thePlayer,255,0,0) return end outputChatBox(getPlayerName(player) .." want's to warp to you, write /accept ".. getPlayerName(thePlayer) ..".",player,0,255,0) outputChatBox("You have sent a warp invitation to ".. getPlayerName(player) ..".",player,0,255,0) invitations[thePlayer] = player setTimer(function () invitations[thePlayer] = nil end, 60000, 1) end) addCommandHandler("accept", function (thePlayer, cmd, who) if (not who or who == "") then outputChatBox("/"..cmd..": No player inserted.",thePlayer,255,0,0) return end local player = getPlayerByPartOfName(who) if (not player) then outputChatBox("/"..cmd..": This player does not exists.",thePlayer,255,0,0) return end if invitations[player] then setElementPosition(player, getElementPosition(thePlayer)) outputChatBox("You have accepted ".. getPlayerName(player) .."'s warp invitation.",thePlayer,0,255,0) outputChatBox(getPlayerName(thePlayer) .. " accepted your warp invitation.",player,0,255,0) invitations[player] = nil end end) Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 oh tnx SolidSnake14 I appreaciate this so much!!!! Link to comment
karlis Posted October 20, 2011 Share Posted October 20, 2011 function getPlayerFromNickPart(part) local player part=string.lower(part) for _,p in ipairs(getElementsByType("player")) do local nick=string.lower(getPlayerName(p):gsub("#%x%x%x%x%x%x","")) if string.find(nick,part) then if not player then player=p else return false end end end return player end returns player from nick part, ignoring colorcodes and caps.returns false if more then 1 player with that nick part. bit better then solidsnakes, because of the ignoring colorcodes, caps, and caring of more then 1player check. Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 function getPlayerFromNickPart(part) local player part=string.lower(part) for _,p in ipairs(getElementsByType("player")) do local nick=string.lower(getPlayerName(p):gsub("#%x%x%x%x%x%x","")) if string.find(nick,part) then if not player then player=p else return false end end end return player end returns player from nick part, ignoring colorcodes and caps.returns false if more then 1 player with that nick part. bit better then solidsnakes, because of the ignoring colorcodes, caps, and caring of more then 1player check. do i have to replace the script of Solidsnake with this one? Link to comment
karlis Posted October 21, 2011 Share Posted October 21, 2011 just the player matching part, but make sure function names are same. Link to comment
Ralf122 Posted October 21, 2011 Author Share Posted October 21, 2011 i'm trying to make a gui does not work very well. EDIT: i don't know what i have to replace!?!? Link to comment
Ralf122 Posted October 22, 2011 Author Share Posted October 22, 2011 no one answers anymore? Link to comment
12p Posted October 22, 2011 Share Posted October 22, 2011 Dude, we answered your questions. We taked part from our free time, which we could use to improve our very scripts and projects, to help you. Just, PLEASE, try to learn yourself how to make scripts! Castillo learned by himself, me too and possibly many others guys learned without nothing else than the wiki and interest on the theme! Link to comment
Ralf122 Posted October 22, 2011 Author Share Posted October 22, 2011 i'm already learning lua scripting. but it's not that easy. Link to comment
12p Posted October 22, 2011 Share Posted October 22, 2011 IT IS. Just make something even easier than this. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now