Vector Posted July 14, 2013 Share Posted July 14, 2013 SERVER-SIDE addEventHandler ( "onMarkerHit", createMarker ( 1791.537, 656.511, 17.626, 'cylinder', 2.0, 255, 0, 0, 150 ) , function ( hitElement, matchingDimension ) -- check first if it´s a player ... if getElementType (hitElement) ~= "player" then return; end; if ( getElementType ( hitElement ) == "vehicle" ) then setElementFrozen ( hitElement, true ) -- we tell player that he is frozen ... triggerClientEvent (hitElement, "onPlayerFrozen", getRootElement ()); setTimer ( function (thePlayer) -- we tell player that will be unfrozen .. triggerClientEvent (thePlayer, "onPlayerUnfrozen", getRootElement ()); -- unfroze the player. setElementFrozen (thePlayer, false); end, 5000, 1, hitElement); end end ); -- now in client-side .... -- this function will draw a message in the middle of the screen saying that he is frozen. -- local function drawMessage () local screenWidth, screenHeight = guiGetScreenSize (); dxDrawText ("YOU ARE NOW FROZEN", screenWidth - 50, screenHeight); end; -- we need to handle events. addEvent ("onPlayerFrozen", true); addEvent ("onPlayerUnfrozen", true); addEventHandler ("onPlayerFrozen", getRootElement (), function () addEventHandler ("onClientRender", getRootElement (), drawMessage); end); addEventHandler ("onPlayerUnfrozen", getRootElement (), function () -- we don´t want the message appears. we remove the event handler .. removeEventHandler ("onClientRender", getRootElement (), drawMessage); end); 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