waqaarali Posted March 17, 2013 Posted March 17, 2013 Ok so i am making an RPG Server with my friends! I have made one complete job which is police/cop and i want to make a script only police officers can enter police vehicles anyone help me out ;(
iPrestege Posted March 17, 2013 Posted March 17, 2013 Do it with team? getPlayerTeam getTeamName getElementModel "onVehicleStartEnter" cancelEvent
cs8898 Posted March 17, 2013 Posted March 17, 2013 you like to make a rpg-server with now knowlage about events??? ok lets start policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true } --[objectid]=policecar(true/false) if an object isn't listed its autamaticly false function getPlayerTeamPolice(player) if policeVehicles[getElementModel(source)] if getPlayerTeam(player) <> "police" then --if player team not police cancleEvent() outputChatBox("you are not an police man!") end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), getPlayerTeamPolice ) that is a serverside script watch next time the wiki! you find also that on https://wiki.multitheftauto.com/wiki/On ... StartEnter
Anderl Posted March 17, 2013 Posted March 17, 2013 you like to make a rpg-server with now knowlage about events???ok lets start policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true } --[objectid]=policecar(true/false) if an object isn't listed its autamaticly false function getPlayerTeamPolice(player) if policeVehicles[getElementModel(source)] if getPlayerTeam(player) <> "police" then --if player team not police cancleEvent() outputChatBox("you are not an police man!") end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), getPlayerTeamPolice ) that is a serverside script watch next time the wiki! you find also that on https://wiki.multitheftauto.com/wiki/On ... StartEnter Your code is wrong, and you should use local variables instead.
iPrestege Posted March 17, 2013 Posted March 17, 2013 -- Server Side! addEventHandler("onVehicleStartEnter",root, function (player) local model = getElementModel(source) local team = getPlayerTeam ( player ) local Name = ( team and getTeamName ( team )) if ( Name ~= "Police Team Name" ) then if ( model == 596 or model == 597 or model == 598 or model == 599 ) then cancelEvent() outputChatBox(" ** Police Vehicle's Only!",player,255,0,0,true) end end end )
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