benwilkins Posted June 14, 2013 Share Posted June 14, 2013 function showplat ( command ) if getKeyState("p") then if isPedInVehicle(localPlayer) then local localPlayerOccupiedVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) local plateText = getVehiclePlateText ( localPlayerOccupiedVehicle ) local x, y, z = getElementPosition(localPlayerOccupiedVehicle) local tx, ty = getScreenFromWorldPosition(x, y, z, 5000, false) dxDrawText(plateText, tx, ty, tx, ty+10, tocolor(255, 255, 255, 200), 1, "bankgothic", "center", "center") end end end bindKey ( "p", "down", showplat ) I am testing something out, and I am trying to make it so when I hole P then the text will appear above the car, but when I press P, it appears and then disappears straight away. Thanks! Link to comment
iPrestege Posted June 14, 2013 Share Posted June 14, 2013 isHandler = nil function showplat ( ) if isPedInVehicle(localPlayer) and getKeyState ("p") == true then if isHandler == true then return end addEventHandler('onClientRender',root,Draw) isHandler = true end end bindKey ( "p", "down", showplat ) function Draw ( ) if not isPedInVehicle ( localPlayer ) then return end local localPlayerOccupiedVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) local plateText = getVehiclePlateText ( localPlayerOccupiedVehicle ) local x, y, z = getElementPosition(localPlayerOccupiedVehicle) local tx, ty = getScreenFromWorldPosition(x, y, z, 5000, false) dxDrawText(tostring(plateText), tx, ty, tx, ty+10, tocolor(255, 255, 255, 200), 1, "bankgothic", "center", "center") end You have to use a render event to draw dx functions try this and tell me. Link to comment
benwilkins Posted June 14, 2013 Author Share Posted June 14, 2013 Thanks for the quick reply! But it just stays there now, when I release the button, it doesn't disapper. Link to comment
iPrestege Posted June 14, 2013 Share Posted June 14, 2013 Copy it again and make sure you are in a vehicle. Link to comment
benwilkins Posted June 14, 2013 Author Share Posted June 14, 2013 Still displays after I let go of "P". When I press in P, the text should display, and when I let go of P, the text should be removed. Link to comment
benwilkins Posted June 14, 2013 Author Share Posted June 14, 2013 Also, there is no errors in the debug Link to comment
iPrestege Posted June 14, 2013 Share Posted June 14, 2013 Are you sure it's a client side | = ? Link to comment
iPrestege Posted June 14, 2013 Share Posted June 14, 2013 Works fine here when i press 'p' And i'm in a vehicle the text works fine. 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