Darkwarrior Diesel Posted January 12, 2014 Share Posted January 12, 2014 Hi guys 2day, i made my first and simple script Im sooooo happy and gettin a great satisfaction for creating a good and useful script Plz note that im a newbie in scripting, i dont like downloadin scripts cause u dont learn from this. i want to make my own ones. If anyone could tell me ur server name, and help me more by givin me advices about how to handle a server, and etc.... it would be great, or if someone got a server and wants me to script for them, tell me, even if im a newbie, i will try to do it ok, so heres my script, u can do whatever u want with it, i would be happy to know that someone is using my script godVehicle.lua : function godVehicle(thePlayer, command, vehicleModel) local x,y,z = getElementPosition(thePlayer) x = x + 5 newVehicle = createVehicle(411, x, y, z) setVehicleDamageProof(newVehicle, true) if (newVehicle == false) then outputChatBox("failed to create vehicle.",thePlayer) end end addCommandHandler("admincar", godVehicle) meta.xml : "Darkwarrior" type="misc" name="My Server" description="damage proof car" version="0.1"/> thats it plz, be kind to me and dont call me noob, it hurts im still a newbie to scripting Peace guys, have a nice journey, and yeah, i know its late but still Happy new year Link to comment
Bzz335 Posted January 12, 2014 Share Posted January 12, 2014 (edited) r Edited January 12, 2014 by Guest Link to comment
xXMADEXx Posted January 12, 2014 Share Posted January 12, 2014 local x,y,z = getElementPosition(source) You know he was just posting his script for people to use right? This isn't the place to post your scripts, that is what the community website is for. (Studding scripts off the community website isn't a bad way to help you learn either) Link to comment
Darkwarrior Diesel Posted January 12, 2014 Author Share Posted January 12, 2014 why using source instead of thePlayer??? O__O Link to comment
xXMADEXx Posted January 12, 2014 Share Posted January 12, 2014 why using source instead of thePlayer??? O__O It's not, your code is correct. Link to comment
Darkwarrior Diesel Posted January 12, 2014 Author Share Posted January 12, 2014 ok thank u Link to comment
Bzz335 Posted January 12, 2014 Share Posted January 12, 2014 Why command "admincar",but spawn car can everyone?! And everyone can spam cars and create laggs on server,bro. Link to comment
Darkwarrior Diesel Posted January 12, 2014 Author Share Posted January 12, 2014 its a command, u can add it in acl list, allow only admins to use it Link to comment
Bzz335 Posted January 12, 2014 Share Posted January 12, 2014 Lol.What you can say about spam cars? Why you didn't add some strings: setElementData( thePlayer, 'spawned', true ) if getElementData( thePlayer, 'spawned' ) then ... end Link to comment
Forrest Posted January 12, 2014 Share Posted January 12, 2014 Lol.What you can say about spam cars?Why you didn't add some strings: setElementData( thePlayer, 'spawned', true ) if getElementData( thePlayer, 'spawned' ) then ... end Why don't you stop acting like you're top shit? You ruined it by trying to correct his script the first time around and getting it wrong. Link to comment
Darkwarrior Diesel Posted January 13, 2014 Author Share Posted January 13, 2014 Guys im still a newbie in scripting. i dont know much but im still learning So if ur tellin me y i did not add this or that, my answer is that i dont know about that. instead of try to correcting me or my script (yeah its good if ur try to correct it, im also learning ) just guide me. Tell me what i should learn more, and where should i learn it (gimme da link ) i will follow ur instructions Peace guys Just guide me. One love One Heart Peace God bless Link to comment
xXMADEXx Posted January 13, 2014 Share Posted January 13, 2014 Guys im still a newbie in scripting. i dont know much but im still learning So if ur tellin me y i did not add this or that, my answer is that i dont know about that. instead of try to correcting me or my script (yeah its good if ur try to correct it, im also learning ) just guide me. Tell me what i should learn more, and where should i learn it (gimme da link ) i will follow ur instructions Peace guys Just guide me.One love One Heart Peace God bless No need to get upset! Everyone has to start somewhere, and I like that you're making scripts rather than just asking people to make them for you. And to keep everyone quiet about the "server lag" thing, here you are: local vehicles = { } function godVehicle(thePlayer, command, vehicleModel) if ( isElement ( vehicles[thePlayer] ) ) then destroyElement ( vehicles[thePlayer] ) end local x,y,z = getElementPosition(thePlayer) local x = x + 5 vehicles[thePlayer] = createVehicle(411, x, y, z) setVehicleDamageProof(newVehicle, true) if ( not vehicles[thePlayer] ) then outputChatBox("failed to create vehicle.",thePlayer) end end addCommandHandler("admincar", godVehicle) addEventHandler ( "onPlayerQuit", root, function ( ) if ( isElement ( vehicles[source] ) ) then destroyElement ( vehicles[source] ) end end ) Link to comment
Darkwarrior Diesel Posted January 13, 2014 Author Share Posted January 13, 2014 i did not understand the first,fourth and fifth line. can u explain it to me ??? plz Link to comment
Atton Posted January 13, 2014 Share Posted January 13, 2014 That might be helpful to you. function allvehiclesaredoomed() vehicles = getElementsByType("vehicle") for i,v in ipairs(vehicles) do destroyElement(v) end end setTimer(allvehiclesaredoomed, 3600000, 0) or function DMGf (plr) local DM = getPedOccupiedVehicle(plr) if (isPedInVehicle(plr)) then if (not DM) then return end if isVehicleDamageProof(DM) == false then setVehicleDamageProof(DM,true) outputChatBox("Damage proof on.",plr) else setVehicleDamageProof(DM,false) outputChatBox("Damage proof off.",plr) end end end addCommandHandler("Cargodmode",DMGf) Link to comment
Gtagasje Posted January 13, 2014 Share Posted January 13, 2014 Uhm, not sure if it was an accident when copying, but you have an error in your meta. This: "Darkwarrior" type="misc" name="My Server" description="damage proof car" version="0.1"/> Should be this: "Darkwarrior" type="misc" name="My Server" description="damage proof car" version="0.1"/> Link to comment
Darkwarrior Diesel Posted January 14, 2014 Author Share Posted January 14, 2014 Thnks Gtagasje, typin mistake im sory. And xXMADEXx and Atton, guys, thnk u soooo much for tryin to help me, but man, i cant accept ur codes simply bekoz i dont understand some lines in it but yeah, by givin me ur codes, u have guided me , now i know wat i have to look for and wat i need to learn( about the spam thing ) I told ya from the beginning, "just guide me and i will follow ur instrucs " Peace guys, and im sory for late reply, i aint got lots of time bekoz i work But still, thnks my friends and much love to u all. bye Haile Selassie I Jah bless Link to comment
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