Jump to content

[HELP] vehicle spawn


Recommended Posts

hi guyys!

 

plz give me a admin vehicle system and destroy admin vehicle and destroyall admin vehicles

commands : /veh /destroy /destroyall

outputChatBox's : 

/veh

if (succes) : Vehicle Created! "else" Please Try Again

when type /veh 

server : Syxtax : /veh

your not a admin!

..............................................

/destroy

this is not a admin vehicle

destory succes!

your not a admin!

Syntax : /destroy

.............................................

/destroyall 

all vehicles destroy Succes!

your not a admin!

Syntax : /destroyall

..............................................

thanks!

Link to comment

i have also added a command for to know, the name,id and positions of the car by /vehs

---- STARTS ----
Veh={}
function veh(plr,cmd,modelid)
  local accName = getAccountName ( getPlayerAccount ( plr ) ) -- get his account name
     if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then return outputChatBox("you are not a admin to use this comand",plr) end
	 elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
	 x,y,z=getElementPosition(plr)
	 x=x+5
	 local id=tonumber(vehicleModel)
	 car=createVehicle(id,x,y,z)
	if car then
	setElementData(car,"Id",id)
	setElementData(car,"Name",getVehicleNameFromModel(id))
	setElementData(car,"x",x)
	setElementData(car,"y",y)
	setElementData(car,"z",z)

	outputChatBox("vehicule id"..modelid.."has been created",plr)
	
end
end
addCommandHandler("veh",veh)

function destroy(plr,cmd)

 local accName = getAccountName ( getPlayerAccount ( plr ) ) -- get his account name
    if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then return outputChatBox("you are not a admin to use this comand",plr) end
	elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
	occupe=getPedOccupiedVehicle(plr)
if occupe then
destroyElement(occupe)
end
end
addCommandHandler("destroy",destroy)

function destroyall(plr,cmd)
x1,y2,z3=getElementPosition(getElementsByType("vehicle"))
for k,v in pairs(getElementPosition(getElementsByType("vehicle"))) do
if x1==	getElementData(car,"x") and y2==getElementData(car,"y") and z3==getElementData(car,"z") then
destroy(car)
else
outputChatBox("error",plr)
end
end
end

addCommandHandler("destroyall",destroyall)

function vehs(plr,cmd)

outputChatBox(getElementData(getElementsByType("vehicle"),"Id"),plr)
outputChatBox(getElementData(getElementsByType("vehicle"),"Name"),plr)
outputChatBox(getElementData(getElementsByType("vehicle"),"x"),plr)
outputChatBox(getElementData(getElementsByType("vehicle"),"y"),plr)
outputChatBox(getElementData(getElementsByType("vehicle"),"z"),plr)

end
addCommandHandler("vehs",vehs)

 

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