Ralf122 Posted October 16, 2011 Share Posted October 16, 2011 (edited) I've got an question: If a person is warping to an other person with the freeroam resource they wanna kill him, now I wanna make a script that the person can acept the guy who is warping to him. can somebody help? Edited October 17, 2011 by Guest Link to comment
myonlake Posted October 16, 2011 Share Posted October 16, 2011 We do not make scripts for you, but we can give you a helping hand. Here are some functions you need. If your try is not working, show it to us. addEventHandler -- Event handler createMarker -- The marker outputChatBox -- For to show you the messages when you open/close the marker addCommandHandler -- Open/close command setElementPosition -- Set the player's position setElementInterior -- To change the interior of the player setElementDimension -- To change the dimension of the player destroyElement -- To destroy the marker on the close command Link to comment
Ralf122 Posted October 16, 2011 Author Share Posted October 16, 2011 i don't know how to start. Link to comment
BriGhtx3 Posted October 16, 2011 Share Posted October 16, 2011 Lol, then read the wiki and learn how to start Link to comment
denny199 Posted October 17, 2011 Share Posted October 17, 2011 u meaning this?: -- serverside function hit ( player ) setElementPosition ( player, x, y, z ) -- put your'e own position in it setElementDimension ( player, dimensionidhere ) -- dimensionid here setElementInterior ( player, intID ) -- interior id here end function open () local marker = createMarker ( x, y, z ) -- put your'e own position in it where you wanna have the marker outputChatBox ( "The deathmatch arena is open!" ) addEventHandler ( "onMarkerHit", marker, hit ) end addCommandHandler ( "opendeatmatch", open ) function close () outputChatBox ( "The deathmatch arena is closed!" ) destroyElement ( marker ) end addCommandHandler ( "closedeatmatch", close ) Link to comment
karlis Posted October 18, 2011 Share Posted October 18, 2011 u meaning this?:-- serverside function hit ( player ) setElementPosition ( player, x, y, z ) -- put your'e own position in it setElementDimension ( player, dimensionidhere ) -- dimensionid here setElementInterior ( player, intID ) -- interior id here end function open () local marker = createMarker ( x, y, z ) -- put your'e own position in it where you wanna have the marker outputChatBox ( "The deathmatch arena is open!" ) addEventHandler ( "onMarkerHit", marker, hit ) end addCommandHandler ( "opendeatmatch", open ) function close () outputChatBox ( "The deathmatch arena is closed!" ) destroyElement ( marker ) end addCommandHandler ( "closedeatmatch", close ) that's completely non-related Link to comment
Ralf122 Posted October 19, 2011 Author Share Posted October 19, 2011 i made something i think it's not very well. function goToplayer(source) local x,y,z = getElementPosition(cH) setElementPosition(source, x, y, z + 15) --end end addCommandHandler("warpto", goToPlayer) i didn't know how to make the accept part. Link to comment
denny199 Posted October 19, 2011 Share Posted October 19, 2011 [lua]local x,y,z = getElementPosition(cH) lua] Who cH ? give arguments like: ch = getLocalPlayer() Link to comment
12p Posted October 19, 2011 Share Posted October 19, 2011 huh? What does "cH" means? Is it a player element? Or isn't defined? Link to comment
Ralf122 Posted October 19, 2011 Author Share Posted October 19, 2011 it has to be player element but i think it's wrong. Link to comment
denny199 Posted October 20, 2011 Share Posted October 20, 2011 function warp( player, command, who ) local target = getPlayerFromName ( who ) if ( target ) then local x,y,z = getElementPosition ( target ) setElementPosition( player, x, y, z ) end end addCommandHandler ( "warp", warp ) Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 now the accept or decline part, i didn't know how to do it, maybe some of you know it? and tnx denny199 Link to comment
12p Posted October 20, 2011 Share Posted October 20, 2011 Accept or decline? Be more specific. Link to comment
Ralf122 Posted October 20, 2011 Author Share Posted October 20, 2011 Well if the player wants to warp a person /warpto, then something in the chat or a little gui has to appear where the person can accept or decline the warp command. Link to comment
12p Posted October 20, 2011 Share Posted October 20, 2011 Well if the player wants to warp a person /warpto, then something in the chat or a little gui has to appear where the person can accept or decline the warp command. I think that's stupid. Why would the player use /warpto if (s)he doesn't want to warp? Link to comment
karlis Posted October 20, 2011 Share Posted October 20, 2011 its asked for the player that you warp to. Link to comment
12p Posted October 20, 2011 Share Posted October 20, 2011 its asked for the player that you warp to. Oh. ROFL. viewtopic.php?f=91&t=27739 or viewtopic.php?f=108&t=22831 Link to comment
karlis Posted October 20, 2011 Share Posted October 20, 2011 what's the point of gui editing?Thats not the issue. Link to comment
12p Posted October 20, 2011 Share Posted October 20, 2011 what's the point of gui editing?Thats not the issue. Not editing; creating. If he wants GUI he must do it. Link to comment
Aibo Posted October 20, 2011 Share Posted October 20, 2011 so many messages and noone even started to explain the logic behind teleport request/confirmation Link to comment
12p Posted October 20, 2011 Share Posted October 20, 2011 so many messages and noone even started to explain the logic behind teleport request/confirmation True, Aibo. Dude, just use a GUI Editor tool (like "QtDesignerLite + QtToLua" or "GUI Editor"), then use GUI Click event handler: https://wiki.multitheftauto.com/wiki/Client_Scripting_Events#GUI_events addEventHandler For using the events. Link to comment
Castillo Posted October 20, 2011 Share Posted October 20, 2011 local invitations = {} 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 = getPlayerFromName(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 = getPlayerFromName(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 thank you very much Solidsnake14!! Serverside isn't it? Link to comment
Castillo Posted October 20, 2011 Share Posted October 20, 2011 You're welcome and yes, server side. 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