Perfect Posted August 20, 2012 Share Posted August 20, 2012 Hi All, like title says "why my lift is not working" local lift = createObject ( 8231, -1326, -67, 55, 0, 0, 0 ) createBlipAttachedTo ( ride, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) addCommandHandler("Lift", local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) function lsairport ( ) moveObject ( lift, 8231, 1582.4000244141, -2423.3000488281, 17.39999961853, 0, 0, 180 ) end function sfairport ( ) moveObject ( lift, 8231, -1378.1999511719, -248.19999694824, 14.89999961853, 0, 0, 315.20001220703 ) end function lvairport ( ) moveObject ( lift, 8231, 1282.6999511719, 1346.3000488281, 11.60000038147, 0, 0, 270 ) end function pirateship ( ) moveObject ( lift, 8231, 2016.8000488281, 1481.5, 11.699999809265, 0, 0, 283 ) end addCommandHandler("lsa",lsairport) addCommandHandler("sfa",sfairport) addCommandHandler("lva",lvairport) addCommandHandler("ps",pirateship) Link to comment
scratcher911 Posted August 20, 2012 Share Posted August 20, 2012 addCommandHandler("Lift", function( thePlayer, Command ) -- You forgot function here local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 scratcher911 said: addCommandHandler("Lift", function( thePlayer, Command ) -- You forgot function here local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) Thnx So much!!! EDIT: Still help needed, when i teleport anywhere with lift then i fall down and lift go to target. how to make player not fall when lift move ? EDIT2: I want to warp player to lift, who not an admin(not have permission) and i need a command to give and take permission. Pls help Link to comment
Twiz. Posted August 20, 2012 Share Posted August 20, 2012 For edit 1 : i believe you could freeze him with the command : "setElementFrozen" . i dont know what you mean with the 2nd edit. Could you tell me again please. Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 from 2ndEdit i mean if i write /pwarp "playername" then that player warped to Lift and another thing i want a command to give permission to player for use "Lift" and other commands. and another command for take player permission (then that player can't use "Lift" and other commands) Link to comment
sockz Posted August 20, 2012 Share Posted August 20, 2012 function setLiftLevel (sourcePlayer,command,targetPlayer) local accName = getAccountName(getPlayerAccount(sourcePlayer )) if isObjectInACLGroup("user."..accName,aclGetGroup ("Admin")) then outputChatBox ("You may not use this command",sourcePlayer) end if targetPlayer then setElementData ( targetPlayer, "lift.permission", true ) outputChatBox ( "You have granted "..targetPlayer.." permission to use /lift", sourcePlayer ) elseif getElementData(targetPlayer, "lift.permission", true ) then setElementData ( targetPlayer, "lift.permission", false ) outputChatBox ( "You have taken "..targetPlayer.." permission to use /lift", sourcePlayer ) else outputChatBox ("" .. targetPlayer .. " does not exist.", sourcePlayer) end end addCommandHandler ( "liftpermission", setLiftLevel ) then use if getElementData(thePlayer, "lift.permission", true ) then instead of local accName = getAccountName(getPlayerAccount(sourcePlayer )) if isObjectInACLGroup("user."..accName,aclGetGroup ("Admin")) then on /lift cmd Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 confuse , can you attach that to my script pls ? Link to comment
sockz Posted August 20, 2012 Share Posted August 20, 2012 addCommandHandler("Lift", function( thePlayer, Command ) -- You forgot function here if getElementData(thePlayer, "lift.permission", true ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 hm, i don't need this ? function setLiftLevel (sourcePlayer,command,targetPlayer) local accName = getAccountName(getPlayerAccount(sourcePlayer )) if isObjectInACLGroup("user."..accName,aclGetGroup ("Admin")) then outputChatBox ("You may not use this command",sourcePlayer) end if targetPlayer then setElementData ( targetPlayer, "lift.permission", true ) outputChatBox ( "You have granted "..targetPlayer.." permission to use /lift", sourcePlayer ) elseif getElementData(targetPlayer, "lift.permission", true ) then setElementData ( targetPlayer, "lift.permission", false ) outputChatBox ( "You have taken "..targetPlayer.." permission to use /lift", sourcePlayer ) else outputChatBox ("" .. targetPlayer .. " does not exist.", sourcePlayer) end end addCommandHandler ( "liftpermission", setLiftLevel ) Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 You need to use getPlayerFromName or https://wiki.multitheftauto.com/wiki/Get ... omNamePart Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 (edited) TAPL said: You need to use getPlayerFromName or https://wiki.multitheftauto.com/wiki/Get ... omNamePart I did'nt understand anything, pls give examples because i am beginner EDIT: i do this function liftPermission( sourcePlayer, command, who ) local targetPlayer=getPlayerFromName(who) if ( targetPlayer ) then setElementData ( targetPlayer, "lift.permission", true ) outputChatBox ( "You have granted "..targetPlayer.." permission to use /lift", sourcePlayer ) elseif getElementData(targetPlayer, "lift.permission", true ) then setElementData ( targetPlayer, "lift.permission", false ) outputChatBox ( "You have taken "..targetPlayer.." permission to use /lift", sourcePlayer ) else outputChatBox ("" .. targetPlayer .. " does not exist.", sourcePlayer) end end addCommandHandler ( "Lper", liftPermission ) addCommandHandler("Lift", function( thePlayer, Command ) -- You forgot function here if getElementData(thePlayer, "lift.permission", true ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) and got this ERROR: Lift\lift.lua:16: attempt to concatenate local 'targetPlayer' (a boolean value) What now ? Edited August 20, 2012 by Guest Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 Example 1 tPlayer = getPlayerFromName(targetPlayer) if tPlayer then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /lift", sourcePlayer) end Example 2 function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end tPlayer = getPlayerFromNamePart(targetPlayer) if tPlayer then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..getPlayerName(tPlayer).." permission to use /lift", sourcePlayer) end Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 (edited) this is correct ? local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function permissionl() tPlayer = getPlayerFromName(targetPlayer) if tPlayer then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", sourcePlayer) end end addCommandHandler("Lper", permissionl) addCommandHandler("lift", function( thePlayer, Command ) if getElementData(thePlayer, "lift.permission", true ) then liftWarpPlayer(thePlayer) else outputChatBox ( "#FF0000Permission: You Don't have Permission to use This Command", getRootElement(), 255, 255, 255, true ) end end ) EDIT: Warning: Lift\lift.lua:7: Bad argument @ getPlayerFromName' Help!!! Edited August 20, 2012 by Guest Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if getElementData(player, "lift.permission") then setElementData(tPlayer, "Lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "Lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 TAPL said: local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if getElementData(player, "lift.permission") then setElementData(tPlayer, "Lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "Lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) Thnx but i can just remove permission by using /Lper Playername how to give Permission ? Link to comment
sockz Posted August 20, 2012 Share Posted August 20, 2012 local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if getElementData(player, "lift.permission", false) then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 sockz said: local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if getElementData(player, "lift.permission", false) then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) still can't give permission, just can remove Link to comment
sockz Posted August 20, 2012 Share Posted August 20, 2012 if you have permission, it'll take it (if use again), if you dont, it'll give. remember to restart resource Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if not getElementData(tPlayer, "lift.permission") then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 sockz said: if you have permission, it'll take it (if use again), if you dont, it'll give.remember to restart resource I restart resource 5 times and binded /Lper Playername but still getting removepermission Link to comment
Perfect Posted August 20, 2012 Author Share Posted August 20, 2012 TAPL said: local lift = createObject(8231, -1326, -67, 55) createBlipAttachedTo(lift, 5) setElementData(lift, "vglueable", true, true) setElementDoubleSided( lift, true) function liftPermission(player,cmd,targetPlayer) tPlayer = getPlayerFromName(targetPlayer) if tPlayer then if not getElementData(tPlayer, "lift.permission") then setElementData(tPlayer, "lift.permission", true) outputChatBox("You have granted "..targetPlayer.." permission to use /Lift", player) else setElementData(tPlayer, "lift.permission", false) outputChatBox("You have removed "..targetPlayer.." permission to use /Lift", player) end end end addCommandHandler("Lper", liftPermission) addCommandHandler("Lift", function(player) if getElementData(player, "lift.permission") then liftWarpPlayer(player) else outputChatBox("#FF0000Permission: You Don't have Permission to use This Command", player, 255, 255, 255, true) end end) Wow, worked , thnx!!! can you tell me why that not work before ? and How to attachElement ?Pls function attachplayer(player,cmd) attachElements ( lift, players, 0, 0, 5 ) end function unattachplayer(player,cmd) detachElements(lift,player) addCommandHandler("attlift",attachplayer) addCommandHandler("unattlift",unattachplayer) P Link to comment
sockz Posted August 20, 2012 Share Posted August 20, 2012 line 9. looks like you cant check if the data is false, i suppose the whole line turns nil as it doesn't exist. Link to comment
TAPL Posted August 20, 2012 Share Posted August 20, 2012 because there were wrong arguments, i was writing it quickly .. This if getElementData(player, "lift.permission") then was sholud be if not getElementData(tPlayer, "lift.permission") then and this have wrong Data name, was should be lift.permission not Lift.permission setElementData(tPlayer, "Lift.permission", true) setElementData(tPlayer, "Lift.permission", false) EDIT function attachplayer(player,cmd) attachElements ( lift, players, 0, 0, 5 ) end function unattachplayer(player,cmd) detachElements(lift,player) addCommandHandler("attlift",attachplayer) addCommandHandler("unattlift",unattachplayer) should be: function attachplayer(player) attachElements(player, lift, 0, 0, 5) end addCommandHandler("attlift",attachplayer) function unattachplayer(player) detachElements(player,lift) end addCommandHandler("unattlift",unattachplayer) Link to comment
Perfect Posted August 21, 2012 Author Share Posted August 21, 2012 Thnx and 1) i want to attach a door to lift, which can open and close by command ? 2) i want a godmode on when player is in lift ? 3) Can you guys help me pls ? EDIT: I am falling down always when lift move somewhere, how to stop falling down from Lift ? Please please reply 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