BriGhtx3 Posted May 22, 2011 Share Posted May 22, 2011 local localPlayer = getLocalPlayer() function fuehrerschein() if isPedInVehicle(localPlayer) then local fuehrerscheinda = tostring(getElementData(localPlayer,"Scheine")) if fuehrerscheinda == "0" then outputChatBox("Du hast keinen Führerschein!", thePlayer,255,0,0) removePedFromVehicle ( localPlayer ) end end end addEventHandler( "onClientPlayerVehicleEnter", localPlayer, fuehrerschein ) My Problem : This Code has to be clientside, but the removePedFromVehicle serverside. How do I get this function serverside? The outputChatBox isn't red, like it should be. Thanks Link to comment
DakiLLa Posted May 22, 2011 Share Posted May 22, 2011 Well, you can trigger a server event to remove yourself from a vehicle. --client side local localPlayer = getLocalPlayer() function fuehrerschein() if isPedInVehicle(localPlayer) then local fuehrerscheinda = tostring(getElementData(localPlayer,"Scheine")) if fuehrerscheinda == "0" then outputChatBox("Du hast keinen Führerschein!",255,0,0) --removed 'thePlayer', look wiki for details triggerServerEvent( "removeMe", localPlayer ) end end end addEventHandler( "onClientPlayerVehicleEnter", localPlayer, fuehrerschein ) --SERVER side addEvent( "removeMe", true ) addEventHandler( "removeMe", getRootElement(), function() removePedFromVehicle( source ) end ) Link to comment
BriGhtx3 Posted May 22, 2011 Author Share Posted May 22, 2011 Alright . Why didn't I think about triggerevents -.- Thanks! Ok next question : How can I differ between a car, bike, airplane, helicopter? 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