Jump to content

Dzsozi (h03)

Members
  • Posts

    696
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Dzsozi (h03)

  1. Alright, this helps me a little bit thank you! But how can I add clothes on CJ? Because if I add for example a shirt on him, the shirt has the chosen torso texture. I would like to make it work like if you buy a shirt then your character will remain for example white (if you created a white character at the beginning of the game) and the shirt gets added on CJ but with the matching texture. I hope you can understand me.
  2. Could somebody write an example on how to make a white and a black CJ skin at the same time please? I dont really understand shaders yet, but I would like to make this possible. Also, how can I apply the shader only to the player who has created a white character? How can I save that? How can I make unlimited clothes and faces with different textures? These things sound a little bit hard, maybe its because I dont know the shaders well, or maybe because it is hard. I would appreciate any resource if there is any out there or example or anything that helps me out with that.
  3. I know that I can't have different models, I'm talking about the textures.
  4. Hi! I was wondering if it is possible to make a black and a white CJ with shaders, so when a player creates a character he can decide to have a black or a white character, that would be good because players could make their characters more unique. Also, I was wondering if it is possible to change the faces of black and white CJ, so they could have not just different skin colour, but different faces. And one more thing, I was wondering if it is possible to replace clothes with shaders, so I could have more and custom clothes than the default ones, I believe there is a resource for that but I'm not sure and I don't know the name of it, and also, if I'm not mistaken, devGaming (a polish roleplay server/community) made it possible.
  5. Alright, something came into my mind, I will try that, thank you!
  6. Hey, I'm trying to make a simple script to prevent the only headshot "bug" when a player only holds the fire key and not aiming. I would like to make the player automatically aim when he holds the fire button, but I have some issues. When I release the fire button my character keeps aiming until I click the aim or fire button once manually. How can I make this script working or is there any other way for this that is more effective? Here's how I tried to do it: function fixCrosshairBugging() if getControlState("fire") and not getControlState("aim_weapon") then setControlState("aim_weapon", true) elseif not getControlState("fire") and not getControlState("aim_weapon") then setControlState("aim_weapon", false) end end addEventHandler("onClientRender", root, fixCrosshairBugging) So I would like to keep the default binds and etc., so I could aim the weapon manually as well, but I'd like the players to aim automaticall when they are only holding the fire key, and disable the aiming when they release it.
  7. https://community.multitheftauto.com/index.php?p=resources&s=details&id=12000 Check out this scipts' client file, I think you can get the part you need from it.
  8. Hello! I have created a little loading thingy, I would like to make a custom loading indicator and also use it in other scripts, for example if your fps is under 20 then it would show the loading indicator. But I would like to make some kind of ID for the created notifications, or something to identify the which notification I would like to remove and which I would like to keep showing. How can I do that and what would be the most efficient way to do this? Here's my script: local screenWidth, screenHeight = guiGetScreenSize() local textFont = "default-bold" local showLoadingBar = false local str_ local iconRotation = 0 function dxDrawLoadingBar(str, state) str_ = str showLoadingBar = state end addEvent("drawLoadingBar", true) addEventHandler("drawLoadingBar", root, dxDrawLoadingBar) dxDrawLoadingBar("pálya betöltése", true) setTimer(function() dxDrawLoadingBar("karakter betöltése", true) dxDrawLoadingBar("pálya betöltése", false) setTimer(function() dxDrawLoadingBar("betöltés", true) setTimer(function() dxDrawLoadingBar(false) end, 5000, 1) end, 5000, 1) end, 2500, 1) addEventHandler("onClientRender", root, function() if showLoadingBar then local textWidth = -5 local textHeight = 18.75 if str_ and str_ ~= "" then textWidth = dxGetTextWidth(str_, 1.25, textFont) textHeight = dxGetFontHeight(1.25, textFont) else textWidth = -5 textHeight = 18.75 end local loadingWidth, loadingHeight = 16, 16 iconRotation = iconRotation - 5 if (iconRotation < 0) then iconRotation = 360 end local barSizeX, barSizeY = textWidth + 25 + loadingWidth, textHeight + 10 local barPosX, barPosY = screenWidth - 20 - barSizeX, screenHeight - 20 - barSizeY dxDrawRectangle(barPosX, barPosY, barSizeX, barSizeY, tocolor(0, 0, 0, 180)) if str_ then dxDrawText(str_, barPosX + textWidth + loadingWidth + 20, barPosY + 5, barPosX + textWidth + loadingWidth + 20, barPosY + 5, tocolor(200, 0, 100, 255), 1.25, textFont, "right", "top", false, false, false, true, true) end dxDrawImage(barPosX + 10, barPosY + textHeight/2 - 2.5, loadingWidth, loadingHeight, "images/spinner.png", iconRotation, 0, 0, tocolor(200, 0, 100, 255)) end end) And an example for my problem: addEventHandler("onClientRender", root, function() if getElementData(localPlayer, "playerfps") <= 20 then dxDrawLoadingBar("", true) else dxDrawLoadingBar("", false) end end) addEventHandler("onClientRender", root, function() if isTransferBoxActive() then dxDrawLoadingBar("lodaing", true) else dxDrawLoadingBar("loading", false) end end) If I delete the transferbox part then the whole thing works, I get the loading notification if my fps is under a specified number, for example under 20, and if it's above 20 then the notification is gone, so it works, but if I have the transferbox part then the notification of the fps won't show up, because I have the else dxDrawLoadingBar(false) part (since the transferbox is not always active). I was thinking about identifying the loadingbars by the string given, so if the string is the same with the string of the drawn notification I could disable only that loading notification. I hope you know what I mean, it's kinda hard to explain.
  9. Sorry for the bumping, and thank you for your help!
  10. Hello! I made a passive mode script for players, so when they type in /passive they can go into passive mode, so they can't get killed, etc. But I am also making a free time event system, where you can hijack cars, be a bounty and etc, and I would like to prevent people going into passive mode while doing the mission. So for example when they get into the car that needs to be hijacked, they can't use passive mode, but when they exit that specific car they can use the passive mode again. I made a script for that, and it works, but I keep getting these errors: vice_events/bounty/bountyS.lua:43 Bad usage @ 'addEventHandler' ['onPlayerCommand' with this function is already handled] Here's a part of the bounty script where I made these event handlers: local function preventPassiveMode(command) if command == "passive" then exports.vice_notification:addNotificationGTA(source, "Jelenleg nem használhatod a passzív módot!") cancelEvent() end end function bountyThatGuy() if #players > 1 then p = getRandomPlayer() if (getElementData(p, "passivezoneprotected") == false) and (getElementData(p, "passivemode") == false) then randomReward = math.random(#possibleRewards) currentReward = possibleRewards[randomReward][1] if isTimer(bountySurviveTimer) then killTimer(bountySurviveTimer) bountySurviveTimer = nil end for i = 1, #players do v = players[ i ] if v ~= p then exports.vice_notification:addNotificationGTA(v, "" .. getPlayerName( p ) .. " fejére $" .. currentReward .. " vérdíjat tűztek ki!") end triggerClientEvent(p, "sendBountyNotification", p, p, currentReward) setElementData(p, "playerbounty", true) addEventHandler("onPlayerCommand", p, preventPassiveMode) end bountySurviveTimer = setTimer(function() if v ~= p then exports.vice_notification:addNotificationGTA(v, "" .. getPlayerName( p ) .. " túlélte a vadászatot, ezért megkapta a fejére kitűzött vérdíjat jutalmul!") end exports.vice_notification:addNotificationGTA(p, "Túlélted a vadászatot, ezért megkaptad a fejedre kitűzött vérdíjat jutalmul!") setElementData(p, "playerbounty", false) removeEventHandler("onPlayerCommand", p, preventPassiveMode) end, timeToSurvive*60000, 1) else setTimer( bountyThatGuy, 1000, 1 ) end else setTimer( bountyThatGuy, 10000, 1 ) end end setTimer( bountyThatGuy, 5000, 1 ) And where I set the "playerbounty" element data of the player to false I removed the event handler. Why do I keep getting these errors/warnings if the script itself works? And how can I fix it?
  11. Got it fixed, thank you! Here's how if anybody having a problem like this or if you are interested: function deleteVehicle(thePlayer, commandName, id) if (exports.vice_core:isSysAdmin(thePlayer)) then local dbid = tonumber(id) local destroyedVehicle = false local vehicleName = nil if tonumber(dbid) then for _, v in ipairs(getElementsByType("vehicle")) do vehicleDBID = getElementData(v, "dbid") if tonumber(vehicleDBID) == tonumber(dbid) then vehicleName = getVehicleName(v) destroyElement(v) destroyedVehicle = true break end end if destroyedVehicle == true then exports.vice_notification:addNotification(thePlayer, "Vehicle successfully deleted", "success") exports.vice_chat:sendMessageToAdmins("#00B4FF" .. getPlayerName(thePlayer) .. "#FFFFFF has deleted a vehicle. #00B4FF(Vehicle: " .. vehicleName .. " - ID: " .. dbid .. ")") else exports.vice_notification:addNotification(thePlayer, "No vehicle existing with this ID", "error") end else outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [vehicle ID]", thePlayer, 0, 180, 255,true) end end end addCommandHandler("delveh", deleteVehicle, false, false)
  12. It works, but for some reason if there are 2 vehicles (id -1 and id -2) and if I delete id -1 I get the error message, so it says that there is no existing vehicle, but the vehicle itself gets deleted, but if I delete -2, so the last vehicle created, I get the success message (the vehicle gets deleted as well, so no problem).
  13. Yes I know, but as I wrote there, it's not related to the unban command, that's why I decided to make a new post, I don't get answer because of the name of the topic.
  14. Hello! I'm making my own admin system for my gamemode and I have some issues. I would like to make temporary vehicles that admins can create, and I would like to make a command for that, so admins can also delete the specified vehicle. Only problem with the delete command is that if I create for example 2 vehicles, so there are a vehicle with dbid -1 and dbid -2, I can't delete the vehicle with dbid -1, only if I delete dbid -2, so I can always delete only the last vehicle created, not the vehicle I would like to delete. Why is this happening? The commands: totalTempVehicles = 0 function createTempVehicle(thePlayer, commandName, ...) if (exports.vice_core:isHarmasAdmin(thePlayer)) then local args = {...} if (#args < 1) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [vehicle] [color 1] [color 2]", thePlayer, 0, 180, 255,true) else local vehicleID = tonumber(args[1]) local col1 = #args ~= 1 and tonumber(args[#args - 1]) or -1 local col2 = #args ~= 1 and tonumber(args[#args]) or -1 if not vehicleID then -- vehicle is specified as name local vehicleEnd = #args repeat vehicleID = getVehicleModelFromName(table.concat(args, " ", 1, vehicleEnd)) vehicleEnd = vehicleEnd - 1 until vehicleID or vehicleEnd == -1 if vehicleEnd == -1 then exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this name", "error") return elseif vehicleEnd == #args - 2 then col2 = math.random(0,100) elseif vehicleEnd == #args - 1 then col1 = math.random(0,100) col2 = math.random(0,100) end end local r = getPedRotation(thePlayer) local x, y, z = getElementPosition(thePlayer) x = x + ( ( math.cos ( math.rad ( r ) ) ) * 5 ) y = y + ( ( math.sin ( math.rad ( r ) ) ) * 5 ) local letter1 = string.char(math.random(65,90)) local letter2 = string.char(math.random(65,90)) local plate = letter1 .. letter2 .. math.random(0, 9) .. " " .. math.random(1000, 9999) if vehicleID then local veh = createVehicle(vehicleID, x, y, z, 0, 0, r, plate) if not (veh) then exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this ID", "error") else setVehicleDamageProof(veh, false) totalTempVehicles = totalTempVehicles + 1 local dbid = (-totalTempVehicles) setVehicleColor(veh, col1, col2, col1, col2) setElementInterior(veh, getElementInterior(thePlayer)) setElementDimension(veh, getElementDimension(thePlayer)) setVehicleOverrideLights(veh, 1) setVehicleEngineState(veh, false) setVehicleFuelTankExplodable(veh, false) setElementData(veh, "dbid", dbid) exports.vice_chat:sendMessageToAdmins("#00FFB4" .. getPlayerName(thePlayer) .. "#FFFFFF Created a temporary vehicle. #00FFB4(Vehicle: " .. getVehicleName(veh) .. " - ID: " .. dbid .. ")") end else exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this ID", "error") end end end end addCommandHandler("veh", createTempVehicle, false, false) ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- function deleteVehicle(thePlayer, commandName, id) if (exports.vice_core:isSysAdmin(thePlayer)) then local dbid = tonumber(id) if not (dbid) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [vehicle ID]", thePlayer, 0, 180, 255,true) else for _, v in ipairs(getElementsByType("vehicle")) do vehicleDBID = getElementData(v, "dbid") theVehicle = v end if (vehicleDBID == dbid) then if (vehicleDBID<0) then destroyElement(theVehicle) end exports.vice_notification:addNotification(thePlayer, "Vehicle successfully deleted", "success") else exports.vice_notification:addNotification(thePlayer, "There is no existing vehicle with this ID", "error") end end end end addCommandHandler("delveh", deleteVehicle, false, false)
  15. I have got one more little problem, not related to the unban, but related to my admin system. I would like to make temporary vehicles that admins can create, and I would like to make a command for that, so admins can also delete the specified vehicle. Only problem with the delete command is that if I create for example 2 vehicles, so there are a vehicle with dbid -1 and dbid -2, I can't delete the vehicle with dbid -1, only if I delete dbid -2, so I can always delete only the last vehicle created, not the vehicle I would like to delete. Why is this happening? Here's my commands: totalTempVehicles = 0 function createTempVehicle(thePlayer, commandName, ...) if (exports.vice_core:isHarmasAdmin(thePlayer)) then local args = {...} if (#args < 1) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [vehicle] [color 1] [color 2]", thePlayer, 0, 180, 255,true) else local vehicleID = tonumber(args[1]) local col1 = #args ~= 1 and tonumber(args[#args - 1]) or -1 local col2 = #args ~= 1 and tonumber(args[#args]) or -1 if not vehicleID then -- vehicle is specified as name local vehicleEnd = #args repeat vehicleID = getVehicleModelFromName(table.concat(args, " ", 1, vehicleEnd)) vehicleEnd = vehicleEnd - 1 until vehicleID or vehicleEnd == -1 if vehicleEnd == -1 then exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this name", "error") return elseif vehicleEnd == #args - 2 then col2 = math.random(0,100) elseif vehicleEnd == #args - 1 then col1 = math.random(0,100) col2 = math.random(0,100) end end local r = getPedRotation(thePlayer) local x, y, z = getElementPosition(thePlayer) x = x + ( ( math.cos ( math.rad ( r ) ) ) * 5 ) y = y + ( ( math.sin ( math.rad ( r ) ) ) * 5 ) local letter1 = string.char(math.random(65,90)) local letter2 = string.char(math.random(65,90)) local plate = letter1 .. letter2 .. math.random(0, 9) .. " " .. math.random(1000, 9999) if vehicleID then local veh = createVehicle(vehicleID, x, y, z, 0, 0, r, plate) if not (veh) then exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this ID", "error") else setVehicleDamageProof(veh, false) totalTempVehicles = totalTempVehicles + 1 local dbid = (-totalTempVehicles) setVehicleColor(veh, col1, col2, col1, col2) setElementInterior(veh, getElementInterior(thePlayer)) setElementDimension(veh, getElementDimension(thePlayer)) setVehicleOverrideLights(veh, 1) setVehicleEngineState(veh, false) setVehicleFuelTankExplodable(veh, false) setElementData(veh, "dbid", dbid) exports.vice_chat:sendMessageToAdmins("#00FFB4" .. getPlayerName(thePlayer) .. "#FFFFFF Created a temporary vehicle. #00FFB4(Vehicle: " .. getVehicleName(veh) .. " - ID: " .. dbid .. ")") end else exports.vice_notification:addNotification(thePlayer, "There is no vehicle with this ID", "error") end end end end addCommandHandler("veh", createTempVehicle, false, false) ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- function deleteVehicle(thePlayer, commandName, id) if (exports.vice_core:isSysAdmin(thePlayer)) then local dbid = tonumber(id) if not (dbid) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [vehicle ID]", thePlayer, 0, 180, 255,true) else for _, v in ipairs(getElementsByType("vehicle")) do vehicleDBID = getElementData(v, "dbid") theVehicle = v end if (vehicleDBID == dbid) then if (vehicleDBID<0) then destroyElement(theVehicle) end exports.vice_notification:addNotification(thePlayer, "Vehicle successfully deleted", "success") else exports.vice_notification:addNotification(thePlayer, "There is no existing vehicle with this ID", "error") end end end end addCommandHandler("delveh", deleteVehicle, false, false)
  16. Hello guys! I would like to make my own admin system, and I bumped into a little problem. I would like to make an unban command, so I can unban banned players if I want to. I made these commands: function banPlayerCommand(thePlayer, commandName, targetPlayer, hours, ...) if (exports.vice_core:isSuperAdmin(thePlayer)) then local target = exports.vice_core:getPlayerFromPartialName(targetPlayer) if not (target) or not (hours) or (tonumber(hours)<0) or not (...) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [player] [hours] [reason]", thePlayer, 0, 180, 255,true) else hours = tonumber(hours) if (hours>168) then outputChatBox("Maximum 7 days. #00B4FF(168 hours).", thePlayer, 255, 255, 255, true) else local thePlayerPower = exports.vice_core:getPlayerAdminLevel(thePlayer) local targetPlayerPower = exports.vice_core:getPlayerAdminLevel(targetPlayer) banReason = table.concat({...}, " ") if (targetPlayerPower <= thePlayerPower) then local playerName = getPlayerName(thePlayer) local seconds = ((hours*30)) -- ((hours*60)*60) lowered it because of testing local rhours = hours -- text value if (hours==0) then hours = "Permanent" elseif (hours==1) then hours = "1 hour" else hours = hours .. " hours" end banReason = banReason .. "" local ban = banPlayer(target,true, false,true, thePlayer, banReason, seconds) else outputChatBox("#00B4FF"..getPlayerName(thePlayer).."#FFFFFF wanted to ban you.", targetPlayer, 255, 255, 255,true) exports.vice_notification:addNotification(thePlayer, "Access denied", "warning") end end end else exports.vice_notification:addNotification(thePlayer, "Access denied", "warning") end end addCommandHandler("ban", banPlayerCommand, false, false) ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- function unbanPlayerCommand(thePlayer, commandName, nickName) if (exports.vice_core:isSuperAdmin(thePlayer)) then local target = getBanNick(nickName) if not (target) then outputChatBox("[USAGE]:#FFFFFF /"..commandName.." [player]", thePlayer, 0, 180, 255,true) else outputChatBox("#00B4FF"..getPlayerName(target).."#FFFFFF successfully unbanned.", thePlayer, 255, 255, 255,true) for _,ban in ipairs(getBans())do if getBanNick(ban) == target then removeBan(target) end end end else exports.vice_notification:addNotification(thePlayer, "Access denied", "warning") end end addCommandHandler("unban", unbanPlayerCommand, false, false) There's no problem with the exports, isSuperAdmin is defined, getPlayerFromPartialName works as well, the problem is that if I ban somebody, whose name is for example testguy1234, I can't unban him, because I get this error: Bad argument @ 'getBanNick' [Expected ban at argument 1, got string 'testguy1234'] or whatever name I write in instead of testguy1234. How to make a working unban command, so I can unban banned players' IP/serial depending on their nickname, or something like this, so they can join on the server again?
  17. It says created type - weapon created type - tools created type - weapon created type - tools
  18. You can use smoothMoveCamera
  19. Sorry for the late response, I didn't have time for trying to fix it, but now when I tried again in several ways, I still don't know how should I fix it or do that. I just don't understand why is this happening. The marker colors and blips are good, but the 3d text that is on the marker is not. For some reason, if I have 2 shops, it writes the text of weapon shop type number two for every maker, but if I have 3 shops, so tables, it writes the text of weapon shop type number one for every marker. But the colors of the markers, the blip icons are matching. Why is this happening? Hope you can understand me. addEventHandler("onClientResourceStart", resourceRoot, function() for k, v in ipairs(weaponShops) do local weaponShopType = v.shopType if weaponShopType == 1 then weaponShopTypeText = "Fegyverbolt" -- <- this is the weaponshop text for shop type number 1, it would have weapons in it markerColorR, markerColorG, markerColorB = 150, 150, 150 blipIcon = 6 --weapon blipColorR, blipColorG, blipColorB = 150, 150, 150 elseif weaponShopType == 2 then weaponShopTypeText = "Barkácsbolt" -- <- this is the toolshop text for shop type number 2, it would have tools in it markerColorR, markerColorG, markerColorB = 255, 180, 0 blipIcon = 27 --wrench blipColorR, blipColorG, blipColorB = 255, 180, 0 end local weaponShopBlip = createBlip(v.markerPos[1], v.markerPos[2], v.markerPos[3], blipIcon, 2, blipColorR, blipColorG, blipColorB, 255) local weaponShopMarker = createMarker(v.markerPos[1], v.markerPos[2], v.markerPos[3], "cylinder", 1.5, markerColorR, markerColorG, markerColorB, 75) setElementDimension(weaponShopMarker, v.markerPos[4]) setElementInterior(weaponShopMarker, v.markerPos[5]) addEventHandler("onClientRender", root, function() exports.vice_util:dxDrawTextOnElement(weaponShopMarker, weaponShopTypeText, 1, 20, 255, 255, 255, 255, 2, "default-bold") end) addEventHandler("onClientMarkerHit", weaponShopMarker, function(hitPlayer, matchingDimension) triggerServerEvent("selectWeapon", hitPlayer,id) end) end end) So, I have this here, shop type number one has a grey marker color and the pistol blip icon, and shop type number two has an orange marker color and the wrench blip icon, they are matching and working as it should, but for some reason every marker has the "Barkácsbolt" text if I have 4 shops, but if I delete one shop, so if I have 3 every marker has the "Fegyverbolt" text. Why is this? weaponShops = { -- markerX, markerY, markerZ, markerDimension, markerInterior, previewX, previewY, previewZ, previewRot, previewDimension, previewInterior, previewCamX, previewCamY, previewCamZ, previewCamLX, previewCamLY, previewCamLZ, exitPosX, exitPosY, exitposZ, markerID --marker #1 [1] = { markerPos = {364.40679931641, 1056.0571289063, 18.2, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {32, 29}, --weapons shopType = 1 }, [2] = { markerPos = {364.09176635742, 1078.3028564453, 18.1, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {-11.364508628845, -929.12506103516, 10.419666290283, 180, 0, 0}, --previewPos, rot, dimension, interior previewCam = {-11.375499725342, -934.71636962891, 11.142499923706, -11.366688728333, -933.71667480469, 11.120515823364}, --previewCamPos exitPos = {-15.293229103088, -933.56903076172, 10.419666290283, 213.12492370605, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 2 }, [3] = { markerPos = {-64.162605285645, -1481.2530517578, 10, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 1 }, [4] = { markerPos = {204.0777130127, -474.44369506836, 10.1, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 2 } }
  20. I tried it but I don't quite understand tables yet, I don't know how should I get the ID of the shop, I get this error in the client side script: attempt to index field '?' (a nil value), this refers to the line where I'm trying to get the id, so local id = v[1] addEventHandler("onClientResourceStart", resourceRoot, function() for k, v in pairs(weaponShops) do local id = v[1] local weaponShopType = v[id][shopType] if weaponShopType == 1 then weaponShopTypeText = "Fegyverbolt" markerColorR, markerColorG, markerColorB = 150, 150, 150 blipIcon = 6 --fegyver blipColorR, blipColorG, blipColorB = 150, 150, 150 elseif weaponShopType == 2 then weaponShopTypeText = "Barkácsbolt" markerColorR, markerColorG, markerColorB = 255, 180, 0 blipIcon = 27 --kalapács blipColorR, blipColorG, blipColorB = 255, 180, 0 end local weaponShopBlip = createBlip(v[id][markerPos][1], v[id][markerPos][2], v[id][markerPos][3], blipIcon, 2, blipColorR, blipColorG, blipColorB, 255) local weaponShopMarker = createMarker(v[id][markerPos][1], v[id][markerPos][2], v[id][markerPos][3], "cylinder", 1.5, markerColorR, markerColorG, markerColorB, 75) --setElementData(weaponShopMarker, "markerID-->weaponShop", v[24]) setElementDimension(weaponShopMarker, v[id][markerPos][4]) setElementInterior(weaponShopMarker, v[id][markerPos][5]) addEventHandler("onClientRender", root, function() exports.vice_util:dxDrawTextOnElement(weaponShopMarker, weaponShopTypeText, 1, 20, 255, 255, 255, 255, 2, "default-bold") end) addEventHandler("onClientMarkerHit", weaponShopMarker, function(hitPlayer, matchingDimension) --local id = getElementData(source, "markerID-->weaponShop") triggerServerEvent("selectWeapon", hitPlayer,id) --addEventHandler("onClientRender", root, drawSkinShop) end) end end) Here's how I did the tables: weaponShops = { -- markerX, markerY, markerZ, markerDimension, markerInterior, previewX, previewY, previewZ, previewRot, previewDimension, previewInterior, previewCamX, previewCamY, previewCamZ, previewCamLX, previewCamLY, previewCamLZ, exitPosX, exitPosY, exitposZ, markerID --marker #1 [1] = { markerPos = {364.40679931641, 1056.0571289063, 18.2, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {32, 29}, --weapons shopType = 1 }, [2] = { markerPos = {364.09176635742, 1078.3028564453, 18.1, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {-11.364508628845, -929.12506103516, 10.419666290283, 180, 0, 0}, --previewPos, rot, dimension, interior previewCam = {-11.375499725342, -934.71636962891, 11.142499923706, -11.366688728333, -933.71667480469, 11.120515823364}, --previewCamPos exitPos = {-15.293229103088, -933.56903076172, 10.419666290283, 213.12492370605, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 2 }, [3] = { markerPos = {-64.162605285645, -1481.2530517578, 10, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 1 }, [4] = { markerPos = {204.0777130127, -474.44369506836, 10.1, 0, 0}, --shopMarkerPos, dimension, interior previewPos = {418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0}, --previewPos, rot, dimension, interior previewCam = {414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275}, --previewCamPos exitPos = {414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0}, --exitPos, rot, dimension, interior weapons = {25, 26}, --weapons shopType = 2 } } What did I do wrong?
  21. I'm trying to do a shop similar like this, but with weapons, and I would like to have 2 types of shops, one where I can get melee weapons (modded for tools, so a tool-shop thing) and one for normal weapons. So I have to define these 2 types I guess, which I did in the tables. I would like to make a different marker color and blip for the types. So type 1 would be normal weapon shop, type 2 would be the tool-shop, weapon shops would have the pistol blip, tool-shops would have the wrench blip and two different colors. The markers are being created, the colors are matching just like blips, they are correct, but I also made a 3D text on the markers saying which "shop" is which. But for some reason, the texts don't match, if I have for example 1 shop the type 1 shop matches, so it says "Weaponshop", but when I add a new table then it says "Tool-shop" but everything else matches, only the text changes. Why is this happening? What did I miss or do wrong? Client side: addEventHandler("onClientResourceStart", resourceRoot, function() for k, v in pairs(weaponShops) do local id = v[25] local weaponShopType = v[6] if weaponShopType == 1 then weaponShopTypeText = "Fegyverbolt" markerColorR, markerColorG, markerColorB = 150, 150, 150 blipIcon = 6 --fegyver blipColorR, blipColorG, blipColorB = 150, 150, 150 elseif weaponShopType == 2 then weaponShopTypeText = "Barkácsbolt" markerColorR, markerColorG, markerColorB = 255, 180, 0 blipIcon = 27 --kalapács blipColorR, blipColorG, blipColorB = 255, 180, 0 end local weaponShopBlip = createBlip(v[1], v[2], v[3], blipIcon, 2, blipColorR, blipColorG, blipColorB, 255) local weaponShopMarker = createMarker(v[1], v[2], v[3], "cylinder", 1.5, markerColorR, markerColorG, markerColorB, 75) --setElementData(weaponShopMarker, "markerID-->weaponShop", v[24]) setElementDimension(weaponShopMarker, v[4]) setElementInterior(weaponShopMarker, v[5]) addEventHandler("onClientRender", root, function() exports.vice_util:dxDrawTextOnElement(weaponShopMarker, weaponShopTypeText, 1, 20, 255, 255, 255, 255, 2, "default-bold") end) addEventHandler("onClientMarkerHit", weaponShopMarker, function(hitPlayer, matchingDimension) --local id = getElementData(source, "markerID-->weaponShop") triggerServerEvent("selectSkin", hitPlayer,id) --addEventHandler("onClientRender", root, drawSkinShop) end) end end) Tables: weaponShops = { -- markerX, markerY, markerZ, markerDimension, markerInterior, previewX, previewY, previewZ, previewRot, previewDimension, previewInterior, previewCamX, previewCamY, previewCamZ, previewCamLX, previewCamLY, previewCamLZ, exitPosX, exitPosY, exitposZ, markerID --marker #1 {364.40679931641, 1056.0571289063, 19, 0, 0, 1, --shopMarkerPos, dimension, interior 418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0, --previewPos, rot, dimension, interior 414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275, --previewCamPos 414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0, --exitPos, rot, dimension, interior 1, weapons = {32, 29}}, --markerID, weapons --marker #2 {364.09176635742, 1078.3028564453, 19, 0, 0, 2, -11.364508628845, -929.12506103516, 10.419666290283, 180, 0, 0, -11.375499725342, -934.71636962891, 11.142499923706, -11.366688728333, -933.71667480469, 11.120515823364, -15.293229103088, -933.56903076172, 10.419666290283, 213.12492370605, 0, 0, 2, weapons = {25, 26}}, --marker #3 {-64.162605285645, -1481.2530517578, 10, 0, 0, 1, --shopMarkerPos, dimension, interior 418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0, --previewPos, rot, dimension, interior 414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275, --previewCamPos 414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0, --exitPos, rot, dimension, interior 3, weapons = {32, 29}}, --marker #4 {204.0777130127, -474.44369506836, 10.1, 0, 0, 2, --shopMarkerPos, dimension, interior 418.73413085938, 1038.1110839844, 25.25609588623, 61.661361694336, 0, 0, --previewPos, rot, dimension, interior 414.91680908203, 1039.669921875, 26.514999389648, 415.83294677734, 1039.3103027344, 26.337924957275, --previewCamPos 414.23324584961, 1042.4398193359, 25.409734725952, 5.6778540611267, 0, 0, --exitPos, rot, dimension, interior 4, weapons = {32, 29}}, } I didn't update lots of coordinates, only the marker creation coordinates, since I don't even made the weapon buying script yet, I just want to make the markers now. Also, I was trying to remove the setElementData for the marker, since I think it's unnecessary, because I can do the same with a variable, or am I wrong?
×
×
  • Create New...