Psychotic_OZ Posted July 12, 2017 Posted July 12, 2017 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)
pro-mos Posted July 12, 2017 Posted July 12, 2017 You need to bind an event to joinHandler function addEventHandler ( "onPlayerJoin", root, joinHandler)
Psychotic_OZ Posted July 12, 2017 Author Posted July 12, 2017 20 minutes ago, pro-mos said: You need to bind an event to joinHandler function addEventHandler ( "onPlayerJoin", root, joinHandler) oh oops somehow i removed that but i cant get a car to spawn using the /greet
pro-mos Posted July 12, 2017 Posted July 12, 2017 (edited) 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 July 12, 2017 by pro-mos
Psychotic_OZ Posted July 12, 2017 Author Posted July 12, 2017 22 minutes ago, pro-mos said: createvehicle is the command, not greet. greet, in that case, is the command name. which is (greet = "createvehicle") i see, it works now. Now wiki is a little vague
Psychotic_OZ Posted July 12, 2017 Author Posted July 12, 2017 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?
pa3ck Posted July 12, 2017 Posted July 12, 2017 When using the resource freeroam, you can open the F1 panel and I think it shows your position, but as far as I know there's also a /gp command which outputs your x, y, z coords.
Psychotic_OZ Posted July 12, 2017 Author Posted July 12, 2017 Also is there a way to add a logo/picture to the screen for the server? if yes how?
Psychotic_OZ Posted July 12, 2017 Author Posted July 12, 2017 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
kikos500 Posted July 12, 2017 Posted July 12, 2017 (edited) 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 July 12, 2017 by kikos500
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now