Shady1 Posted January 26, 2022 Share Posted January 26, 2022 (edited) hello mta community, I've been dealing with a new script for a few days, but I need some information, I'm waiting for your nice comments for your help on this. I will make some interiors private for admins, only admins will be able to login. Edited January 26, 2022 by eoL|Shady wrong code Link to comment
TMTMTL Posted January 26, 2022 Share Posted January 26, 2022 You haven't posted any of the code or what you're really trying to achieve? Link to comment
Shady1 Posted January 26, 2022 Author Share Posted January 26, 2022 function createTeleportMarker(startX, startY, startZ, endX, endY, endZ, teleportInterior, markerInterior) local marker = createMarker(startX, startY, startZ, "cylinder", 2.0, 255, 255, 255, 0) setElementInterior(marker, markerInterior) teleportDatas[marker] = {startX = startX, startY = startY, startZ = startZ, endX = endX, endY = endY, endZ = endZ, teleportInterior = teleportInterior} table.insert(InteriorMarkers, marker) end addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getElementsByType("player")) do bindKey(player, "F", "down", teleportPlayer) end addEventHandler("onPlayerJoin", root, function() bindKey(source, "F", "down", teleportPlayer) end ) addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if(getElementType(hitElement) == "player") then local isVehicle = getPedOccupiedVehicle(hitElement) if(isVehicle) then return end for i=1,#InteriorMarkers do if(source == InteriorMarkers[i]) then triggerClientEvent(hitElement, "InteriorInfoVisible", hitElement, true) end end end end ) addEventHandler("onMarkerLeave", root, function(leaveElement, matchingDimension) if(getElementType(leaveElement) == "player") then local isVehicle = getPedOccupiedVehicle(leaveElement) if(isVehicle) then return end for i=1,#InteriorMarkers do if(source == InteriorMarkers[i]) then triggerClientEvent(leaveElement, "InteriorInfoVisible", leaveElement, false) end end end end ) function teleportPlayer(player) for i=1,#InteriorMarkers do if(isElementWithinMarker(player, InteriorMarkers[i])) then triggerClientEvent(player, "InteriorInfoVisible", player, false) setElementInterior(player, teleportDatas[InteriorMarkers[i]].teleportInterior) setElementPosition(player, teleportDatas[InteriorMarkers[i]].endX, teleportDatas[InteriorMarkers[i]].endY, teleportDatas[InteriorMarkers[i]].endZ) break end end end forgot to send codes. client : function drawInteriorInfo() if(isInteriorInfoVisible) then dxDrawBorderedText(1.5 * relX, "Press 'F' to Use Door.", screenW/2, 850 * relY, screenW/2, 850 * relY, tocolor(255, 255, 255, 255), 2.2 * relX, "default-bold", "center", "center") end end addEventHandler("onClientRender", root, drawInteriorInfo) only admin login and "Press 'F' to Use Door." Only admins can see this post Link to comment
The_GTA Posted January 26, 2022 Share Posted January 26, 2022 (edited) Hello eoL|Shady, I recommend you to use the hasObjectPermissionTo function on the player to check for privilege about entering the special interior or even receiving/showing the interior information. To achieve that you should conditionally-enclose related code for teleportation, marker-hit and marker-leave. But considering that you have not shown us the entire code, there is more to disable for non-admins than we can know. Edited January 26, 2022 by The_GTA Link to comment
Shady1 Posted January 26, 2022 Author Share Posted January 26, 2022 (edited) I understood your post and I will try this. When I came to the door, this text on the screen was "Press 'F' to Use Door." I have to use this code for only admins to see "hasObjectPermissionTo" Edited January 26, 2022 by eoL|Shady Link to comment
The_GTA Posted January 26, 2022 Share Posted January 26, 2022 1 minute ago, eoL|Shady said: When I came to the door, this text on the screen was "Press 'F' to Use Door." I have to use this code for only admins to see "hasObjectPermissionTo" Yes, you do. Check on the player element in the marker events. What is your problem? Link to comment
Shady1 Posted January 26, 2022 Author Share Posted January 26, 2022 I just wanted to have an admin login to some interiors, I had no idea how to do this, you helped,In the second question, I wanted only the admin to see the article.. I will look at the code we sent,normally i don't use this code much :=) Link to comment
The_GTA Posted January 26, 2022 Share Posted January 26, 2022 Just now, eoL|Shady said: I just wanted to have an admin login to some interiors, I had no idea how to do this, you helped,In the second question, I wanted only the admin to see the article.. You have to use the same function in the marker-hit and marker-leave event handlers. German: du sollst die gleiche Funktion in den Marker-Treffer und Marker-Verlassen Ereignis-Behandlern nutzen. 1 Link to comment
Shady1 Posted January 26, 2022 Author Share Posted January 26, 2022 Mein Englisch ist vielleicht ein bisschen schlecht, aber jetzt verstehe ich es,Danke. Link to comment
The_GTA Posted January 26, 2022 Share Posted January 26, 2022 (edited) 2 minutes ago, eoL|Shady said: Mein Englisch ist vielleicht ein bisschen schlecht, aber jetzt verstehe ich es,Danke. No Problem. The solution to your inquiry is that simple. And I know from your background that you are of German heritage. Thus if you want to have German-only support requests answered by me, please post threads in the German sub-forums and mention my name. I am fully competent to answer in German only if it helps you understand the topics much better. Edited January 26, 2022 by The_GTA 1 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