Jump to content

Genetikk

Members
  • Posts

    1
  • Joined

  • Last visited

Details

  • Gang
    Rare Hyenas

Genetikk's Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. Hello, I started with my own project and it is a Shooter Server for the beginning. I am a Newbie in Scripting and till today I had luck, scripting the important scripts for the server. Now I have got Problems with scripting the Spawnprotection for Vehicles (Gamemode = Race). I really have got problems with the setTimer function and I hope you can help me, writing the Script, so people might just shoot, after 5 seconds of the Map is over. Here's the Shooter Script (Clientside): cLP = getLocalPlayer() screenWidth, screenHeight = guiGetScreenSize() function cRStest() setTimer(resourcesCheck, 10000, 1) end addEventHandler("onClientResourceStart", getRootElement(), cRStest) function resourcesCheck() if check=="done" then return else setRadioChannel(0) setTimer(cbinds, 1000, 1) textToggle=0 check="done" end end function cRS() if check=="done" then return else setRadioChannel(0) setTimer(cbinds, 3333, 1) textToggle=0 check="done" end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), cRS) function cbinds() local keys1 = getBoundKeys("vehicle_fire") local keys2 = getBoundKeys("vehicle_secondary_fire") if keys1 then for keyName, state in pairs(keys1) do bindKey(keyName, "down", cdoshoot) end end if keys2 then for keyName, state in pairs(keys2) do bindKey(keyName, "down", cdoshoot) end end if (not keys1) and (not keys2) then bindKey("F", "down", cdoshoot) bindKey("lctrl", "down", cdoshoot) bindKey("rctrl", "down", cdoshoot) end theVehicle = getPedOccupiedVehicle(cLP) allowShoots() end function allowShoots() bindTrigger = 1 end function cdoshoot() if bindTrigger == 1 then if not isPedDead(cLP) then bindTrigger = 0 local x,y,z = getElementPosition(theVehicle) local rX,rY,rZ = getElementRotation(theVehicle) local x = x+4*math.cos(math.rad(rZ+90)) local y = y+4*math.sin(math.rad(rZ+90)) createProjectile(theVehicle, 19, x, y, z, 1.0, nil) setTimer(allowShoots, 3000, 1) end end end Alternative: Scripting the setVehicleDamageProof after 5 Seconds time of the Map is over. My Try: function activategodmode(startedMap, source) local mapRoot = getResourceRootElement(startedMap) local thePlayer = getVehicleOccupants(source) if(thePlayer) then vehicles = getElementsByType ( "vehicle" ) for vehicleKey, vehicleValue in ipairs(vehicles) do setVehicleDamageProof (vehicleValue, true) end end end addEventHandler("onGamemodeMapStart", getRootElement(), activategodmode) setTimer(function () removeEventHandler ( "onGamemodeMapStart", root, activategodmode ) end, 5000, 1)
×
×
  • Create New...