Jump to content

Wisam

Members
  • Posts

    168
  • Joined

  • Last visited

Everything posted by Wisam

  1. Wisam

    Extra Ammo kill

    Its ok man i dont need it now.. but there is another problem i have check its here: viewtopic.php?f=91&t=74450 Its not hard its just a small bug
  2. Wisam

    Extra Ammo kill

    Its ok man i dont need it now.. but there is another problem i have check its here: viewtopic.php?f=91&t=74450 Its not hard its just a small bug
  3. Wisam

    Extra Ammo kill

    Man i suck at lua.. i just writed the functions and events tapl gave me it didnt work with me.. i wish i knew lua like tapl
  4. Wisam

    Extra Ammo kill

    I deleted it because it didnt work.. Can you help me?!
  5. Wisam

    Play Sound fail

    Still the same error radar\radarscript.lua:11: attempt to call global 'playSound' (a nil value)
  6. Wisam

    Play Sound fail

    function finished(objective) if (objective.id ~= "radar") then return end sound() end function sound() local sound = playSound("win.wav") --Play wasted.mp3 from the sounds folder setSoundVolume(sound, 1) -- set the sound volume to 50% end addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) I changed to this and i chnaged the script type to client in meta.xml file and didnt work
  7. Hello.. I have here part of the map for assault gamemode and this script creates explosions when all the map objectives are finished and i added the sound function but.. the explosion works perfect but the sound dont play? please help me! i get this error: ERROR: radar\radarscript.lua:11: attempt to call global 'playSound' (a nil value) Script: (Client) function finished(objective) if (objective.id ~= "radar") then return end explosions() sound() end function sound() local sound = playSound("win.wav") setSoundVolume(sound, 1) -- set the sound volume to 50% end function explosions() createExplosion(-314.86804,1575.07471,76.80782, 7 ,true, 50.0,true ) end addEventHandler("onAssaultObjectiveReached",getRootElement(),finished)
  8. Wisam

    Extra Ammo kill

    We're here to help only, try to make it yourself. Things you'll need: -- server side triggerClientEvent -- client side addEvent addEventHandler getPedBonePosition dxDrawText isTimer setTimer killTimer removeEventHandler I tryed everything and nothing worked im dont know alot about lua!
  9. Wisam

    Extra Ammo kill

    .. and i forgot to mention somthing.. when the player kills and gets the ammo a small dxdrawtext above his head will appear writing (ammo+) that would be great
  10. Wisam

    Extra Ammo kill

    Thanks alot man.. what could we do without you TAPL Shukran
  11. Hello.. Im just starting to learn lua and i wanted to make a small script its when you kill a player you get extra amount of ammo for the weapon that killed him and each weapon get different amount of ammo (e.g M4 50 rounds for a kill, Sniper 10 rounds for a kill) I tryed to make it that each weapon gives different amount but i failed and made that it gives a random amount whatever the weapon was please help me Here's the script: Thanks to Mr.Miracle addEventHandler("onPlayerWasted",root,function(ammo,killer,wep) if getElementType(killer) == "player" and killer ~= source and wep > 9 then setWeaponAmmo(killer,wep,ammo+math.random(10,30)) end end)
  12. Wisam

    playSound

    Client Side: function createGui(options) if (logo == nil) then -- Create logo local screenWidth, screenHeight = guiGetScreenSize() local sizeX = screenWidth/1280 local sizeY = screenHeight/1024 local width = 420*sizeX local height = 300*sizeY outputConsole("Creating image: "..width.."x"..height) logo = guiCreateStaticImage ( screenWidth/2-width/2, screenHeight/2-height/1.5, width, height, "logo.png", false, nil ) end if (options == nil) then return end local justCreated = false if (assaultGui == nil) then --outputDebugString("Creating/updating assault gui") -- Get GUI from helpmanager assaultGui = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource(), true) -- Create tabs assaultGuiTabPanel = guiCreateTabPanel( 0, 0.04, 1, 1, true, assaultGui ) tabMap = guiCreateTab( "Map Information", assaultGuiTabPanel ) tabHelp = guiCreateTab( "Help", assaultGuiTabPanel ) local version = guiCreateLabel(0.72,0.048,0.4,0.1,"Assault v1.0 by driver2",true,assaultGui) guiSetAlpha(version,0.4) justCreated = true end if (assaultGui == nil) then --outputDebugString("test") end -- TAB: Map Information if (justCreated) then text = "This page displays information about the map and it's objectives. To get general help, click on 'Help'." guiCreateLabel(0.02,0.04,0.94,0.2,text,true,tabMap) end -- General Map Information if (justCreated) then assaultGuiGrid2 = guiCreateGridList(0.02,0.1,0.96,0.3,true,tabMap) guiGridListAddColumn(assaultGuiGrid2,"Option",0.2) guiGridListAddColumn(assaultGuiGrid2,"Value",0.-- s8) --> else guiGridListClear(assaultGuiGrid2) end guiGridListAddRow( assaultGuiGrid2 ) guiGridListSetItemText( assaultGuiGrid2, 0, 1, "Map", false, false ) guiGridListSetItemText( assaultGuiGrid2, 0, 2, options.name, false, false ) guiGridListAddRow( assaultGuiGrid2 ) guiGridListSetItemText( assaultGuiGrid2, 1, 1, "Timelimit", false, false ) guiGridListSetItemText( assaultGuiGrid2, 1, 2, calcTime(options.timelimit), false, false ) guiGridListAddRow( assaultGuiGrid2 ) guiGridListSetItemText( assaultGuiGrid2, 2, 1, "Finish Type", false, false ) guiGridListSetItemText( assaultGuiGrid2, 2, 2, options.finishType, false, false ) guiGridListAddRow( assaultGuiGrid2 ) guiGridListSetItemText( assaultGuiGrid2, 3, 1, "Author", false, false ) guiGridListSetItemText( assaultGuiGrid2, 3, 2, options.author, false, false ) guiGridListAddRow( assaultGuiGrid2 ) guiGridListSetItemText( assaultGuiGrid2, 4, 1, "Description", false, false ) guiGridListSetItemText( assaultGuiGrid2, 4, 2, options.description, false, false ) --guiGridListAutoSizeColumn(assaultGuiGrid2,1) guiGridListAutoSizeColumn(assaultGuiGrid2,2) -- Objective Information local objectivesTable = {} if (justCreated) then guiCreateLabel(0.02,0.42,0.92,0.1,"These are the attackers objectives:",true,tabMap) assaultGuiGrid = guiCreateGridList(0.02,0.48,0.96,0.44,true,tabMap) guiGridListAddColumn(assaultGuiGrid,"Objective",0.2) guiGridListAddColumn(assaultGuiGrid,"Description",0.-- s8) --> else guiGridListClear(assaultGuiGrid) end for k,v in ipairs(options.objective) do guiGridListAddRow( assaultGuiGrid ) guiGridListSetItemText (assaultGuiGrid, k-1, 1, v.name, false, false) guiGridListSetItemText (assaultGuiGrid, k-1, 2, v.description, false, false) end --guiGridListAutoSizeColumn(assaultGuiGrid,1) guiGridListAutoSizeColumn(assaultGuiGrid,2) -- TAB: Help if (justCreated) then local text = "What to do:\n\n" text = text.."You need to reach objectives. These are usually checkpoints you need to enter, but it can also be " text = text.."something else. Click on 'Map Information' for details.\n\n" text = text.."When the attacking team reached the final objective, sides will be switched and the attacking team will " text = text.."defend, while the previously defending team will attack. The team that finishes faster wins the map. If " text = text.."neither team manages to finish within the timelimit, the map will end tied.\n\n" text = text.."The objectives are listed on the screen. Green color means they are next to be done by the attackers, " text = text.."red color indicates they are already done and white color means they have yet to be done, but others " text = text.."have to be done first. " text = text.."At the bottom of the screen, the current tasks for your team are displayed. You can cycle through them " text = text.."using F4, if necessary." text = text.."\n\n\n" text = text.."General Information:\n\n" text = text.."This gamemode is roughly based on UnrealTournament's Assault." local helpLabel = guiCreateLabel(0.02,0.04,0.94,0.92,text,true,tabHelp) guiLabelSetHorizontalAlign ( helpLabel, "left", true ) end end function nextObjectivesText( objectives ) currentObjectives = objectives --outputConsole(tostring(getElementData("assaultAttackingTeam"))) --outputConsole("client next objectives "..tostring(getElementData(getLocalPlayer(),"assaultAttacker"))) if (nextObjectivesLabel == nil) then --outputConsole("Creating next objectives text label") local screenWidth, screenHeight = guiGetScreenSize() -- background local background = guiCreateStaticImage ( 0, screenHeight - 22, screenWidth, 22, "blackpixel.png", false, nil ) guiSetAlpha(background,0.5) nextObjectivesLabel = guiCreateLabel(0.1,screenHeight,screenWidth,10,"" ,false) local fontHeight = guiLabelGetFontHeight(nextObjectivesLabel) guiSetSize(nextObjectivesLabel,screenWidth,fontHeight,false) guiSetPosition(nextObjectivesLabel,10,screenHeight - fontHeight - 4,false) guiLabelSetColor(nextObjectivesLabel,255,255,255) --outputChatBox(tostring(guiBringToFront(nextObjectivesLabel))) end currentObjectiveShowing = 1 currentObjectiveCount = #currentObjectives --outputChatBox(tostring(currentObjectiveCount)) if (currentObjectiveCount > 0) then setCurrentObjectiveText(1) --guiSetText(nextObjectivesLabel,"Next objectives [1/"..currentObjectiveCount.."]: "..currentObjectives[1].text) end end function switchObjectivesText() if (currentObjectiveShowing == currentObjectiveCount) then currentObjectiveShowing = 1 else currentObjectiveShowing = currentObjectiveShowing + 1 end setCurrentObjectiveText(currentObjectiveShowing) end addCommandHandler( "Switch objective text", switchObjectivesText ) bindKey( "F4", "down", "Switch objective text" ) function setCurrentObjectiveText(number) local team = getPlayerTeam(getLocalPlayer()) --outputChatBox("moo?"..tostring(team)) if (team == false) then guiSetText(nextObjectivesLabel,"Choose a team..") else local description if (getPlayerTeam(getLocalPlayer()) == attacker) then description = currentObjectives[number].attackerText else description = currentObjectives[number].defenderText end local text if (currentObjectiveCount == 1) then text = "Next objective: "..description else text = "Next objectives ["..number.."/"..currentObjectiveCount.."]: "..description.." [F4 for next]" end guiSetText(nextObjectivesLabel,text) end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), function() setCurrentObjectiveText(currentObjectiveShowing) end ) -- stolen from mission_timer.lua function calcTime ( timeLeft ) local calcString = "" local timeHours = 0 local timeMins = 0 local timeSecs = 0 timeLeft = tonumber(timeLeft) timeSecs = math.mod(timeLeft, 60) timeMins = math.mod((timeLeft / 60), 60) timeHours = (timeLeft / 3600) if ( timeHours >= 1 ) then calcString = formatStr(tostring(timeHours)) .. ":" end calcString = calcString .. formatStr(string.format("%.0d", tostring(timeMins))) .. ":" .. formatStr(tostring(timeSecs)) return calcString end function formatStr ( formatString ) local aString = tostring(formatString) if ( #aString == 1 ) then aString = "0" .. aString end if ( #aString == 0 ) then aString = "00" end return aString end function showProgress(objectiveId, bool, progress, total, stayText) if (progressBar == nil) then progressBar = {} end if (progressBarText == nil) then progressBarText = {} end if (progressBar[objectiveId] == nil and bool == true) then local x, y = guiGetScreenSize() x = ( x / 2 ) - 100 y = y * 0.6 progressBar[objectiveId] = guiCreateProgressBar ( x, y, 200, 20, false ) progressBarText[objectiveId] = guiCreateLabel ( x, y - 30, 100, 25, stayText, false ) guiSetSize ( progressBarText[objectiveId], guiLabelGetTextExtent ( progressBarText[objectiveId] ), guiLabelGetFontHeight ( progressBarText[objectiveId] ), false ) guiLabelSetColor ( progressBarText[objectiveId], 255, 255, 255, 255 ) end if (progressBar[objectiveId] == nil) then return end guiSetVisible(progressBar[objectiveId],bool) guiSetVisible(progressBarText[objectiveId],bool) if (progress ~= nil and total ~= nil) then local p = math.ceil(progress / total * 100) guiProgressBarSetProgress(progressBar[objectiveId],p) guiSetText ( progressBarText[objectiveId], ("%s %d%%"):format(stayText, p) ) guiSetSize ( progressBarText[objectiveId], guiLabelGetTextExtent ( progressBarText[objectiveId] ), guiLabelGetFontHeight ( progressBarText[objectiveId] ), false ) end
  13. Wisam

    playSound

    Yes, its server side and there is client too
  14. Wisam

    playSound

    No thats not what he meant, he means that in the assault gamemod when the attack team finishs all objectives a sound will play. here's the script: Server Side: assaultTimers = {} --[[ This one is called when a map is loaded. It reads the mapfile, creates the text displays and lets player choose their teams, starting the first round afterwards ]] function startAssaultMap(startedMap) local mapRoot = getResourceRootElement(startedMap) outputDebugString("Starting assault map..") if (readOptions(startedMap) == false) then outputChatBox("Error loading map") return end setWeather(options.weather) -- simulate the end of a round attacker = team2 -- Create Objectives Text items removeTextItems() objectiveTextItem = {} objectiveTextItemShadow = {} local pos = 0.3 for k,v in ipairs(options.objective) do --outputChatBox("created textdisplay for "..v.name) -- Objectives on the right --objectiveTextItem[k] = textCreateTextItem(v.name, 0.92, pos, "low", 255,255,255,255,1.4,"right") --objectiveTextItemShadow[k] = textCreateTextItem(v.name, 0.921, pos + 0.001, "low", 0, 0, 0, 255, 1.4,"right") -- Objectives on the left objectiveTextItem[k] = textCreateTextItem(v.name, 0.04, pos, "low", 255,255,255,255,1.4,"left") objectiveTextItemShadow[k] = textCreateTextItem(v.name, 0.041, pos + 0.001, "low", 0, 0, 0, 255, 1.4,"left") textDisplayAddText( statusDisplay, objectiveTextItemShadow[k] ) textDisplayAddText( statusDisplay, objectiveTextItem[k] ) pos = pos + 0.03 end -- Remove player from noMapLoadedDisplay, fadeCamera and show team select display local players = getElementsByType("player") for k,v in ipairs(players) do fadeCamera(v,true) setNoMapLoaded( v, false ) selectTeam( v ) --outputConsole(getClientName(v)) triggerClientEvent2( v, "assaultCreateGui", options ) end noMapLoaded = false startRound() end --[[ Removes all required map-based settings when a map is stopped (but only if the resource wasnt stopped too) ]] function stopAssaultMap() --outputDebugString(getResourceState(getResourceFromName("assault"))) --outputDebugString(tostring(isElement(noMapLoadedDisplay))) outputDebugString("Stopping assault map..") noMapLoaded = true clearAllObjectives() removeTextItems() for k,v in pairs(assaultTimers) do if (isTimer(v)) then killTimer(v) end end -- Stop round timer --if (isTimer(assaultTimers.updateTimeLeft)) then -- killTimer(assaultTimers.updateTimeLeft) --end -- Add all players to noMapLoadedDisplay/toggleAllControls local players = getElementsByType("player") for k,v in ipairs(players) do setNoMapLoaded( v, true ) textDisplayRemoveObserver( waitingDisplay, v ) textDisplayRemoveObserver( waitingDisplay2, v ) --toggleAllControls( v, false ) end end function stopAssault() outputDebugString("Stopping assault..") removeEventHandler( "onGamemodeMapStop", getRootElement(), stopAssaultMap ) call(getResourceFromName("scoreboard"), "removeScoreboardColumn", "score") end function removeTextItems() -- Destroy map specific textitems if (objectiveTextItem == nil) then return end for k,v in ipairs(objectiveTextItem) do --textDisplayRemoveText(statusDisplay,v) --textDisplayRemoveText(objectiveTextItemShadow[k],statusDisplay) textDestroyTextItem(objectiveTextItemShadow[k]) textDestroyTextItem(v) --outputChatBox("removing textitem") end end function setNoMapLoaded( player, bool ) if (isElement(noMapLoadedDisplay) == false) then return end if (bool == true) then textDisplayAddObserver( noMapLoadedDisplay, player ) else setTimer(textDisplayRemoveObserver,1000,1,noMapLoadedDisplay, player ) end end --[[ This one prepares Assault when it is started. It creates the required teams, does some basic settings and shows a text display as long as no map is loaded ]] function startAssault(resource) noMapLoaded = true --outputChatBox("Now playing assault..") team1 = createTeam("Red",255,0,0) team2 = createTeam("Blue",0,0,255) team1Name = "Red" team2Name = "Blue" setTeamFriendlyFire( team1, false ) setTeamFriendlyFire( team2, false ) statusDisplay = textCreateDisplay() timeLeftTextItem = textCreateTextItem( "", 0.5, 0.02, "low", 255,255,255,255,1.8, "center" ) textDisplayAddText( statusDisplay, timeLeftTextItem ) waitingCreateDisplay() selectTeamCreateDisplay() local players = getElementsByType("player") for k,v in ipairs(players) do textDisplayAddObserver( statusDisplay, v ) setNoMapLoaded( v, true ) setElementDataLocal(v,"assaultToggleLogo",false) setElementDataLocal(v,"assaultCreateGui",false) setElementDataLocal(v,"assaultClientScriptLoaded",false) showPlayerHudComponent( v, "money", false ) end attackerDisplay = textCreateDisplay() defenderDisplay = textCreateDisplay() team1Display = textCreateDisplay() team2Display = textCreateDisplay() --nextObjectiveText = textCreateTextItem("Next Objective: ", 0.5, 0.94, "low", 255,255,255,255, 1.2, "center") --textDisplayAddText( attackerDisplay, nextObjectiveText ) --defenderText = textCreateTextItem("Prevent the attackers from reaching their objectives",0.5,0.94,"low",255,255,255,255,1.2,"center") --textDisplayAddText( defenderDisplay, defenderText ) team1Text = textCreateTextItem("You are on: Red", 0.04, 0.24, "low", 255,0,0,255, 1.2, "left") team2Text = textCreateTextItem("You are on: Blue", 0.04, 0.24, "low", 0,0,255,255, 1.2, "left") textDisplayAddText( team1Display, team1Text ) textDisplayAddText( team2Display, team2Text ) roundText = textCreateTextItem( "Round 1/2", 0.5, 0.048, "low", 255,255,255,255,1.2, "center" ) textDisplayAddText( statusDisplay, roundText ) call(getResourceFromName("scoreboard"), "addScoreboardColumn", "score") --startAssaultMap(resource) end -- function updateTimeLeft() -- timeLeft = timeLeft - 1 -- textItemSetText(timeLeftTextItem,calcTime(timeLeft)) -- if (timeLeft <= 0) then -- killTimer(assaultTimers.updateTimeLeft) -- endRound() -- end -- end --[[ Prepares the round to be started ]] function startRound() for k,v in ipairs(objectives) do textItemSetColor(objectiveTextItem[k],255,255,255,255) end clearAllObjectives() respawnAllVehicles() progress = 1 waiting = true if (attacker == team1) then attacker = team2 timeLimit = timeReachedBefore textItemSetText(roundText,"Round 2/2") elseif (attacker == team2) then attacker = team1 timeLimit = options.timelimit textItemSetText(roundText,"Round 1/2") end createObjectives() local players = getElementsByType("player") for k,v in ipairs(players) do triggerClientEvent2(v,"assaultNextRound",attacker) if (getPlayerTeam(v)) then waitForStart(v) textDisplayRemoveObserver( waitingDisplay2, v ) end end assaultTimers.startRoundNow = setTimer( startRoundNow, 4000, 1 ) end --[[ Actually starts the round and spawns the players ]] function startRoundNow() triggerEvent("onAssaultStartRound",getRootElement(),attacker) if (options.time ~= false) then setTime(gettok(options.time,1,58),gettok(options.time,2,58)) end waiting = false timeLeft = timeLimit -- if (isTimer(assaultTimers.updateTimeLeft)) then killTimer(assaultTimers.updateTimeLeft) end -- assaultTimers.updateTimeLeft = setTimer(updateTimeLeft,1000,timeLimit) g_missionTimer = exports.missiontimer:createMissionTimer (timeLimit*1000,true,false,0.5,20,true,"default-bold",1) addEventHandler ( "onMissionTimerElapsed", g_missionTimer, function() endRound(false) end ) local players = getElementsByType("player") for k,v in ipairs(players) do if (getPlayerTeam(v)) then spawnPlayerTeam( v ) end toggleAllControls( v, true ) setElementData(v,"score",0) end end function waitForStart( player ) if (isPedInVehicle( player )) then removePedFromVehicle( player ) end
  15. All this exists in the map editor (click on the red heart icon on the left bottom screen for pickups) and the spawns for TDM gamemode can be found in the green notebook on the top right screen, click on the notebook icon > add deathmatch > POINT the mouse at the bottom left screen then cycle with your mouse wheel
  16. Oh it worked Thanks alot I made another post here can you check it?!
  17. You mean in the meta.xml file?
  18. That didnt work its gives me an error ! and its not copying
  19. So i got the assault gamemode and i want to add small thing and its when the attacking team finish all the objectives a random sound will play, and if the attacking team didn't finish all the objectives another different sound is played.. here's the script: Server Side: assaultTimers = {} --[[ This one is called when a map is loaded. It reads the mapfile, creates the text displays and lets player choose their teams, starting the first round afterwards ]] function startAssaultMap(startedMap) local mapRoot = getResourceRootElement(startedMap) outputDebugString("Starting assault map..") if (readOptions(startedMap) == false) then outputChatBox("Error loading map") return end setWeather(options.weather) -- simulate the end of a round attacker = team2 -- Create Objectives Text items removeTextItems() objectiveTextItem = {} objectiveTextItemShadow = {} local pos = 0.3 for k,v in ipairs(options.objective) do --outputChatBox("created textdisplay for "..v.name) -- Objectives on the right --objectiveTextItem[k] = textCreateTextItem(v.name, 0.92, pos, "low", 255,255,255,255,1.4,"right") --objectiveTextItemShadow[k] = textCreateTextItem(v.name, 0.921, pos + 0.001, "low", 0, 0, 0, 255, 1.4,"right") -- Objectives on the left objectiveTextItem[k] = textCreateTextItem(v.name, 0.04, pos, "low", 255,255,255,255,1.4,"left") objectiveTextItemShadow[k] = textCreateTextItem(v.name, 0.041, pos + 0.001, "low", 0, 0, 0, 255, 1.4,"left") textDisplayAddText( statusDisplay, objectiveTextItemShadow[k] ) textDisplayAddText( statusDisplay, objectiveTextItem[k] ) pos = pos + 0.03 end -- Remove player from noMapLoadedDisplay, fadeCamera and show team select display local players = getElementsByType("player") for k,v in ipairs(players) do fadeCamera(v,true) setNoMapLoaded( v, false ) selectTeam( v ) --outputConsole(getClientName(v)) triggerClientEvent2( v, "assaultCreateGui", options ) end noMapLoaded = false startRound() end --[[ Removes all required map-based settings when a map is stopped (but only if the resource wasnt stopped too) ]] function stopAssaultMap() --outputDebugString(getResourceState(getResourceFromName("assault"))) --outputDebugString(tostring(isElement(noMapLoadedDisplay))) outputDebugString("Stopping assault map..") noMapLoaded = true clearAllObjectives() removeTextItems() for k,v in pairs(assaultTimers) do if (isTimer(v)) then killTimer(v) end end -- Stop round timer --if (isTimer(assaultTimers.updateTimeLeft)) then -- killTimer(assaultTimers.updateTimeLeft) --end -- Add all players to noMapLoadedDisplay/toggleAllControls local players = getElementsByType("player") for k,v in ipairs(players) do setNoMapLoaded( v, true ) textDisplayRemoveObserver( waitingDisplay, v ) textDisplayRemoveObserver( waitingDisplay2, v ) --toggleAllControls( v, false ) end end function stopAssault() outputDebugString("Stopping assault..") removeEventHandler( "onGamemodeMapStop", getRootElement(), stopAssaultMap ) call(getResourceFromName("scoreboard"), "removeScoreboardColumn", "score") end function removeTextItems() -- Destroy map specific textitems if (objectiveTextItem == nil) then return end for k,v in ipairs(objectiveTextItem) do --textDisplayRemoveText(statusDisplay,v) --textDisplayRemoveText(objectiveTextItemShadow[k],statusDisplay) textDestroyTextItem(objectiveTextItemShadow[k]) textDestroyTextItem(v) --outputChatBox("removing textitem") end end function setNoMapLoaded( player, bool ) if (isElement(noMapLoadedDisplay) == false) then return end if (bool == true) then textDisplayAddObserver( noMapLoadedDisplay, player ) else setTimer(textDisplayRemoveObserver,1000,1,noMapLoadedDisplay, player ) end end --[[ This one prepares Assault when it is started. It creates the required teams, does some basic settings and shows a text display as long as no map is loaded ]] function startAssault(resource) noMapLoaded = true --outputChatBox("Now playing assault..") team1 = createTeam("Red",255,0,0) team2 = createTeam("Blue",0,0,255) team1Name = "Red" team2Name = "Blue" setTeamFriendlyFire( team1, false ) setTeamFriendlyFire( team2, false ) statusDisplay = textCreateDisplay() timeLeftTextItem = textCreateTextItem( "", 0.5, 0.02, "low", 255,255,255,255,1.8, "center" ) textDisplayAddText( statusDisplay, timeLeftTextItem ) waitingCreateDisplay() selectTeamCreateDisplay() local players = getElementsByType("player") for k,v in ipairs(players) do textDisplayAddObserver( statusDisplay, v ) setNoMapLoaded( v, true ) setElementDataLocal(v,"assaultToggleLogo",false) setElementDataLocal(v,"assaultCreateGui",false) setElementDataLocal(v,"assaultClientScriptLoaded",false) showPlayerHudComponent( v, "money", false ) end attackerDisplay = textCreateDisplay() defenderDisplay = textCreateDisplay() team1Display = textCreateDisplay() team2Display = textCreateDisplay() --nextObjectiveText = textCreateTextItem("Next Objective: ", 0.5, 0.94, "low", 255,255,255,255, 1.2, "center") --textDisplayAddText( attackerDisplay, nextObjectiveText ) --defenderText = textCreateTextItem("Prevent the attackers from reaching their objectives",0.5,0.94,"low",255,255,255,255,1.2,"center") --textDisplayAddText( defenderDisplay, defenderText ) team1Text = textCreateTextItem("You are on: Red", 0.04, 0.24, "low", 255,0,0,255, 1.2, "left") team2Text = textCreateTextItem("You are on: Blue", 0.04, 0.24, "low", 0,0,255,255, 1.2, "left") textDisplayAddText( team1Display, team1Text ) textDisplayAddText( team2Display, team2Text ) roundText = textCreateTextItem( "Round 1/2", 0.5, 0.048, "low", 255,255,255,255,1.2, "center" ) textDisplayAddText( statusDisplay, roundText ) call(getResourceFromName("scoreboard"), "addScoreboardColumn", "score") --startAssaultMap(resource) end -- function updateTimeLeft() -- timeLeft = timeLeft - 1 -- textItemSetText(timeLeftTextItem,calcTime(timeLeft)) -- if (timeLeft <= 0) then -- killTimer(assaultTimers.updateTimeLeft) -- endRound() -- end -- end --[[ Prepares the round to be started ]] function startRound() for k,v in ipairs(objectives) do textItemSetColor(objectiveTextItem[k],255,255,255,255) end clearAllObjectives() respawnAllVehicles() progress = 1 waiting = true if (attacker == team1) then attacker = team2 timeLimit = timeReachedBefore textItemSetText(roundText,"Round 2/2") elseif (attacker == team2) then attacker = team1 timeLimit = options.timelimit textItemSetText(roundText,"Round 1/2") end createObjectives() local players = getElementsByType("player") for k,v in ipairs(players) do triggerClientEvent2(v,"assaultNextRound",attacker) if (getPlayerTeam(v)) then waitForStart(v) textDisplayRemoveObserver( waitingDisplay2, v ) end end assaultTimers.startRoundNow = setTimer( startRoundNow, 4000, 1 ) end --[[ Actually starts the round and spawns the players ]] function startRoundNow() triggerEvent("onAssaultStartRound",getRootElement(),attacker) if (options.time ~= false) then setTime(gettok(options.time,1,58),gettok(options.time,2,58)) end waiting = false timeLeft = timeLimit -- if (isTimer(assaultTimers.updateTimeLeft)) then killTimer(assaultTimers.updateTimeLeft) end -- assaultTimers.updateTimeLeft = setTimer(updateTimeLeft,1000,timeLimit) g_missionTimer = exports.missiontimer:createMissionTimer (timeLimit*1000,true,false,0.5,20,true,"default-bold",1) addEventHandler ( "onMissionTimerElapsed", g_missionTimer, function() endRound(false) end ) local players = getElementsByType("player") for k,v in ipairs(players) do if (getPlayerTeam(v)) then spawnPlayerTeam( v ) end toggleAllControls( v, true ) setElementData(v,"score",0) end end function waitForStart( player ) if (isPedInVehicle( player )) then removePedFromVehicle( player ) end
  20. So i just gotta point the view where i want the camera to be targeted when im at the team selection menu and type /dump then all the cordnaits and the camera target will be copyed?!
  21. Hello.. I started making assault maps for my server for assault gamemode and there is one thing i cant get for the map and its the camera target.. i want to know the cordnaits for the the camera target and where to look.. Like this The map script: This is part of the map script for the camera target "-1448.827026" posY="1503.699585" posZ="25.376719" targetX="-1385.593750" targetY="1491.384277" targetZ="12.064482" type="selectTeam" /> My guess was that the camera pos is where the camera will be, and the target pos is the cordniats where the camera will look, but i didnt try it.. if you know anything about this please help me Thank you
  22. Hey, im writing this to ask you about Bomb da Base gamemode by driver2.. if anyone have it or knows where to get it please tell me i need it very bad.. Thanks!
×
×
  • Create New...