Mr.Loki Posted December 17, 2014 Posted December 17, 2014 Ok so i have been working on this warp script for the past hour and i cant seem to get it to work... i get no errors is the debug what am i doing wrong? function letsRoll (source, comm, destination) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) or isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then if destination == et then setElementPosition ( source, 7310.5,-2082.821,2587.76, true ) elseif destination == island then setElementPosition ( source, 7092.68,-2012.89,1, true ) elseif destination == rr then setElementPosition ( source, 217.34,1822.79,6.41, true ) elseif destination == rrg then setElementPosition ( source, 217.34,1822.79,11.41, true ) elseif destination == area then setElementPosition ( source, 209.19,1934.13,23.24, true ) elseif destination == ic then setElementPosition ( source, 1334.96,2068.11,25.59, true ) end end end addCommandHandler ( "warp", letsRoll ) [REL]Cinema Experience Beta 2.0 [TUT]Object offsets with OOP. [TUT] Adding a Discord bot to your server. Discord: Loki#7355
Anubhav Posted December 17, 2014 Posted December 17, 2014 The problem is at the elseif and if statments, when you are comparing and checking if the value is that, it's not a string. like this: elseif destination == rrg change it to "rrg" See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Mr.Loki Posted December 17, 2014 Author Posted December 17, 2014 The problem is at the elseif and if statments, when you are comparing and checking if the value is that, it's not a string.like this: elseif destination == rrg change it to "rrg" thanks its working now but i thought that solving his would help me with another code i had in the script but it didn't function warpto(source, _, target1, target2) if (taget2) then local q1,w1,e1 = getElementPosition(gPPN(target1)) setElementPosition(gPPN(target2), q1,w1,e1+10,true) else local q,w,e = getElementPosition(gPPN(target1)) setElementPosition(source, q+.5,w+.5,e+1,true) end end addCommandHandler("tp",warpto) function gPPN(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end i am trying to warp 1 player to the next unless a second player is provided it warps me to the target... but when i try to warp a player to a next player it just warps me to the target1 [REL]Cinema Experience Beta 2.0 [TUT]Object offsets with OOP. [TUT] Adding a Discord bot to your server. Discord: Loki#7355
Anubhav Posted December 17, 2014 Posted December 17, 2014 See the example 3 @ https://wiki.multitheftauto.com/wiki/SetElementPosition 1 See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
Mr.Loki Posted December 17, 2014 Author Posted December 17, 2014 ok i reviweed the script and i added function warpto(source, _, target1, target2) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) or isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then if (target1 and target2) then local q1,w1,e1 = getElementPosition(gPPN(target2)) setElementPosition(gPPN(target1), q1,w1,e1+10,true) elseif ( target1 and not target2 ) then local q,w,e = getElementPosition(gPPN(target1)) setElementPosition(source, q+.5,w+.5,e+1,true) end end end addCommandHandler("tp",warpto) and it worked perfectly thank you for your help [REL]Cinema Experience Beta 2.0 [TUT]Object offsets with OOP. [TUT] Adding a Discord bot to your server. Discord: Loki#7355
Anubhav Posted December 17, 2014 Posted December 17, 2014 No problem! See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
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