#nofear
Members-
Posts
27 -
Joined
-
Last visited
-
Days Won
1
#nofear last won the day on July 3 2024
#nofear had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
#nofear's Achievements
Advanced Member (8/54)
1
Reputation
-
client.lua local marker = createMarker(-2407.9291992188, -600.03851318359, 132.6484375, "cylinder", 1.5, 255, 255, 255, 150) local guiWindow = nil -- GUI penceresini tutacak değişken -- GUI Paneli gösterme event'i addEventHandler("onClientMarkerHit", marker, function(hitElement, matchingDimension) if hitElement ~= localPlayer or not matchingDimension then return end -- Ekranın ortasında bir pencere oluştur local screenWidth, screenHeight = guiGetScreenSize() local windowWidth = 600 local windowHeight = 400 local windowX = (screenWidth - windowWidth) / 2 local windowY = (screenHeight - windowHeight) / 2 guiWindow = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Silah Yönetimi", false) -- Fare imleci gösterme showCursor(true) -- Pencere kapatma butonu oluşturma local closeButton = guiCreateButton(windowWidth - 30, 0, 30, 20, "X", false, guiWindow) addEventHandler("onClientGUIClick", closeButton, function() guiSetVisible(guiWindow, false) showCursor(false) end, false) -- Sol tarafta "Silahlar" alanı için gridlist oluştur local weaponsGrid = guiCreateGridList(0.05, 0.1, 0.4, 0.7, true, guiWindow) local weaponColumn = guiGridListAddColumn(weaponsGrid, "Silahlar", 0.9) -- Sağ tarafta "Sahip Olduğun Silahlar" alanı için gridlist oluştur local playerWeaponsGrid = guiCreateGridList(0.55, 0.1, 0.4, 0.7, true, guiWindow) local playerWeaponColumn = guiGridListAddColumn(playerWeaponsGrid, "Sahip Olduğun Silahlar", 0.9) -- "Silah Koy" butonu oluştur local giveWeaponButton = guiCreateButton(0.05, 0.85, 0.4, 0.1, "Silah Koy", true, guiWindow) local giveWeaponAmountEdit = guiCreateEdit(0.05, 0.75, 0.4, 0.05, "", true, guiWindow) guiEditSetMaxLength(giveWeaponAmountEdit, 3) -- Maksimum 3 karakter uzunluğunda sayı girişi yapılabilir addEventHandler("onClientGUIClick", giveWeaponButton, function() local selectedRow, _ = guiGridListGetSelectedItem(playerWeaponsGrid) local amount = tonumber(guiGetText(giveWeaponAmountEdit)) or 1 if selectedRow ~= -1 then local weaponName = guiGridListGetItemText(playerWeaponsGrid, selectedRow, playerWeaponColumn) triggerServerEvent("putPlayerWeapon", resourceRoot, weaponName, amount) else outputChatBox("Lütfen bir silah seçin!", 255, 0, 0) end end, false) -- "Silah Ver" butonu oluştur local takeWeaponButton = guiCreateButton(0.55, 0.85, 0.4, 0.1, "Silah Ver", true, guiWindow) local takeWeaponAmountEdit = guiCreateEdit(0.55, 0.75, 0.4, 0.05, "", true, guiWindow) guiEditSetMaxLength(takeWeaponAmountEdit, 3) -- Maksimum 3 karakter uzunluğunda sayı girişi yapılabilir addEventHandler("onClientGUIClick", takeWeaponButton, function() local selectedRow, _ = guiGridListGetSelectedItem(weaponsGrid) local amount = tonumber(guiGetText(takeWeaponAmountEdit)) or 1 if selectedRow ~= -1 then local weaponName = guiGridListGetItemText(weaponsGrid, selectedRow, weaponColumn) triggerServerEvent("givePlayerWeapon", resourceRoot, weaponName, amount) else outputChatBox("Lütfen bir silah seçin!", 255, 0, 0) end end, false) local playerWeaponsCloseButton = guiCreateButton(windowWidth - 30, 20, 30, 20, "X", false, guiWindow) addEventHandler("onClientGUIClick", playerWeaponsCloseButton, function() guiSetVisible(guiWindow, false) showCursor(false) end, false) -- GUI oluşturulduğunu sunucuya bildir triggerServerEvent("onClientRequestWeapons", resourceRoot) end) -- Sunucudan silahları al ve güncelle addEvent("onServerSendWeapons", true) addEventHandler("onServerSendWeapons", resourceRoot, function(weapons, playerWeapons) -- "Silahlar" alanını güncelle local weaponsGrid = guiGridListGetItem(weaponsGrid) guiGridListClear(weaponsGrid) for _, weaponName in ipairs(weapons) do guiGridListAddRow(weaponsGrid, weaponName) end -- "Sahip Olduğun Silahlar" alanını güncelle local playerWeaponsGrid = guiGridListGetItem(playerWeaponsGrid) guiGridListClear(playerWeaponsGrid) for _, weaponName in ipairs(playerWeapons) do guiGridListAddRow(playerWeaponsGrid, weaponName) end end) -- Silah verme event'i addEvent("givePlayerWeapon", true) addEventHandler("givePlayerWeapon", resourceRoot, function(weaponName, amount) giveWeapon(localPlayer, getWeaponIDFromName(weaponName), amount) outputChatBox("Silah başarıyla verildi: " .. weaponName) triggerServerEvent("onClientRequestWeapons", resourceRoot) end) -- Silah alma event'i addEvent("takePlayerWeapon", true) addEventHandler("takePlayerWeapon", resourceRoot, function(weaponName, amount) takeWeapon(localPlayer, getWeaponIDFromName(weaponName), amount) outputChatBox("Silah başarıyla alındı: " .. weaponName) triggerServerEvent("onClientRequestWeapons", resourceRoot) end) -- Playerden silah alma ve "Silahlar" alanına ekleme event'i addEvent("putPlayerWeapon", true) addEventHandler("putPlayerWeapon", resourceRoot, function(weaponName, amount) guiGridListAddRow(playerWeaponsGrid, weaponName) end) -- GUI kapatma event'i addEventHandler("onClientResourceStop", resourceRoot, function() if guiWindow and isElement(guiWindow) then destroyElement(guiWindow) showCursor(false) end end) I've done a few things, but the weapons on the player aren't showing up on the table. Can you help?
-
#nofear started following [HELP] Rhino/Tank Crosshair , [Help] Group Weapon Storage System , [Help] ID Generating Login Panel and 4 others
-
a system like putting a gun in the trunk of a car, but instead of a car trunk, I want to be able to take and put a specified amount of guns from a chosen object or marker. If such a system exists, could you send it?
-
addEventHandler("onPlayerLogin", root, function(_,hesap) setElementData(source, "loggedin", true) setElementData(source,"TuningMenuTrue",false) local hesapID = getAccountID(hesap) if idTablo[hesapID] then --"The place where the error occurred." ozelID = idTablo[hesapID] setElementID(source,ozelID) else setElementID(source,hesapID) end local oyuncu = (string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","")) local id = getElementID(source) or "-1" end) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs(getElementsByType("player")) do setElementData(player, "loggedin", not isGuestAccount(getPlayerAccount(player))) setElementData(player,"TuningMenuTrue", isGuestAccount(getPlayerAccount(player))) if getPlayerAccount(player) then local hesapID = getAccountID(getPlayerAccount(player)) if idTablo[hesapID] then -- "The place where the error occurred." ozelID = idTablo[hesapID] setElementID(player,ozelID) end end end end) The issue I'm experiencing actually lies within these lines.
- 7 replies
-
- help
- loginpanel
-
(and 1 more)
Tagged with:
-
Please evaluate the original version of the Server.lua section of the Login Panel. local function do_login(player, username, password, save_log) setElementData(source, "loggedin", true) triggerClientEvent(source, "closeLogin", source) if save_log then triggerClientEvent(source, "saveLoginToXML", root, username, password) else triggerClientEvent(source, "resetSaveXML", root, username, password) end end addEvent("onAccountManage", true) addEventHandler("onAccountManage", root, function(typ, username, password, save_log) if not hasObjectPermissionTo(getThisResource(), "function.addAccount", true) then triggerClientEvent(source, "setInfoText", source, 9) return end if typ == "register" then if getAccount(username) then triggerClientEvent(source, "setInfoText", source, 5) return end addAccount(username, password) if save_log then logIn(source, getAccount(username), password) setElementData(source, "loggedin", true) triggerClientEvent(source, "closeLogin", source) return end triggerClientEvent(source, "setInfoText", source, 11) elseif typ == "login" then if not getAccount(username) then triggerClientEvent(source, "setInfoText", source, 6) return end if not getAccount(username, password) then triggerClientEvent(source, "setInfoText", source, 7) return end if logIn(source, getAccount(username), password) then do_login(source, username, password, save_log) else if getAccount(username) and getAccountPlayer(getAccount(username)) == source then do_login(source, username, password, save_log) return end triggerClientEvent(source, "setInfoText", source, 12) end end end) addEventHandler("onPlayerLogout", root, function() setElementData(source," loggedin", false) setElementData(source,"TuningMenuTrue",true) end) function getAccountRealID(id) for i,v in pairs(idTablo) do if v == id then return i end end end function getAccountOzelID(id) for i,v in pairs(idTablo) do if i == id then return v end end end addEventHandler("onPlayerLogin", root, function(_,hesap) setElementData(source, "loggedin", true) setElementData(source,"TuningMenuTrue",false) local hesapID = getAccountID(hesap) if idTablo[hesapID] then ozelID = idTablo[hesapID] setElementID(source,ozelID) else setElementID(source,hesapID) end local oyuncu = (string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","")) local id = getElementID(source) or "-1" end) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs(getElementsByType("player")) do setElementData(player, "loggedin", not isGuestAccount(getPlayerAccount(player))) setElementData(player,"TuningMenuTrue", isGuestAccount(getPlayerAccount(player))) if getPlayerAccount(player) then local hesapID = getAccountID(getPlayerAccount(player)) if idTablo[hesapID] then ozelID = idTablo[hesapID] setElementID(player,ozelID) end end end end) addEventHandler('onPlayerJoin', root,function () outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 0, 255, 0, true) outputChatBox(' ', source, 255, 255, 255, true) outputChatBox(' ', source, 255, 255, 255, true) outputChatBox('#FFFFFFHoş Geldiniz. #1878FFİyi Oyunlar...', source, 0, 255, 0, true) outputChatBox('#FFFFFFDiscord için #1878FF/dc #ffffffyazınız.', source, 0, 255, 0, true) end) addEventHandler("onPlayerCommand",root,function(cmd) if cmd == "logout" then cancelEvent() end end) addEventHandler("onPlayerJoin",root,function() setPlayerBlurLevel(source,0) end) addEventHandler("onResourceStart",resourceRoot,function () setPlayerBlurLevel(root,0) end)
- 7 replies
-
- help
- loginpanel
-
(and 1 more)
Tagged with:
-
Yes, you're right. I have changed some things in the project. When I get home, I will upload the original version so that I'm sure some things will be smoother. However, even in the original version, I couldn't get the project to run.
- 7 replies
-
- help
- loginpanel
-
(and 1 more)
Tagged with:
-
This id generating login panel connects to various systems such as inventory. However, I'm unable to resolve the error in this login panel. https://hizliresim.com/etik01d function getIDFromPlayer(id) if id then local theid idTablo = getElementsByType("id") for id,p in pairs(idTablo) do if id == p then theid = i end end return theid else return false end end function getPlayerFromID(id) if id then id = tonumber(id) local theplayer idTablo = getElementsByType("id") for id,p in pairs(idTablo) do if theID == id then theplayer = p end end return theplayer else return false end end addEventHandler("onPlayerLogin", root, function(_,hesap) setElementData(source, "loggedin", true) setElementData(source,"TuningMenuTrue",false) local hesapID = getAccountID(hesap) if idTablo[hesapID] then -- The line where the error is indicated is here. ozelID = idTablo[hesapID] setElementID(source,ozelID) else setElementID(source,hesapID) end local oyuncu = (string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","")) local id = getElementID(source) or "-1" end) addEventHandler("onResourceStart", resourceRoot, function() if id then id = tonumber(id) local theplayer idTablo = getElementsByType("id") for id,p in ipairs(getElementsByType("player")) do setElementData(player, "loggedin", not isGuestAccount(getPlayerAccount(player))) setElementData(player, "TuningMenuTrue", isGuestAccount(getPlayerAccount(player))) if getPlayerAccount(player) then local hesapID = getAccountID(getPlayerAccount(player)) if idTablo[hesapID] then ozelID = idTablo[hesapID] setElementID(player,ozelID) end end end end end)
- 7 replies
-
- help
- loginpanel
-
(and 1 more)
Tagged with:
-
admin_serverprefs.lua 92-94 _coroutine_resume = coroutine.resume function coroutine.resume(...) 92- local state,result = _coroutine_resume(...) if not state then 94- outputDebugString( tostring(result), 1 ) -- Output error message end return state,result end admin_settings.lua 25 -- Get a resource's public bool,number,string or table settings function aGetResourceSettings( resName, bCountOnly ) allowedAccess = { ['*']=true } allowedTypes = { ['boolean']=true, ['number']=true, ['string']=true, ['table']=true } local count = 0 25- 25- 25- 25- local rawsettings = get(resName..'.') if not rawsettings then return {}, count end local settings = {} -- Parse raw settings for rawname,value in pairs(rawsettings) do if allowedTypes[type(value)] then if allowedAccess[string.sub(rawname,1,1)] then count = count + 1 -- Remove leading '*','#' or '@' local temp = string.gsub(rawname,'[%*%#%@](.*)','%1') -- Remove leading 'resName.' local name = string.gsub(temp,resName..'%.(.*)','%1') -- If name didn't have a leading 'resName.', then it must be the default setting local bIsDefault = ( temp == name ) if settings[name] == nil then settings[name] = {} end if bIsDefault then settings[name].default = value else settings[name].current = value end end end end -- Don't do anything else if all we want is the settings count if bCountOnly then return {}, count end -- Copy to tableOut, setting 'current' from 'default' where appropriate local tableOut = {} for name,value in pairs(settings) do if value.default ~= nil then tableOut[name] = {} tableOut[name].default = value.default tableOut[name].current = value.current if value.current == nil then tableOut[name].current = value.default end tableOut[name].friendlyname = get( resName .. '.' .. name .. '.friendlyname' ) tableOut[name].group = get( resName .. '.' .. name .. '.group' ) tableOut[name].accept = get( resName .. '.' .. name .. '.accept' ) tableOut[name].examples = get( resName .. '.' .. name .. '.examples' ) tableOut[name].desc = get( resName .. '.' .. name .. '.desc' ) end end return tableOut, count end admin_sync.lua 68 function aSynchCoroutineFunc( type, data, typeOfTag, banSearchTag ) local source = source -- Needed local maxBanCount = 100 if checkClient( false, source, 'aSync', type ) then return end local cor = aSyncCoroutine local tableOut = {} local theSource = root if client and not hasObjectPermissionTo ( client, "general.adminpanel" ) then type = "loggedout" elseif ( type == "player" ) then if not isElement( data ) then return end aPlayers[source]["sync"] = data tableOut["mute"] = isPlayerMuted ( data ) tableOut["freeze"] = isPlayerFrozen ( data ) tableOut["money"] = getPlayerMoney ( data ) tableOut["version"] = aPlayers[data]["version"] tableOut["accountname"] = getPlayerAccountName ( data ) or "N/A" tableOut["groups"] = "None" tableOut["acdetected"] = getPlayerACDetectedList( data ) tableOut["d3d9dll"] = getPlayerD3D9DLLHash( data ) tableOut["imgmodsnum"] = getPlayerModCount( data ) local account = getPlayerAccount ( data ) if ( isGuestAccount ( account ) ) then tableOut["groups"] = "Not logged in" else local groups = aclGetAccountGroups ( account ) if ( #groups <= 0 ) then tableOut["groups"] = "None" else tableOut["groups"] = table.concat(table.reverse(groups), ", ") end end theSource = data elseif ( type == "players" ) then for id, player in ipairs(getElementsByType("player")) do if isElement(player) and aPlayers[player] then tableOut[player] = {} tableOut[player]["name"] = getPlayerName ( player ) tableOut[player]["IP"] = getPlayerIP ( player ) tableOut[player]["version"] = aPlayers[player]["version"] tableOut[player]["accountname"] = getPlayerAccountName ( player ) or "N/A" tableOut[player]["serial"] = getPlayerSerial ( player ) tableOut[player]["country"] = aPlayers[player]["country"] tableOut[player]["admin"] = hasObjectPermissionTo ( player, "general.adminpanel" ) tableOut[player]["acdetected"] = getPlayerACDetectedList( player ) tableOut[player]["d3d9dll"] = getPlayerD3D9DLLHash( player ) tableOut[player]["imgmodsnum"] = getPlayerModCount( player ) end end elseif ( type == "resources" ) then if not hasObjectPermissionTo( source, "general.tab_resources" ) then return end local resourceTable = getResources() local tick = getTickCount() local antiCorMessageSpam = 0 for id, resource in ipairs(resourceTable) do 68- 68- 68- 68- local name = getResourceName ( resource ) local state = getResourceState ( resource ) local type2 = getResourceInfo ( resource, "type" ) local _,numsettings = aGetResourceSettings(name,true) tableOut[id] = {} tableOut[id]["name"] = name tableOut[id]["numsettings"] = numsettings tableOut[id]["state"] = state tableOut[id]["type"] = type2 tableOut[id]["fullName"] = getResourceInfo(resource, "name") or "Unknown" tableOut[id]["author"] = getResourceInfo(resource, "author") or "Unknown" tableOut[id]["version"] = getResourceInfo(resource, "version") or "Unknown" if ( getTickCount() > tick + 100 ) then -- Execution exceeded 100ms so pause and resume in 100ms setTimer(function() local status = coroutine.status(cor) if (status == "suspended") then coroutine.resume(cor) elseif (status == "dead") then cor = nil end end, 100, 1) if (antiCorMessageSpam == 0) then outputChatBox("Please wait, resource list still loading... Don't try refresh.", source, 255, 255, 0) end antiCorMessageSpam = antiCorMessageSpam + 1 coroutine.yield() tick = getTickCount() end end elseif ( type == "admins" ) then for id, player in ipairs(getElementsByType("player")) do if isElement(player) and aPlayers[player] then tableOut[player] = {} tableOut[player]["admin"] = hasObjectPermissionTo ( player, "general.adminpanel" ) if ( tableOut[player]["admin"] ) then tableOut[player]["chat"] = aPlayers[player]["chat"] end tableOut[player]["groups"] = "None" local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then tableOut[player]["groups"] = "Not logged in" else local groups = aclGetAccountGroups ( account ) if ( #groups <= 0 ) then tableOut[player]["groups"] = "None" else tableOut[player]["groups"] = table.concat(table.reverse(groups), ", ") end end end end elseif ( type == "server" ) then tableOut["name"] = getServerName() tableOut["players"] = getMaxPlayers() tableOut["game"] = getGameType() tableOut["map"] = getMapName() tableOut["password"] = getServerPassword() tableOut["fps"] = getFPSLimit() elseif ( type == "bansdirty" ) then tableOut = nil g_Bans = nil elseif ( type == "bans" or type == "bansmore" ) then if not g_Bans then local bans = getBans() g_Bans = {} -- Reverse for i = #bans,1,-1 do table.insert( g_Bans, bans[i] ) end end local from = ( tonumber( data ) or 0 ) + 1 local to = math.min( from+24, #g_Bans ) tableOut.total = #g_Bans for b=from,to do i = b - from + 1 ban = g_Bans[b] local seconds = getBanTime(ban) tableOut[i] = {} tableOut[i].nick = getBanUsername(ban) or getBanNick(ban) tableOut[i].seconds = seconds tableOut[i].banner = getBanAdmin(ban) tableOut[i].ip = getBanIP(ban) tableOut[i].serial = getBanSerial(ban) tableOut[i].reason = getBanReason(ban) tableOut[i].unban = getUnbanTime(ban) end elseif ( type == "messages" ) then local unread, total = 0, 0 for id, msg in ipairs ( aReports ) do if ( not msg.read ) then unread = unread + 1 end total = total + 1 end tableOut["unread"] = unread tableOut["total"] = total elseif ( type == "bansearch" ) then if not g_Bans then local bans = getBans() g_Bans = {} -- Reverse for i = #bans,1,-1 do table.insert( g_Bans, bans[i] ) end end local from = ( tonumber( data ) or 0 ) + 1 local to = math.min( from+24, #g_Bans ) tableOut.total = #g_Bans local cnt = 1 for b=1,#g_Bans do i = b - from + 1 ban = g_Bans[b] local seconds = getBanTime(ban) tableOut[i] = {} tableOut[i].nick = getBanUsername(ban) or getBanNick(ban) tableOut[i].seconds = seconds tableOut[i].banner = getBanAdmin(ban) tableOut[i].ip = getBanIP(ban) tableOut[i].serial = getBanSerial(ban) tableOut[i].reason = getBanReason(ban) tableOut[i].unban = getUnbanTime(ban) local tType = getNeededTagType (data[1],ban) if getNeededTagType (data[1],ban) and string.match (string.lower(tType),string.lower(data[2])) then if (isElement(source)) then -- In case the source has quit during coroutine loading if cnt <= maxBanCount then cnt = cnt + 1 triggerClientEvent ( source, "aClientSync", theSource, type, tableOut,data ) else triggerClientEvent ( source, "aClientSync", theSource, "message", false,{"error","Be more specific in your search query! (keyword returns more than 100 matches) search not completed due to server load, it's limited to displaying the first 100 results now."} ) return end end end end triggerClientEvent ( source, "aClientSync", theSource, "banlistend", false ) --Tell the player the loop has ended return end if (isElement(source)) then -- Incase the source has quit during coroutine loading triggerClientEvent ( source, "aClientSync", theSource, type, tableOut ) end end
-
I deleted the game and reinstalled it and the problem was not solved. I renewed the files with the original files of the game and the problem still did not go away. https://hizliresim.com/2av5xsc Maps section also does not work. But I can do whatever I want with the command.
-
Timer not canceled after player dies. The player dies but does not appear to have left the area. That's why the rockets keep firing. sorry my english bad server g_base_col = createColCuboid(-381.27297973633, 1517.2098388672, -5.718826293945, 1600, 1600, 200.25) g_root = getRootElement () function hit ( pla, dim, hitElement ) if getElementType ( pla ) == "player" then local vehicle = getPedOccupiedVehicle ( pla ) if vehicle or vehicle then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(pla)), aclGetGroup("roket")) then outputChatBox ( "Hoş Geldin Asker!, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) else setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) outputChatBox ( "Askeri Bölge Derhal Uzaklaş!", pla, 255, 0, 0 ) outputChatBox ( "[Uyarı] Roket Saldırısı!", g_root, 255, 0, 0 ) end end end end addEventHandler ( "onColShapeHit", g_base_col, hit ) function leave ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPedOccupiedVehicle ( pla ) if vehicle or vehicle then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(pla)), aclGetGroup("roket")) then outputChatBox ( "İyi Devriyeler Asker!", pla, 0, 100, 0 ) else setElementData ( pla, "inRestrictedArea", "false" ) triggerClientEvent ( pla, "destroyTimers", g_root, pla ) outputChatBox ( "[Uyarı] Roket Saldırısı Durdu!", g_root, 255, 0, 0 ) outputDebugString ( "*"..getPlayerName(pla).." has left col shape" ) end end end end addEventHandler ( "onColShapeLeave", g_base_col, leave ) client g_loc_pla = getLocalPlayer () g_loc_root = getRootElement () addEvent ( "destroyTrepassor", true ) addEventHandler ( "destroyTrepassor", g_loc_root, function () posX = -147.10989379883 posY = 2001.6342773438 posZ = 97.30118560791 posX2 = -135.48461914062 posY2 = 1652.8358154297 posZ2 = 97.30118560791 posX3 = 99.344902038574 posY3 = 2233.484375 posZ3 = 130.27871704102 posX4 = 478.35934448242 posY4 = 2160.7651367188 posZ4 = 97.30118560791 posX5 = 523.74835205078 posY5 = 1976.8087158203 posZ5 = 97.30118560791 posX6 = 448.73950195312 posY6 = 1715.9664306641 posZ6 = 97.30118560791 posX7 = 219.20726013184 posY7 = 1836.5458984375 posZ7 = 97.30118560791 posX8 = 188.45198059082 posY8 = 2081.4970703125 posZ8 = 97.30118560791 local isInResArea = getElementData ( g_loc_pla, "inRestrictedArea" ) rotZ = getPedRotation ( g_loc_pla ) if isInResArea == "true" then timer1 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX, posY, posZ, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer2 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX2, posY2, posZ2, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer3 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX3, posY3, posZ3, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer4 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX4, posY4, posZ4, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer5 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX5, posY5, posZ5, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer6 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX6, posY6, posZ6, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer7 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX7, posY7, posZ7, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) timer8 = setTimer ( createProjectile, 3000, 0, g_loc_pla, 20, posX8, posY8, posZ8, 1.0, g_loc_pla, 0, 0, rotZ, 0.1, 0.1, 0.1 ) end end ) addEvent ( "destroyTimers", true ) addEventHandler ( "destroyTimers", g_loc_root, function () local isInResArea = getElementData ( g_loc_pla, "inRestrictedArea" ) if isInResArea == "false" then killTimer ( timer1 ) killTimer ( timer2 ) killTimer ( timer3 ) killTimer ( timer4 ) killTimer ( timer5 ) killTimer ( timer6 ) killTimer ( timer7 ) killTimer ( timer8 ) end end )
-
I tried but it didn't work When you set the damage type to 19 it works for peds but not for vehicles function changeRocketDmgCar(attacker, dmgType, bodypart, loss, x, y, z, tire) if (dmgType == 19) then cancelEvent() local currentHealth = getElementHealth(source) if currentHealth <= 0 then blowVehicle(root, currentHealth) else setElementHealth(source, currentHealth - loss*2) -- doubling the damage end end ) addEventHandler("onClientVehicleDamage", root, changeRocketDmgCar) ---------------------------------------------------------------------------------------------- addEventHandler("onClientVehicleDamage", root, function(attacker, dmgType, bodypart, loss, x, y, z, tire) if (dmgType == 19) then cancelEvent() local currentHealth = getElementHealth(source) setElementHealth(source, currentHealth - loss*2) -- doubling the damage end end ) I have tried such things, but I am not very experienced and cannot reach the result.
-
how can i change the damage of rocket explosion? when I tried it before, when I fired with a rocket, I was taking damage when any player took damage, I don't want this and I want their cars to take extra damage. please help me
-
I want this script that I will use for a military server to work with the acl group, I tried a few ways, for example: function NPlayerJoin () local accountName = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accountName,aclGetGroup("TSK")) then bindKey ( source, "n", "down", NPlayerJoin ) end addEventHandler ( "onPlayerJoin", root, NPlayerJoin ) but i didn't succeed, can you help me? nuke.lua root = getRootElement () outputChatBox ( "superweapons by Ransom loaded", root, 105, 252, 55 ) players = getElementsByType ( "player" ) N_Trigger = false N_Active = false function ResourceStartN ( name, root ) for k,v in ipairs(players) do bindKey ( v, "n", "down", placeNBeacon ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), ResourceStartN ) function NPlayerJoin () bindKey ( source, "n", "down", placeNBeacon ) end addEventHandler ( "onPlayerJoin", root, NPlayerJoin ) function placeNBeacon ( player, key, state ) if ( N_Trigger == false ) and ( N_Active == false ) then N_Trigger = true defineLaunchType = key showCursor ( player, true ) outputChatBox ( "Click to activate the nuke. Press activation key again to cancel.", player, 105, 252, 55 ) elseif ( N_Trigger == true ) then --Cancel activation N_Trigger = false defineLaunchType = nil showCursor ( player, false ) outputChatBox ( "Nuke activation cancelled.", player, 105, 252, 55 ) end end function playerClick ( button, state, clickedElement, x, y, z ) if ( N_Active ~= false ) then outputChatBox ( "Sorry, nuke already activated", source, 105, 252, 55 ) end if ( button ~= "left" ) or ( state ~= "down" ) or ( defineLaunchType ~= "n" ) then return end showCursor ( source, false ) N_Trigger = false N_Active = true defineLaunchType = nil --reset stuff triggerClientEvent ( "ClientFireN", getRootElement(), x, y, z ) end addEventHandler ( "onPlayerClick", root, playerClick ) function NukeFinished () N_Active = false end addEvent("serverNukeFinished", true) addEventHandler("serverNukeFinished", root, NukeFinished) function KillNukedPlayer () killPlayer ( source ) outputChatBox ( "You got nuked!", source, 105, 252, 55 ) end addEvent("serverKillNukedPlayer", true) addEventHandler("serverKillNukedPlayer", root, KillNukedPlayer) nukeClient.lua ------------------------------------------ root = getRootElement () localPlayer = getLocalPlayer () N_loops = 0 N_cloudRotationAngle = 0 NFlashDelay = 0 stopNFlash = false function FireN ( x, y, z ) NBeaconX = x --these are for the render function NBeaconY = y NBeaconZ = z N_Cloud = NBeaconZ setTimer ( function() setTimer ( NExplosion, 170, 35 ) end, 2700, 1 ) -- wait 2700 seconds then 35 loops @ 170ms setTimer ( NShot, 500, 1 ) end addEvent("ClientFireN",true) addEventHandler("ClientFireN", getRootElement(), FireN) function NShot () NukeObjectA = createObject ( 16340, NBeaconX, NBeaconY, NBeaconZ + 200 ) NukeObjectB = createObject ( 3865, NBeaconX + 0.072265, NBeaconY + 0.013731, NBeaconZ + 196.153122 ) NukeObjectC = createObject ( 1243, NBeaconX + 0.060547, NBeaconY - 0.017578, NBeaconZ + 189.075554 ) setObjectRotation ( NukeObjectA, math.deg(3.150001), math.deg(0), math.deg(0.245437) ) setObjectRotation ( NukeObjectB, math.deg(-1.575), math.deg(0), math.deg(1.938950) ) setObjectRotation ( NukeObjectC, math.deg(0), math.deg(0), math.deg(-1.767145) ) shotpath = NBeaconZ - 200 moveObject ( NukeObjectA, 5000, NBeaconX, NBeaconY, shotpath, 0, 0, 259.9 ) moveObject ( NukeObjectB, 5000, NBeaconX + 0.072265, NBeaconY + 0.013731, shotpath - 3.846878, 0, 0, 259.9 ) moveObject ( NukeObjectC, 5000, NBeaconX + 0.060547, NBeaconY - 0.017578, shotpath - 10.924446, 0, 0, 259.9 ) end function NExplosion () N_loops = N_loops + 1 r = math.random(1.5, 4.5) angleup = math.random(0, 35999)/100 explosionXCoord = r*math.cos(angleup) + NBeaconX ExplosionYCoord = r*math.sin(angleup) + NBeaconY if N_loops == 1 then N_Cloud = NBeaconZ createExplosion ( explosionXCoord, ExplosionYCoord, N_Cloud, 7 ) killXPosRadius = NBeaconX + 35 killXNegRadius = NBeaconX - 35 killYPosRadius = NBeaconY + 35 killYNegRadius = NBeaconY - 35 --+/- 35 x/y killZPosRadius = NBeaconZ + 28-- +28 killZNegRadius = NBeaconZ - 28-- -28 local x, y, z = getElementPosition ( localPlayer ) if ( x < killXPosRadius ) and ( x > killXNegRadius ) and ( y < killYPosRadius ) and ( y > killYNegRadius ) and ( z < killZPosRadius ) and ( z > killZNegRadius ) then triggerServerEvent ( "serverKillNukedPlayer", localPlayer ) end elseif N_loops == 2 then N_Cloud = NBeaconZ + 4 createExplosion ( explosionXCoord, ExplosionYCoord, N_Cloud, 7 ) destroyElement ( NukeObjectA ) --Exploded, get rid of objects destroyElement ( NukeObjectB ) destroyElement ( NukeObjectC ) elseif N_loops > 20 then N_cloudRotationAngle = N_cloudRotationAngle + 22.5 if N_explosionLimiter == false then N_cloudRadius = 7 explosionXCoord = N_cloudRadius*math.cos(N_cloudRotationAngle) + NBeaconX --recalculate ExplosionYCoord = N_cloudRadius*math.sin(N_cloudRotationAngle) + NBeaconY --recalculate createExplosion ( explosionXCoord, ExplosionYCoord, N_Cloud, 7 ) N_explosionLimiter = true elseif N_explosionLimiter == true then N_explosionLimiter = false end N_cloudRadius2 = 16 explosionXCoord2 = N_cloudRadius2*math.cos(N_cloudRotationAngle) + NBeaconX ExplosionYCoord2 = N_cloudRadius2*math.sin(N_cloudRotationAngle) + NBeaconY createExplosion ( explosionXCoord2, ExplosionYCoord2, N_Cloud, 7 ) else N_Cloud = N_Cloud + 4 createExplosion ( explosionXCoord, ExplosionYCoord, N_Cloud, 7 ) end if N_loops == 1 then NExplosionFlash = createMarker ( NBeaconX, NBeaconY, NBeaconZ, "corona", 0, 255, 255, 255, 255 ) N_FlashSize = 1 addEventHandler ( "onClientRender", root, NFlash ) elseif N_loops == 35 then stopNFlash = true end end function NFlash () --Corona "flare". Grows after cp marker B grows a little if ( stopNFlash == false ) then if N_FlashSize > 60 then --beginning flash must grow fast, then delayed if NFlashDelay == 2 then N_FlashSize = N_FlashSize + 1 NFlashDelay = 0 else NFlashDelay = NFlashDelay + 1 end else N_FlashSize = N_FlashSize + 1 end else N_FlashSize = N_FlashSize - 1 end setMarkerSize ( NExplosionFlash, N_FlashSize ) if N_FlashSize == 0 then removeEventHandler ( "onClientRender", root, NFlash ) destroyElement ( NExplosionFlash ) N_loops = 0 --reset stuff N_cloudRotationAngle = 0 --reset stuff stopNFlash = false --reset stuff NFlashDelay = 0 --reset stuff triggerServerEvent ( "serverNukeFinished", getRootElement() ) end end
-
oad-- *** THESE ARE THE SETTINGS. MODIFY IN META.XML *** reloadTime = 6000 -- for Rhino reloadTimeHydra = 4000 -- for Hydra reloadTimeHunter = 3000 -- for Hunter range = 2 -- To increase range, set this value to 1. To decrease range, use 3. My code is optimized for 2. --*** BETTER NOT TOUCH BELOW *** event = nil fired = false drawHandler = nil armedVehicles = {[425]=true, [520]=true, [432]=true} w, h = guiGetScreenSize() height = nil endY = nil r, g = 255, 0 time = 0 function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function onStart() height = math.ceil(h / 50) if height < 19 then height = 19 end endY = math.ceil((h/100)*6) corona = createMarker (0, 0, -10, "corona", 1.0, 200, 100, 0, 150) bindKey ( "mouse1", "down", toggleRhino ) bindKey("vehicle_fire", "down", toggleHunter) bindKey("vehicle_secondary_fire", "down", toggleHunter) color = tocolor(255, 255, 255, 200) end addEventHandler("onClientResourceStart", resourceRoot, onStart) function entering( thePlayer, seat ) if thePlayer == localPlayer then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) local model = getElementModel ( source ) if model == 432 or model == 425 or model == 520 then drawHandler = addEventHandler("onClientRender", root, reloadFinished) end if model == 432 then toggleControl ( "vehicle_fire", false ) toggleControl ( "vehicle_secondary_fire", false ) addEventHandler("onClientRender", root, marker) event = true end end end addEventHandler("onClientVehicleEnter", getRootElement(), entering) function exit( thePlayer, seat ) if thePlayer == localPlayer then local model = getElementModel ( source ) if model == 432 then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end end addEventHandler("onClientVehicleExit", getRootElement(), exit) addEventHandler("onClientElementDestroy", getRootElement(), function () if (getElementModel(source) == 432 and getVehicleController(source) == localPlayer) then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_secondary_fire", true ) end end) function wasted() if source == localPlayer then if event ~= nil then removeEventHandler("onClientRender", root, marker) event = nil end toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wasted ) function clientResourceStop() toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) end addEventHandler( "onClientResourceStop", getResourceRootElement(getThisResource()), clientResourceStop ) function toggleRhino() if fired == false then if isPedInVehicle ( localPlayer ) and not isCursorShowing() then local veh = getPedOccupiedVehicle ( localPlayer ) if (veh) then if ( getElementModel ( veh ) == 432 ) then fired = true local turX, turY, turZ = getElementPosition(veh) local cx,cy,cz = getVehicleComponentPosition( veh, "misc_a" ) local x, y, z = getVehicleComponentPosition( veh, "misc_c" ) local barrelX, barrelY, barrelZ = getPositionFromElementOffset(veh,cx,cy,cz) local muzzleX, muzzleY, muzzleZ = getPositionFromElementOffset(veh,x,y,z) local velX = (muzzleX - barrelX) /range local velY = (muzzleY - barrelY) /range local velZ = (muzzleZ - barrelZ) /range local vx, vy, vz = getElementVelocity(veh) setElementVelocity (veh, vx+(((velX/3)*(-1))/50), vy+(((velY/3)*(-1))/50), vz+(((velZ/3)*(-1))/50) ) bullet = createProjectile(veh, 21, muzzleX, muzzleY, muzzleZ, 1, nil, 0, 0, 0, velX, velY, velZ) createExplosion(turX, turY, turZ-10, 8, false, 0.5, false) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 6000 soundTimer = setTimer(function() local sound = playSound("reload.mp3") setSoundVolume(sound, 0.1) end, (reloadTime-1000), 1) end end end end end function toggleHunter(control) if isPedInVehicle(localPlayer) then local model = getElementModel(getPedOccupiedVehicle(localPlayer)) if model == 425 and fired == false and control == "vehicle_fire" then fired = true setTimer(function() toggleControl ( "vehicle_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_fire", true ) fired = false end, reloadTimeHunter, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 3000 elseif model == 520 and fired == false and control == "vehicle_secondary_fire" then fired = true setTimer(function() toggleControl ( "vehicle_secondary_fire", false ) end, 100, 1) setTimer(function() toggleControl ( "vehicle_secondary_fire", true ) fired = false end, reloadTimeHydra, 1) removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil start = getTickCount() drawHandler = addEventHandler("onClientRender", root, reload) time = 4000 end end end function reload() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reload) drawHandler = nil end setMarkerColor ( corona, 255, 0, 0, 100 ) local getTime = (getTickCount()) - start local height = math.ceil(h / 50) if height < 19 then height = 19 end dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) local endY = math.ceil((h/100)*6) endY = endY - 4 if getTime <= time then endY = (getTime/time)*endY else removeEventHandler("onClientRender", root, reload) drawHandler = nil drawHandler = addEventHandler("onClientRender", root, reloadFinished) if getElementModel(getPedOccupiedVehicle(localPlayer)) ~= 432 then local sfx = playSFX ( "genrl", 136, 72 ) setSoundVolume (sfx, 1) end setMarkerColor ( corona, r, g, 0, 150 ) start = nil fired = false end dxDrawRectangle (2, h-endY-height-8, height+2, endY, tocolor(220,0,0,150), false) end function reloadFinished() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", root, reloadFinished) drawHandler = nil else dxDrawRectangle (0, h-endY-height-6, height+6, endY, tocolor(0,0,0,150), false) dxDrawRectangle (2, h-endY-height-4, height+2, endY-4, tocolor(220,0,0,150), false) end end function marker() if not isPedInVehicle(localPlayer) then removeEventHandler("onClientRender", getRootElement(), marker) if isTimer(soundTimer) then killTimer(soundTimer) end fired = false drawHandler = nil setElementPosition (corona, 0, 0, -10) else local vx, vy, vz = nil, nil, nil local cx, cy, cz = nil, nil, nil local veh = getPedOccupiedVehicle ( localPlayer ) if veh then local x, y, z = getVehicleComponentPosition( veh, "misc_a" ) cx, cy, cz = getPositionFromElementOffset( veh, x, y, z ) x, y, z = getVehicleComponentPosition( veh, "misc_c" ) vx, vy, vz = getPositionFromElementOffset( veh, x, y, z ) if vx ~= nil then local velX = (vx - cx) /range local velY = (vy - cy) /range local velZ = (vz - cz) /range local vx1, vy1 = cx + (velX * 50 * 0.1), cy + (velY * 50 * 0.1) local vx2, vy2 = cx + (velX * 50 * 0.2), cy + (velY * 50 * 0.2) local vx3, vy3 = cx + (velX * 50 * 0.3), cy + (velY * 50 * 0.3) local vx4, vy4 = cx + (velX * 50 * 0.5), cy + (velY * 50 * 0.5) local vx5, vy5 = cx + (velX * 50 * 0.6), cy + (velY * 50 * 0.6) local vx6, vy6 = cx + (velX * 50 * 0.7), cy + (velY * 50 * 0.7) local vx7, vy7 = cx + (velX * 50 * 0.8), cy + (velY * 50 * 0.8) local m1 = cz + (velZ * 50 * 0.1) - ((getGravity()*2400*0.01)/2) local m2 = cz + (velZ * 50 * 0.2) - ((getGravity()*2400*0.04)/2) local m3 = cz + (velZ * 50 * 0.3) - ((getGravity()*2400*0.09)/2) local m4 = cz + (velZ * 50 * 0.5) - ((getGravity()*2400*0.25)/2) local m5 = cz + (velZ * 50 * 0.6) - ((getGravity()*2400*0.36)/2) local m6 = cz + (velZ * 50 * 0.7) - ((getGravity()*2400*0.49)/2) local m7 = cz + (velZ * 50 * 0.8) - ((getGravity()*2400*0.64)/2) local hit, mx, my, mz, elementHit = processLineOfSight (cx, cy, cz, vx1, vy1, m1, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx1, vy1, m1, vx2, vy2, m2, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx2, vy2, m2, vx3, vy3, m3, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx3, vy3, m3, vx4, vy4, m4, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx4, vy4, m4, vx5, vy5, m5, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx5, vy5, m5, vx6, vy6, m6, true, true, true, true, true, false, false, false, veh) if hit == false then hit, mx, my, mz, elementHit = processLineOfSight (vx6, vy6, m6, vx7, vy7, m7, true, true, true, true, true, false, false, false, veh) if hit == false then mx, my, mz = vx7, vy7, m7 end end end end end end end local dist = getDistanceBetweenPoints3D ( vx, vy, vz, mx, my, mz ) if dist < 50 then r = 5.1 * dist g = 255 elseif dist >= 50 then r = 255 g = 255 - ((dist-50) * 5.1) end setElementPosition (corona, mx, my, mz) setMarkerColor ( corona, r, g, 0, 150 ) if not drawHandler then drawHandler = addEventHandler("onClientRender", root, reloadFinished) end end end end end function projectileSound ( creator ) local zeType = getProjectileType( source ) if zeType == 21 then if getElementType(creator) == "vehicle" then if getElementModel(creator) == 432 then local velX, velY, velZ = getElementVelocity(source) local cx, cy, cz = getVehicleComponentPosition( creator, "misc_c" ) cx, cy, cz = getPositionFromElementOffset(creator, cx, cy, cz) fxAddTankFire(cx, cy, cz, velX, velY, velZ) local sound1 = playSFX3D ( "genrl", 45, 2, cx, cy, cz ) local sound2 = playSFX3D ( "genrl", 45, 3, cx, cy, cz ) local sound3 = playSFX3D ( "genrl", 45, 4, cx, cy, cz ) setSoundMaxDistance( sound1, 300 ) setSoundMaxDistance( sound2, 300 ) setSoundMaxDistance( sound3, 200 ) setSoundVolume(sound1, 2) setSoundVolume(sound2, 2) setSoundVolume(sound3, 2) --setElementModel(source, 342) end end end end addEventHandler( "onClientProjectileCreation", getRootElement(), projectileSound ) I'm aiming to make a crosshair that will work fine with this, but I haven't been successful. Can you help me.