Jump to content

noob here what am i doing wrong?


Recommended Posts

Just started to learn but am stuck at getting a car to spawn. here is what my script looks like:

 

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHandler()
	spawnPlayer(source, spawnX, spawnY, spawnZ)
	fadeCamera(source, true)
	setCameraTarget(source, source)
	outputChatBox("Welcome to My Server", source)
end
function createVehicleForPlayer(thePlayer, greet, vehicleModel)
	local x,y,z = getElementPosition(thePlayer) -- get the position of the player
	x = x + 5
	local createdVehicle = createVehicle(tonumber(602),x,y,z)	
	if (createdVehicle == false) then	
		outputChatBox("Failed to create vehicle.",thePlayer)
	end
end
addCommandHandler("createvehicle", createVehicleForPlayer)

 

Link to comment
12 minutes ago, Psychotic_OZ said:

oh oops somehow i removed that but i cant get a car to spawn using the /greet

createvehicle is the command, not greet.

greet, in that case, is the command name. which is (greet = "createvehicle")

Edited by pro-mos
Link to comment

so far i know how to spawn the player, give a car with /car and give weapon with /ak47, thats it for now, im such a noob

 

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHandler()
	spawnPlayer(source, spawnX, spawnY, spawnZ)
	fadeCamera(source, true)
	setCameraTarget(source, source)
	outputChatBox("Welcome to My Server", source)
end
addEventHandler("onPlayerJoin", getRootElement(), joinHandler)
function consoleGive ( thePlayer, commandName, weaponID, ammo )
    local status = giveWeapon ( thePlayer, 30, 200, true)
	if ( not status) then
	       outputConsole ("Failed to give weapon", thePlayer)
	end
end
addCommandHandler ( "ak47", consoleGive )
function createVehicleForPlayer(thePlayer, command, vehicleModel)
	local x,y,z = getElementPosition(thePlayer) -- get the position of the player
	x = x + 5
	local createdVehicle = createVehicle(tonumber(602),x,y,z)	
	if (createdVehicle == false) then	
		outputChatBox("Failed to create vehicle.",thePlayer)
	end
end
addCommandHandler("car", createVehicleForPlayer)

 

Also how do i see my xyz position while in game?

Link to comment
56 minutes ago, Psychotic_OZ said:

Also how do i set timers for commands? say I want it do you can only /nos ever 2 mins and if you /nos within that timefram it says you must wait another <time> seconds

local status = {}


function nos(p, c)
	if status[p] and status[p].allowed then outputChatBox("You can't do this now",source) return end
	
	-- what nos does here

	status[p] = {}
	status[p].blocked = true
	status[p].timer = setTimer(function () timer[p].blocked = false end, 2000, 1)
end

try this this blocks the command for 2 secs u can increase the time if u want and if u want time to be mentioned u can use https://wiki.multitheftauto.com/wiki/GetTimerDetails

2 hours ago, Psychotic_OZ said:

Also is there a way to add a logo/picture to the screen for the server? if yes how?

https://wiki.multitheftauto.com/wiki/DxDrawImage

Edited by kikos500
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...