Timiimit Posted December 23, 2011 Posted December 23, 2011 Hi! I have started to make some teleports for admins, moderators and super moderators only. i want to make commandHandler (showadminmarker) and then if you are admin, it create marker and after 3 seconds it dessapears! if you touch it (when visible) it should teleport you! this is what I have: function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) local theMarker = createMarker ( some X, some Y, some Z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then setTimer ( consoleUnshowMarker, 3000, 1 ) end end end function consoleUnshowMarker () destroyElement ( theMarker ) end addCommandHandler ( "showAdminMarker", consoleShowMarker ) how to continue? in game nickname: [GFL]TimiimiT
Xeno Posted December 23, 2011 Posted December 23, 2011 function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) local theMarker = createMarker ( some X, some Y, some Z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then setTimer (destroyElement, 3000, 1, theMarker ) end end end addCommandHandler ( "showAdminMarker", consoleShowMarker )
Timiimit Posted December 23, 2011 Author Posted December 23, 2011 ??? in game nickname: [GFL]TimiimiT
Xeno Posted December 23, 2011 Posted December 23, 2011 ??? Sorry. I turned the destroyMarker into a timer to make it easier.. If you want to continue, use an onMarkerHit event and trigger another function that uses setElementPosition to move the perosn.
Timiimit Posted December 23, 2011 Author Posted December 23, 2011 i would if marker show (its not???)! in game nickname: [GFL]TimiimiT
Xeno Posted December 23, 2011 Posted December 23, 2011 function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) local theMarker = createMarker (x,y, z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then setTimer (destroyElement, 3000, 1, theMarker ) end end end addCommandHandler ( "showAdminMarker", consoleShowMarker )
Timiimit Posted December 23, 2011 Author Posted December 23, 2011 I forgot to put in cordinates !! thx for help! in game nickname: [GFL]TimiimiT
Timiimit Posted December 23, 2011 Author Posted December 23, 2011 WORKS! + what is "global" and what is "local"? (i dont know differance) in game nickname: [GFL]TimiimiT
Timiimit Posted December 23, 2011 Author Posted December 23, 2011 no one? in game nickname: [GFL]TimiimiT
mjau Posted December 23, 2011 Posted December 23, 2011 https://wiki.multitheftauto.com/wiki/Local Global is the opposite
Timiimit Posted December 26, 2011 Author Posted December 26, 2011 Ok!?? this is what I have: function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then setTimer (destroyElement, 3000, 1, theMarker ) end end end function teleportPlayerIfModSmodOrAdmin ( thePlayer ) if hasObjectPermissionTo ( player, "command.kick", false ) then setElementPosition ( thePlayer,X, Y,Z ) end end addCommandHandler ( "showadminmarker", consoleShowMarker ) addEventHandler( "onMarkerHit", theMarker, MarkerHit ) it doesn't work but if I put global not local, it works even less. HELP! in game nickname: [GFL]TimiimiT
Xeno Posted December 26, 2011 Posted December 26, 2011 function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then setTimer (destroyElement, 3000, 1, theMarker ) addEventHandler( "onMarkerHit", theMarker, MarkerHit ) end end end function teleportPlayerIfModSmodOrAdmin ( thePlayer ) if hasObjectPermissionTo ( player, "command.kick", false ) then setElementPosition ( thePlayer,X, Y,Z ) end end addCommandHandler ( "showadminmarker", consoleShowMarker ) Put the onMarkerHit inside the function with the marker in it. PS - There is no function called markerHit in your script, so that addEventHandler wont work. You only have functions called consoleShowMarker and teleportPlayerIfModSmodOrAdmin in your script.
Evil-Cod3r Posted December 26, 2011 Posted December 26, 2011 Xeno dosnt the event must be after end end end right ? My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Xeno Posted December 26, 2011 Posted December 26, 2011 Xeno dosnt the event must be after end end end right ? No because the marker is inside the function.
Timiimit Posted December 27, 2011 Author Posted December 27, 2011 still doesn't work...?? log: when server starts [2011-12-27 10:33:43] SCRIPT ERROR: myscripts\adminTeleport.lua:3: '=' expected near 'theMarker' [2011-12-27 10:33:43] WARNING: Loading script failed: myscripts\adminTeleport.lua:3: '=' expected near 'theMarker' when command entered. WARNING: myscripts\adminTeleport.lua:6: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] in game nickname: [GFL]TimiimiT
Jaysds1 Posted December 27, 2011 Posted December 27, 2011 (edited) for the marker, what's the coordinate for where you want to place the marker? function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local theMarker = createMarker (X, Y, Z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then addEventHandler( "onMarkerHit", theMarker, teleportPlayerIfModSmodOrAdmin ) setTimer (destroyElement, 3000, 1, theMarker ) end end end function teleportPlayerIfModSmodOrAdmin ( thePlayer ) if hasObjectPermissionTo ( player, "command.kick", false ) then setElementPosition ( thePlayer,X, Y,Z ) end end addCommandHandler ( "showadminmarker", consoleShowMarker ) you didn't attached the function for when an admin goes in the marker Edited December 27, 2011 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Timiimit Posted December 27, 2011 Author Posted December 27, 2011 script: function consoleShowMarker ( thePlayer, commandName ) if ( thePlayer ) then local theMarker = createMarker (x,y,z, "cylinder", 1.5, 255, 0, 0, 170 ) if ( theMarker ) then addEventHandler( "onMarkerHit", theMarker, teleportPlayerIfModSmodOrAdmin ) setTimer (destroyElement, 3000, 1, theMarker ) end end end function teleportPlayerIfModSmodOrAdmin ( thePlayer ) if hasObjectPermissionTo ( thePlayer, "command.kick", false ) then setElementPosition ( thePlayer, x,y,z ) end end addCommandHandler ( "showadminmarker", consoleShowMarker ) works!!!!! finally! thx for all. in game nickname: [GFL]TimiimiT
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