Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    Why this error?

    Your factions aren't configured correctly. Go into your item-system then open g_items.lua. You'll see something like this: { "LSPD badge", "a LSPD badge", {[1] = true}, {0,100,255}, 2} Change that number in "[1] = true" to faction ID you are in. To check in which faction ID you're, do /crun getElementData(getPlayerTeam(localPlayer), "id").
  2. GTX

    Announce Value

    That's pretty much it. Announce values are only used to be seen outside of servers on game-monitor.com. There's no other use of them.
  3. You also need a function. function round(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end
  4. GTX

    ColShape detection

    onClientColShapeHit doesn't trigger when a world object touches it. Use processLineOfSight
  5. GTX

    Help MTA Browser

    Hmm, maybe it's a bug. Did you use injectBrowserMouseUp/Down functions?
  6. Script will never magically work like this. You must use: getRealTime getAccountData setAccountData setElementData getElementData
  7. GTX

    need help

    Isn't that only a map?
  8. What the hell? function setAccountDataText(playerSource) local Cuenta = getPlayerAccount (playerSource) local userText = getAccountData(Cuenta, "userText") or "none" setElementData(playerSource, "nameTagText",tostring(userText)) end addEvent ( "setAccountDataText", true ) addEventHandler ( "setAccountDataText", getRootElement(),setAccountDataText)
  9. GTX

    Why this error?

    It should output something in any case... Any errors in debugscript? Are you sure you're entering the right command? Is resource even started? I need more informations, not just "doesn't work". This should output "test", if it doesn't, then I've no idea. function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) outputChatBox"test" local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false)
  10. GTX

    Why this error?

    That's because the badge number you entered either does not exist or your factions aren't configured correctly. (Is this from Valhalla?) Show me badges table. Also tell me what it outputs: function givePlayerBadge(thePlayer, commandName, targetPlayer, ... ) local badgeNumber = table.concat( { ... }, " " ) badgeNumber = #badgeNumber > 0 and badgeNumber local theTeam = getPlayerTeam(thePlayer) local teamID = getElementData(theTeam, "id") local badge = nil local itemID = nil local prefix = "" for k, v in pairs(badges) do for ka, va in pairs(v[3]) do if ka == teamID then badge = v itemID = k prefix = type(va) == "string" and ( va .. " " ) or "" end end end if not badge then outputChatBox("Badge number does not exist!", thePlayer, 255, 0, 0) return end local leader = getElementData(thePlayer, "factionleader") if not (tonumber(leader)==1) then outputChatBox("You must be a faction leader to issue badges.", thePlayer, 255, 0, 0) else if not targetPlayer or not badgeNumber then outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Nick / ID] [badge Number]", thePlayer, 255, 194, 14) else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if targetPlayer then local targetPlayerName = targetPlayerName:gsub("_", " ") local logged = getElementData(targetPlayer, "loggedin") if (logged==0) then outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0) else local x, y, z = getElementPosition(thePlayer) local tx, ty, tz = getElementPosition(targetPlayer) if (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)>4) then outputChatBox("You are too far away to issue this player a badge.", thePlayer, 255, 0, 0) else exports.global:sendLocalMeAction(thePlayer, "issues "..targetPlayerName.." " .. badge[2] .. ", reading " .. badgeNumber .. ".") exports.global:giveItem(targetPlayer, itemID, prefix .. badgeNumber) end end end end end end addCommandHandler("issuebadge", givePlayerBadge, false, false)
  11. Of course. The dollar string at the end of your item text is not a number! This is already the second time you did this. btnbuy = guiCreateButton(773, 596, 127, 41, "buyWep", false) gridlist = guiCreateGridList(412, 179, 488, 412, false) guiGridListAddColumn(gridlist, "#", 0.2) guiGridListAddColumn(gridlist, "Name", 0.2) guiGridListAddColumn(gridlist, "Price", 0.2) guiGridListAddColumn(gridlist, "AMMO", 0.2) for k,v in ipairs ( Weapons ) do local row = guiGridListAddRow (gridlist) guiGridListSetItemText (gridlist, row, 1,v [1] , false, false) guiGridListSetItemText (gridlist, row, 2, v [2], false, false) guiGridListSetItemText (gridlist, row, 3, v [3].."$" , false, false) guiGridListSetItemText (gridlist, row, 4, v [4] , false, false) end function buygun() if (source == btnbuy) then if (guiGridListGetSelectedItem (gridlist)) then local weapID = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 1) local weapName = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 2) local weapPrice = tonumber(guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 3):gsub("$", "")) local weapAMMO = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 4) triggerServerEvent ("buyweapon", getLocalPlayer(), weapID, weapName, weapPrice, weapAMMO) end end end addEventHandler ("onClientGUIClick", getRootElement(), buygun)
  12. GTX

    Why this error?

    What's the problem? Any error in debugscript?
  13. There's an example. local FROM="example.lua" local TO="compiled.lua" fetchRemote( "https://luac.multitheftauto.com/?compile=1&debug=0&obfuscate=0", function(data) fileSave(TO,data) end, fileLoad(FROM), true ) You can use this when resource starts. There's also another way to secure your script. Use cache attribute in meta. https://wiki.multitheftauto.com/wiki/Meta.xml
  14. GTX

    Why this error?

    Looks alright to me. Maybe you didn't pass "text" as string? function removeOOC(text) return tostring(text):gsub("%s*%(%(([^)]+)%)%)%s*","") end
  15. function theLocator(source) local allLocation = {["Los Santos"]=true, ["Las Venturas"]=true} local theLocation = getElementZoneName(source, true) for i=1, #allLocation do if (allLocation[theLocation]) then killPed(source) end end end function checkLocation() source = source setTimer(theLocator, 1000, 0, source) end addEventHandler("onPlayerSpawn", getRootElement(), checkLocation) -- Test Command addCommandHandler("locator", theLocator)
  16. GTX

    Userpanel Help me !

    No problem, toni And XeRo, don't spam! addEvent("nitroPickup", true) addEventHandler("nitroPickup", getRootElement(), function() if isPedInVehicle(source) then local account = getPlayerAccount(source) if account then if tonumber(getAccountData(account,"cash")) >= 1000 then --- change the string "cash" to what the money data is saved (cash,money) addVehicleUpgrade(getPedOccupiedVehicle(source),1010) setAccountData(account,"cash",(tonumber(getAccountData(account,"cash")) or 0)-1000) --- change the string "cash" to what the money data is saved (cash,money) outputChatBox ( "Buy Nitro [$1000 ]", source, 0, 0, 0, true ) else outputChatBox ( "You enough to money", source, 0, 0, 0, true ) end end end end )
  17. GTX

    CEF

    CEF is still in development. I also noticed lag, even on YouTube. Before release (in RC) there was less lag. For the 3D click interaction, use this: https://github.com/samt2497/mta-holoscreen
  18. GTX

    Mods

    https://wiki.multitheftauto.com/wiki/Shader_examples Here are some good examples.
  19. If you want specifically Los Santos, I'd suggest: getZoneName It's much easier than creating col sphere
  20. GTX

    Userpanel Help me !

    addEvent("nitroPickup", true) addEventHandler("nitroPickup", getRootElement(), function() if isPedInVehicle(source) then local account = getPlayerAccount(source) if account then if getAccountData(account,"cash") >= 1000 then --- change the string "cash" to what the money data is saved (cash,money) addVehicleUpgrade(getPedOccupiedVehicle(source),1010) setAccountData(account,"cash",(getAccountData(account,"cash") or 0)-1000) --- change the string "cash" to what the money data is saved (cash,money) outputChatBox ( "Buy Nitro [$1000 ]", source, 0, 0, 0, true ) else outputChatBox ( "You enough to money", source, 0, 0, 0, true ) end end end end )
  21. Like novo said, you must override addEventHandler. local events = {} _addEventHandler = addEventHandler function addEventHandler(event, element, func) if func then if event == "onClientResourceStart" then func() else if _addEventHandler(event, element, func) then events[#events+1] = {event, element, func} end end end end And then also unload it with removeEventHandler. I suggest also to store all functions and variables into own environment using setfenv.
  22. Use this http://www.gtamodding.com/wiki/Handling ... an_Andreas local vehicles = {{"Banshee", 1400, 3000, 2, 0, 0, -0.2, 70, 1, 0.89, 0.5, 5, 220, 16, 10, "rp", 8, 0.52, false, 34, 1.6, 0.1, 5, 0.3, -0.15, 0.5, 0.3, 0.15, 0.49, 45000, 0, 0, 1, 1, 1}} for i, v in ipairs(vehicles) do local vehicle = getVehicleModelFromName(v[1]) setModelHandling(vehicle, "mass", v[2]) -- v[2] is fMass based on the website I sent you. setModelHandling(vehicle, "turnMass", v[3]) -- v[3] is fTurnMass based on the website I sent you. end Continue from here by yourself.
  23. GTX

    I need help

    4 posts in 1 day? Are you sick? function onStart() window = guiCreateWindow(519,214,347,282,"24/7 Shop",false) sevenShopList = guiCreateGridList(11,25,326,218,false,window) guiGridListSetSelectionMode(sevenShopList,0) id = guiGridListAddColumn(sevenShopList,"ID:",0.19,window) wepname = guiGridListAddColumn(sevenShopList,"Name:",0.38,window) wepprice = guiGridListAddColumn(sevenShopList,"Price",0.38,window) buy = guiCreateButton(13,249,134,23,"Buy",false,window) reject = guiCreateButton(199,249,134,23,"Close ",false,window) guiWindowSetSizable(window,false) guiSetVisible (window,false) end addEventHandler("onClientResourceStart",resourceRoot,onStart) addEvent("sevenShop:showGUI",true) addEventHandler("sevenShop:showGUI",root, function (sevenShop) guiGridListClear(sevenShopList) for i,v in ipairs(sevenShop) do local row = guiGridListAddRow(sevenShopList) guiGridListSetItemText(sevenShopList, row, wepname, getWeaponNameFromID(v[2]), false, false) guiGridListSetItemText(sevenShopList, row, id, v[1], false, false) guiGridListSetItemText(sevenShopList, row, wepprice, v[3], false, false) end guiSetVisible (window,true) showCursor(true) end) addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) elseif (source == accept) then local weaponName = guiGridListGetItemText(sevenShopList,guiGridListGetSelectedItem(sevenShopList),2) if weaponName then triggerServerEvent("weapon_Name",localPlayer,weaponName) guiSetVisible(window,false) showCursor(false) end end end) local sevenshopmarkers = { {x=2184.56, y=1996.33, z=10.82, size=1.5, int=0, dim=0, r=0, g=165, b=180, a=170} } local sevenShoplist = { --RandomID[1],WeaponID[2],Price[3],ItemPriceTable[4]. {1,1,"100$",100}, {2,2,"2,400$",2400}, {3,3,"1,000$",1000}, {4,4,"1,000$",1000}, {5,5,"1,000$",1000}, {6,6,"1,000$",1000}, {7,7,"1,000$",1000}, {8,8,"1,000$",1000}, {9,9,"1,000$",1000}, {10,10,"1,000$",1000}, } addEventHandler("onResourceStart",resourceRoot, function () for index, pos in pairs(sevenshopmarkers) do local sevenshopmarkers = createMarker(pos.x, pos.y, pos.z-1, "cylinder", pos.size, pos.r, pos.g, pos.b, pos.a) setElementInterior (sevenshopmarkers, pos.int) setElementDimension(sevenshopmarkers, pos.dim) addEventHandler("onMarkerHit",sevenshopmarkers,MarkerHit) createBlip(pos.bx, pos.by, 100, 17, 2, 255, 255, 255, 255, 0, 400) end end) function MarkerHit(player, dim) if (dim and getElementType(player) == "player") then triggerClientEvent(player,"sevenShop:showGUI",player,sevenShoplist) end end g_Root = getRootElement() resourceRoot = getResourceRootElement(getThisResource()) function giveClientWeapons(sevenShop) giveWeapon(source, getWeaponIDFromName(sevenShop),1) takePlayerMoney( source, 100 ) end addEvent( "weapon_Name", true ) addEventHandler("weapon_Name", root, giveClientWeapons)
  24. GTX

    I need help

    Such amateur mistakes, lol. local sevenshopmarkers = { {x=2184.56, y=1996.33, z=10.82, size=1.5, int=0, dim=0, r=0, g=165, b=180, a=170} } local sevenShoplist = { --RandomID[1],WeaponID[2],Price[3],ItemPriceTable[4]. {1,1,"100$",100}, {2,2,"2,400$",2400}, {3,3,"1,000$",1000}, {4,4,"1,000$",1000}, {5,5,"1,000$",1000}, {6,6,"1,000$",1000}, {7,7,"1,000$",1000}, {8,8,"1,000$",1000}, {9,9,"1,000$",1000}, {10,10,"1,000$",1000}, } addEventHandler("onResourceStart",resourceRoot, function () for index, pos in pairs(sevenshopmarkers) do local sevenshopmarkers = createMarker(pos.x, pos.y, pos.z-1, "cylinder", pos.size, pos.r, pos.g, pos.b, pos.a) setElementInterior (sevenshopmarkers, pos.int) setElementDimension(sevenshopmarkers, pos.dim) addEventHandler("onMarkerHit",sevenshopmarkers,MarkerHit) createBlip(pos.bx, pos.by, 100, 17, 2, 255, 255, 255, 255, 0, 400) end end) function MarkerHit(player, dim) if (dim and getElementType(player) == "player") then triggerClientEvent(player,"sevenShop:showGUI",player,sevenShoplist) end end g_Root = getRootElement() resourceRoot = getResourceRootElement(getThisResource()) function giveClientWeapons(sevenShop) giveWeapon(client, getWeaponIDFromName(sevenShop),1) takePlayerMoney( client, 100 ) end addEvent( "weapon_Name", true ) addEventHandler("weapon_Name", g_Root, giveClientWeapons)
  25. GTX

    HTML full screen

    That doesn't help me. I need more details.
×
×
  • Create New...