Jump to content

Damage proof Car :DDDD


Recommended Posts

Hi guys :D

2day, i made my first and simple script :) Im sooooo happy and gettin a great satisfaction for creating a good and useful script :D 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 :D

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 :D

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 :DHappy new year

Link to comment
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
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

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 :D ) just guide me. Tell me what i should learn more, and where should i learn it (gimme da link ;) ) i will follow ur instructions :D Peace guys :) Just guide me.

One love :) One Heart

Peace ;) God bless

Link to comment
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 :D ) just guide me. Tell me what i should learn more, and where should i learn it (gimme da link ;) ) i will follow ur instructions :D 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

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

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

Thnks Gtagasje, typin mistake :D 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 :D, 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 :D "

Peace guys, and im sory for late reply, i aint got lots of time bekoz i work :/

But still, thnks my friends :D and much love to u all.

bye :) Haile Selassie I

Jah bless

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