Jump to content

help me


Guest

Recommended Posts

No errors no warning in debugscript 

I wan't only vips can spawn hydra by typing /cv 520 or /cv Hydra

function onPlayerCommand ( cmd, thePlayer )
          		local p = {getElementPosition(source)}
          		for _,vehicle in ipairs(getElementsByType("vehicle")) do
            		if getElementModel(vehicle) == 520 then
              			local v = {getElementPosition(vehicle)}
              			if getDistanceBetweenPoints3D(p[1], p[2], p[3], v[1], v[2], v[3]) < 10 then
              				destroyElement(vehicle)
	local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
    if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then
	outputChatBox ( "● You must be VIP to spawn this vehicle", thePlayer, 255, 0, 0 )
end
end
end
end
end
addEventHandler("onPlayerCommand", root, onPlayerCommand)

 

Link to comment
function onPlayerCommand(thePlayer, command, vehicleModel) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
if (tonumber(vehicleModel) == 520) then return 	outputChatBox ( "● You must be VIP to spawn this vehicle", thePlayer, 255, 0, 0 )
 end
 local x,y,z = getElementPosition(thePlayer) x = x + 5
 local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) 
    outputChatBox("●"..getVehicleName(createdVehicle).."Has been spawned",thePlayer, 255, 0, 0 )
 end
 addCommandHandler("cv", onPlayerCommand)

@Scarfas

Edited by DiGiTal
Link to comment

of course

i forgot to add a handler

function onPlayerCommand(thePlayer, command, vehicleModel) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
if (tonumber(vehicleModel) == 520) then return 	outputChatBox ( "● You must be VIP to spawn this vehicle", thePlayer, 255, 0, 0 )
 end
 local x,y,z = getElementPosition(thePlayer) x = x + 5
 local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) 
    outputChatBox("●"..getVehicleName(createdVehicle).."Has been spawned",thePlayer, 255, 0, 0 )
 end
 addCommandHandler("cv", onPlayerCommand)

add Command , it's an handler by a command, means when player do command (ex:/greet) it handle a function ( here it's onPlayerCommand)

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...