MAB Posted October 22, 2015 Share Posted October 22, 2015 i am making a clothes shop and i put getPlayerAccount and the player is still able to enter without log in the server.... why i am setting the account data? to shortcut the scripts.. like when he enter the exiting marker i do this function out (h,m) if getElementType(h) == .. etc and m then ... etc local account = getPlayerAccount(h) local dataX = getAccountData(account,"sc.x") -- etc setElementInterior(h,0,dataX,dataY,dataZ) end end -- etc codes (server) : markers = { {x = 1456.58032,y = -1137.74512,z = 24.95742} } function createMarkers () for i = 1,#markers do m = createMarker(markers[i].x,markers[i].y,markers[i].z,"arrow",1.5,255,255,0,255) createBlip(markers[i].x,markers[i].y,markers[i].z,45) addEventHandler("onMarkerHit",m,enter) end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),createMarkers) function enter (h,m) if getElementType(h) == "player" then if m then if isPedInVehicle(h) == false then local x,y,z = getElementPosition(h) local account = getPlayerAccount(h) if account then setElementInterior(h,18,161.44983,-94.16076,1001.80469) toggleControl(h,"fire",false) toggleControl(h,"aim_weapon",false) setAccountData(account,"sc.x",x) setAccountData(account,"sc.y",y) setAccountData(account,"sc.z",z) setPlayerHudComponentVisible(h,"radar",false) else exports["topbarchat"]:sendClientMessage("You must login before you enter this shop.",h,255,255,0,false,5) end end end elseif getElementType(h) == "vehicle" then local controller = getVehicleController (h) if controller then exports["topbarchat"]:sendClientMessage("You must login before you enter this shop.",controller,255,255,0,false,5) end end end function command (p) setElementInterior(p,0) setElementPosition(p,1461.99866,-1141.72632,24.39063) end addCommandHandler("re",command) Link to comment
t3wz Posted October 22, 2015 Share Posted October 22, 2015 getPlayerAccount will return an account even if player isn't logged (he will have a guest account), You have to use isGuestAccount. if not isGuestAccount ( account ) then -- registered account else -- guest account end Link to comment
MAB Posted October 22, 2015 Author Share Posted October 22, 2015 getPlayerAccount will return an account even if player isn't logged (he will have a guest account), You have to use isGuestAccount. if not isGuestAccount ( account ) then -- registered account else -- guest account end Thank you very much 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