Jump to content

Am nevoie de ajutor


ViperZz

Recommended Posts

Salut! Astăzi am decis să apelez la forum fiindcă aici pot găsi rezolvarea. Doresc și eu să mă ajute cineva cu un script pentru că anumite mașini să nu poată fi accesate de playeri normali, doar de admini. Dacă mă poate ajuta cnv îl rog să îmi dea mesaj. Mulțumesc!

Link to comment

Un script sincer n-am timp sa-l fac, insa te invit sa inverci, ai nevoie de 

Eventul : 'onPlayerVehicleEnter'

Functii: isObjectInAclGroup

 

Si daca te uiti pe wiki la isObjectInAclGroup ai un exemplu te poti Lua dupa el.

Succes.

Link to comment
function adminVehicle()
local car = getPedOccupiedVehicle(source)
local accName = getPlayerAccount(source)
local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
outputChatBox("Acces allowed", source, 255, 255, 255, true)
else
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
return cancelEvent()
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle)

Incearca asta

Link to comment
12 hours ago, Hydra said:

function adminVehicle()
local car = getPedOccupiedVehicle(source)
local accName = getPlayerAccount(source)
local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
outputChatBox("Acces allowed", source, 255, 255, 255, true)
else
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
return cancelEvent()
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle)

Incearca asta

@ViperZz , modifica tot codu cu asta deoarece nu o sa iti mearga cu ,,source"

function adminVehicle(thePlayer)
local car = getPedOccupiedVehicle(thePlayer)
local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
outputChatBox("Acces allowed", thePlayer, 255, 255, 255, true)
else
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and (getElementModel(car) == 411) then
return cancelEvent()
end
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), adminVehicle)

 

Edited by Hydra
Link to comment

Cu placere

 

local unallowedVeh = {422, 514, 674};

addEventHandler("onVehicleStartEnter", root, function(player)
	local model = getElementModel(source);
	for _,id in ipairs(unallowedVeh) do
		if (model == id) then
			if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then
				outputChatBox("You are not allowed to use this vehicle!", 255, 0, 0);
				cancelEvent();
			end
		end
	end
end);

 

Link to comment

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.
×
×
  • Create New...