Recommended Posts

help!

can anyone tell me how to block rino and some vehicle.

please......

Share this post


Link to post

Check if the vehicle entering is a Rhino ( event handler onvehicleenter ), and if it is, cancelEvent()

 

my keyboard ain't workin correctly.

  • Like 1

Share this post


Link to post

What do you mean how to block rhino and some vehicles?

Here you go from what I understand.

@sami2277

 

local blockedVehicles = {[432] = true}

function blockEnterOnBlockedVehicles(player, seat, jacked)
local model = getElementModel(source)
if isElement(source) and getElementType(source) == "vehicle" and (model and blockedVehicles[model]) then
if isElement(player) and getElementType(player) == "player" and seat == 0 then
cancelEvent(true, "blockedvehicle")
outputChatBox("You cannot enter blocked vehicles.", player, 255, 0, 0, false)
end
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), blockEnterOnBlockedVehicles)


This won't allow anyone to access the rhino as a driver. You may add more vehicles to the blockedVehicles list, you will need to add their vehicle ID like I did and set it to 'true' in order for it to work. You separate the list with commas.

Share this post


Link to post
3 minutes ago, sami2277 said:

i want to block only rino

So use the code above. And we don't know what you mean by "block".

Share this post


Link to post

Then use this code to block rhino. No one would be able to use the rhino on your server.

 

local blockedVehicles = {[432] = true}

function blockEnterOnBlockedVehicles(player, seat, jacked)
local model = getElementModel(source)
if isElement(source) and getElementType(source) == "vehicle" and (model and blockedVehicles[model]) then
if isElement(player) and getElementType(player) == "player" and seat == 0 then
cancelEvent(true, "blockedvehicle")
outputChatBox("You cannot enter blocked vehicles.", player, 255, 0, 0, false)
end
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), blockEnterOnBlockedVehicles)

 

  • Thanks 1

Share this post


Link to post
55 minutes ago, sami2277 said:

thanks it work

bu i also want to block mini gun weapon

function forbeed( _,aMyWeapon )

if ( aMyWeapon == 38 ) then

toggleControl( source,'fire',false )

outputChatBox ("#FF0000You Cannot Use This Weapon!",source, 255, 255, 255, true )
        else
        toggleControl( source,'fire',true )
        end
   end

addEventHandler( "onPlayerWeaponSwitch",root,forbeed)

Try This .

We Don't give ready scripts !! you should post a script and we edit it ... 

Edited by Legend<3
  • Like 1
  • Thanks 1

Share this post


Link to post

legent i make this script for rocket launcher weapon id is 35 but it is not block.

gea me a script to block rocket launcher

Share this post


Link to post
40 minutes ago, sami2277 said:

legent i make this script for rocket launcher weapon id is 35 but it is not block.

gea me a script to block rocket launcher

function forbeed( _,aMyWeapon )
if ( aMyWeapon == 38 or aMyWeapon == 35  ) then
toggleControl( source,'fire',false )
outputChatBox ("#FF0000You Cannot Use This Weapon!",source, 255, 255, 255, true )
        else
        toggleControl( source,'fire',true )
        end
   end
addEventHandler( "onPlayerWeaponSwitch",root,forbeed)

Use This .. 

Share this post


Link to post

Edit freeroam folder find weapons.lua +vehiles .lua edit both of them with notepadc++ remove the lines of id which u need to block

For example u need to remove ak47

Look for ak47weapon id then remove this ak47line only and save it and re- start freeroam again now u can't see ak47 in ur server same for vehicles+weapons +skins ...

I suggest to make a copy of weapons.lua+vehicles.lua before editing it so that when u want to add them again u need to just add those id lines again and save it and start it

Share this post


Link to post
17 hours ago, Khadeer143 said:

Edit freeroam folder find weapons.lua +vehiles .lua edit both of them with notepadc++ remove the lines of id which u need to block

For example u need to remove ak47

Look for ak47weapon id then remove this ak47line only and save it and re- start freeroam again now u can't see ak47 in ur server same for vehicles+weapons +skins ...

I suggest to make a copy of weapons.lua+vehicles.lua before editing it so that when u want to add them again u need to just add those id lines again and save it and start it

is better if he need to remove ak .. search for line and add -- so the line skiped .. ( for no copy and that long ..  idk x'D is just a suggestion :P )

function forbeed( _,aMyWeapon )
if ( aMyWeapon == 38 or aMyWeapon == 35  ) then
toggleControl( source,'fire',false )
toggleControl( source,'aim_weapon',false )
outputChatBox ("#FF0000You Cannot Use This Weapon!",source, 255, 255, 255, true )
        else
        toggleControl( source,'fire',true )
		toggleControl( source,'aim_weapon',true )
        end
   end
addEventHandler( "onPlayerWeaponSwitch",root,forbeed)

Use TESTED and WORK FINE .. just remove or remplace the old one ! @sami2277

Edited by Legend<3

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.