Jump to content

Eshtiz

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by Eshtiz

  1. Eshtiz

    limit

    I like what you did there, very clever, but sadly it doesn't work it still lets people set above 1500
  2. Eshtiz

    limit

    The fields to the right, people can enter any amount in the field, I only want it possible to set it to 1500 as max. Is that better?
  3. Eshtiz

    limit

    The number 1500, Draken. As 'Wage' sets their pay slips / pay, the leaders of a faction can set it to whatever they want as there is no limit on it. I'm kinda trying to set a limit so 1500$ is the max number that can be set in the "Edit"
  4. Eshtiz

    limit

    I mean here, tRankWages[i] = guiCreateEdit(0.775, y, 0.2, 0.04, tostring(arrFactionWages[i]), true, wRanks) ( line 30-31 on first post ) I'm trying to add a limit to it, 0-1500 so people can't put more than 1500 in it.
  5. Eshtiz

    limit

    Hi, I'm trying to set a limit on 'wage' on guiCreateEdit So I'm trying to set the limit to 0-1500 and nothing above but how? -- RANKS/WAGES lRanks = { } tRanks = { } tRankWages = { } wRanks = nil bRanksSave, bRanksClose = nil function btEditRanks(button, state) if (source==gButtonEditRanks) and (button=="left") and (state=="up") then local factionType = tonumber(getElementData(theTeam, "type")) lRanks = { } tRanks = { } tRankWages = { } guiSetInputEnabled(true) if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then -- factions w/ wages local width, height = 400, 620 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wRanks = guiCreateWindow(x, y, width, height, "Ranks & Wages", false) local y = 0.0525 for i=1, 16 do lRanks[i] = guiCreateLabel(0.05, y+0.0025, 0.4, 0.1, "Rank #" .. i .. " Title & Wage: ", true, wRanks) guiSetFont(lRanks[i], "default-bold-small") tRanks[i] = guiCreateEdit(0.4, y, 0.3, 0.04, arrFactionRanks[i], true, wRanks) tRankWages[i] = guiCreateEdit(0.775, y, 0.2, 0.04, tostring(arrFactionWages[i]), true, wRanks) y = y + 0.05 end else local width, height = 400, 620 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wRanks = guiCreateWindow(x, y, width, height, "Ranks", false) local y = 0.0525 for i=1, 16 do lRanks[i] = guiCreateLabel(0.05, y+0.0025, 0.4, 0.1, "Rank #" .. i .. " Title: ", true, wRanks) guiSetFont(lRanks[i], "default-bold-small") tRanks[i] = guiCreateEdit(0.3, y, 0.6, 0.04, arrFactionRanks[i], true, wRanks) y = y + 0.05 end end bRanksSave = guiCreateButton(0.05, 0.850, 0.9, 0.075, "Save!", true, wRanks) bRanksClose = guiCreateButton(0.05, 0.940, 0.9, 0.075, "Close", true, wRanks) addEventHandler("onClientGUIClick", bRanksSave, saveRanks, false) addEventHandler("onClientGUIClick", bRanksClose, closeRanks, false) end end function saveRanks(button, state) if (source==bRanksSave) and (button=="left") and (state=="up") then local found = false local isNumber = true for key, value in ipairs(tRanks) do if (string.find(guiGetText(tRanks[key]), ";")) or (string.find(guiGetText(tRanks[key]), "'")) then found = true end end local factionType = tonumber(getElementData(theTeam, "type")) if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then for key, value in ipairs(tRankWages) do if not (tostring(type(tonumber(guiGetText(tRankWages[key])))) == "number") then isNumber = false end end end if (found) then outputChatBox("Your ranks contain invalid characters, please ensure it does not contain characters such as '@.;", 255, 0, 0) elseif not (isNumber) then outputChatBox("Your wages are not numbers, please ensure you entered a number and no currency symbol.", 255, 0, 0) else local sendRanks = { } local sendWages = { } for key, value in ipairs(tRanks) do sendRanks[key] = guiGetText(tRanks[key]) end if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then for key, value in ipairs(tRankWages) do sendWages[key] = guiGetText(tRankWages[key]) end end hideFactionMenu() if (factionType==2) or (factionType==3) or (factionType==4) or (factionType==5) or (factionType==6) then triggerServerEvent("cguiUpdateRanks", getLocalPlayer(), sendRanks, sendWages) else triggerServerEvent("cguiUpdateRanks", getLocalPlayer(), sendRanks) end end end end function closeRanks(button, state) if (source==bRanksClose) and (button=="left") and (state=="up") then if (wRanks) then destroyElement(wRanks) lRanks, tRanks, tRankWages, wRanks, bRanksSave, bRanksClose = nil, nil, nil, nil, nil, nil guiSetInputEnabled(false) end end end -- // CALL BACKS FROM CLIENT GUI function callbackUpdateRanks(ranks, wages) local theTeam = getPlayerTeam(client) local factionID = getElementData(theTeam, "id") for key, value in ipairs(ranks) do ranks[key] = mysql:escape_string(ranks[key]) end if (wages) then for key, value in ipairs(wages) do wages[key] = tonumber(wages[key]) or 0 end mysql:query_free("UPDATE factions SET wage_1='" .. wages[1] .. "', wage_2='" .. wages[2] .. "', wage_3='" .. wages[3] .. "', wage_4='" .. wages[4] .. "', wage_5='" .. wages[5] .. "', wage_6='" .. wages[6] .. "', wage_7='" .. wages[7] .. "', wage_8='" .. wages[8] .. "', wage_9='" .. wages[9] .. "', wage_10='" .. wages[10] .. "', wage_11='" .. wages[11] .. "', wage_12='" .. wages[12] .. "', wage_13='" .. wages[13] .. "', wage_14='" .. wages[14] .. "', wage_15='" .. wages[15] .. "', wage_16='" .. wages[16] .. "' WHERE id='" .. factionID .. "'") exports['anticheat-system']:changeProtectedElementDataEx(theTeam, "wages", wages, false) end mysql:query_free("UPDATE factions SET rank_1='" .. ranks[1] .. "', rank_2='" .. ranks[2] .. "', rank_3='" .. ranks[3] .. "', rank_4='" .. ranks[4] .. "', rank_5='" .. ranks[5] .. "', rank_6='" .. ranks[6] .. "', rank_7='" .. ranks[7] .. "', rank_8='" .. ranks[8] .. "', rank_9='" .. ranks[9] .. "', rank_10='" .. ranks[10] .. "', rank_11='" .. ranks[11] .. "', rank_12='" .. ranks[12] .. "', rank_13='" .. ranks[13] .. "', rank_14='" .. ranks[14] .. "', rank_15='" .. ranks[15] .. "', rank_16='".. ranks[16] .."' WHERE id='" .. factionID .. "'") exports['anticheat-system']:changeProtectedElementDataEx(theTeam, "ranks", ranks, false) outputChatBox("Faction information updated successfully.", source, 0, 255, 0) showFactionMenu(source) end addEvent("cguiUpdateRanks", true ) addEventHandler("cguiUpdateRanks", getRootElement(), callbackUpdateRanks)
  6. Thank you but what did you do? I have similar errors I'm trying to fix EDIT:nvm
  7. It gives an error on line 261: attempt to compare number with nil whole command stopped working line: 16 here (only posted function) function getNearbyVehicles(thePlayer, commandName) if (exports.global:isPlayerAdmin(thePlayer)) then outputChatBox("Nearby Vehicles:", thePlayer, 255, 126, 0) local count = 0 for index, nearbyVehicle in ipairs( exports.global:getNearbyElements(thePlayer, "vehicle") ) do local thisvehid = getElementData(nearbyVehicle, "dbid") local vehicleID = getElementModel(nearbyVehicle) local vehicleName = getVehicleNameFromModel(vehicleID) local owner = getElementData(nearbyVehicle, "owner") local faction = getElementData(nearbyVehicle, "faction") count = count + 1 local ownerName = "" if (faction>0) then local theTeam = exports.pool:getElement("team", faction) if theTeam then ownerName = getTeamName(theTeam) end elseif (owner==-1) then ownerName = "Admin" elseif (owner>0) then ownerName = exports['cache']:getCharacterName(owner) else ownerName = "Civilian" end if (thisvehid) then outputChatBox(" " .. vehicleName .. " (" .. vehicleID ..") with ID: " .. thisvehid .. ". Owner: " .. ownerName, thePlayer, 255, 126, 0) elseif not (thisvehid) then outputChatBox(" " .. "*Temporary* " .. vehicleName .. " (" .. vehicleID ..") with ID: " .. thisvehid .. ". Owner: " .. ownerName, thePlayer, 255, 126, 0) end end if (count==0) then outputChatBox(" None.", thePlayer, 255, 126, 0) end end end addCommandHandler("nearbyvehicles", getNearbyVehicles, false, false)
  8. Eshtiz

    Chat issue(s)

    In a definied team (faction), everyone who's in that faction will be able to see it PLUS nearby people, just like a radio and a required radio/item to use /f (factionOOC)
  9. Eshtiz

    Chat issue(s)

    Hello ( Again ), I've been trying to fix an unique feature but it keeps failing and disables all other chats and puts them together (classic MTA chat or whatever). I'm trying to make this chat into a radio: function factionOOC(thePlayer, commandName, ...) local logged = getElementData(thePlayer, "loggedin") if (logged==1) then if not (...) then outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) else local theTeam = getPlayerTeam(thePlayer) local theTeamName = getTeamName(theTeam) local playerName = getPlayerName(thePlayer) local playerFaction = getElementData(thePlayer, "faction") if not(theTeam) or (theTeamName=="Citizen") then outputChatBox("You are not in a faction.", thePlayer) else local message = table.concat({...}, " ") if (togState[playerFaction]) == true then return end exports.logs:logMessage("[OOC: " .. theTeamName .. "] " .. playerName .. ": " .. message, 6) for index, arrayPlayer in ipairs( getElementsByType( "player" ) ) do if isElement( arrayPlayer ) then if getElementData( arrayPlayer, "bigearsfaction" ) == theTeam then outputChatBox("((" .. theTeamName .. ")) " .. playerName .. ": " .. message, arrayPlayer, 3, 157, 157) elseif getPlayerTeam( arrayPlayer ) == theTeam and getElementData(thePlayer, "loggedin") == 1 then outputChatBox("((OOC Faction Chat)) " .. playerName .. ": " .. message, arrayPlayer, 3, 237, 237) end end end end end end end addCommandHandler("f", factionOOC, false, false) like this: function radio(source, radioID, message) radioID = tonumber(radioID) or 1 local hasRadio, itemKey, itemValue, itemID = exports.global:hasItem(source, 6) if hasRadio then local theChannel = itemValue if radioID ~= 1 then local count = 0 local items = exports['item-system']:getItems(source) for k, v in ipairs(items) do if v[1] == 6 then count = count + 1 if count == radioID then theChannel = v[2] break end end end end if theChannel == 1 then outputChatBox("Please Tune your radio (( /tuneradio # ))", source, 255, 194, 14) elseif theChannel > 1 then triggerClientEvent (source, "playRadioSound", getRootElement()) local username = getPlayerName(source) local languageslot = getElementData(source, "languages.current") local language = getElementData(source, "languages.lang" .. languageslot) local languagename = call(getResourceFromName("language-system"), "getLanguageName", language) local factionID = getElementData(source,"faction") if not (factionID == -1) then local theTeam = getPlayerTeam(source) local factionrank = tonumber(getElementData(source,"factionrank")) local ranks = getElementData(theTeam,"ranks") factionRankTitle = ranks[factionrank] .. " - " else factionRankTitle = "" end message = trunklateText( source, message ) outputChatBox("[" .. languagename .. "] [RADIO #" .. theChannel .. "] " .. factionRankTitle .. username .. " says: " .. message, source, 0, 102, 255) for key, value in ipairs(getElementsByType( "player" )) do local logged = getElementData(source, "loggedin") if (isElement(value)) and (logged==1) and (value~=source) then if (exports.global:hasItem(value, 6, theChannel)) then triggerClientEvent (value, "playRadioSound", getRootElement()) local message2 = call(getResourceFromName("language-system"), "applyLanguage", source, value, message, language) outputChatBox("[" .. languagename .. "] [RADIO #" .. theChannel .. "] " .. factionRankTitle .. username .. " says: " .. trunklateText( value, message2 ), value, 0, 102, 255) if (exports.global:hasItem(value, 88) == false) then -- Show it to people near who can hear his radio for k, v in ipairs(exports.global:getNearbyElements(value, "player",7)) do local logged2 = getElementData(v, "loggedin") if (logged2==1) then if (exports.global:hasItem(v, 6, targetChannel) == false) then local message2 = call(getResourceFromName("language-system"), "applyLanguage", source, v, message, language) outputChatBox("[" .. languagename .. "] " .. getPlayerName(value) .. "'s Radio: " .. trunklateText( v, message2 ), v, 255, 255, 255) end end end end end end end --Show the radio to nearby listening in people near the speaker for key, value in ipairs(getElementsByType("player")) do if getElementDistance(source, value) < 10 then if (value~=source) then local message2 = call(getResourceFromName("language-system"), "applyLanguage", source, value, message, language) outputChatBox("[" .. languagename .. "] " .. getPlayerName(source) .. " [RADIO] says: " .. message2, value, 255, 255, 255) end end end else outputChatBox("Your radio is off. ((/toggleradio))", source, 255, 0, 0) end else outputChatBox("You do not have a radio.", source, 255, 0, 0) end end I'm trying to add the sound, required radio to use /f(action chat) BUT no channel!!! Plus that nearby players can hear/see the text. It isn't really working as I said earlier, I'm simply trying to make the /f chat into a radio but no channel, it uses the faction's "default channel" like the chat.
  10. Sorry, it's not and I quite don't understand what you mean Draken, the very same 'line' is exactly the same on two different places in the whole script which is here: http://pastie.org/3409430 It's quite big.
  11. Well, the topic says it all, dxDrawImage can't load file error from /debugscript dxDrawRectangle( x, y, columns * sbox + spacer, rows * sbox + spacer, background_color ) for i = 1, columns * 5 do local col = math.floor( ( i - 1 ) / 5 ) local row = ( i - 1 ) % 5 local boxx = x + col * sbox + spacer local boxy = y + row * sbox + spacer local item = inventory[ i ] if item then if not isMove or item[4] ~= clickItemSlot.id then dxDrawRectangle( boxx, boxy, box, box, full_color ) dxDrawImage( boxx, boxy, box, box, getImage( item[1], item[2] ) ) -- ammo count for weapons if activeTab == 3 then dxDrawText( tostring( item[2] ), boxx + 2, boxy + 2, boxx + box - 2, boxy + box - 2, tooltip_text_color, 1, "clear", "right", "bottom", false, false, true ) end if not isMove and not clickWorldItem and isInBox( cursorX, cursorY, boxx, boxx + box, boxy, boxy + box ) then local itemName = getItemName( item[1], item[2] ) local itemValue = getItemValue( item[1], item[2] ) if itemValue and #tostring( itemValue ) > 0 and itemValue ~= 1 then itemName = itemName .. " (" .. itemValue .. ")" end tooltip( cursorX, cursorY, itemName, activeTab == 1 and getItemDescription( item[1], item[2] ) ) hoverItemSlot = { invslot = i, id = item[4], x = boxx, y = boxy } end end else dxDrawRectangle( boxx, boxy, box, box, empty_color ) end end end Why wont it load the image?
  12. Eshtiz

    Weird issue

    I do understand most parts of the script, I just don't see where the problem lays at. It do not say anything at all in debugscript 3, and yes, the script is "wired" to my mySQL database in order to make the script function-able. Everything works, every vehicle that should show up in the list shows, it just doesn't let people buy all of them. It is somehow connected to the other vehicle shop, EVEN if I turn it off it's the same problem, I have absolutely no idea where to start looking nor how to fix it.
  13. Eshtiz

    Weird issue

    I have this weird issue regarding Valhalla's carshop & Vedic's. For some reason I can only use The vedic shop because the Valhalla one ONLY sells vehicles that Vedic's car shop "chooses", random vehicles from time to time. I've checked thru every single line and I haven't found anything at all yet. This is Valhalla's, client: local rc = 10 local bike = 15 local low = 25 local offroad = 35 local sport = 100 local van = 50 local bus = 75 local truck = 200 local boat = 300 -- except dinghy local heli = 500 local plane = 750 local race = 75 local vehicleTaxes = { offroad, low, sport, truck, low, low, 1000, truck, truck, 200, -- dumper, stretch low, sport, low, van, van, sport, truck, heli, van, low, low, low, low, van, low, 1000, low, truck, van, sport, -- hunter boat, bus, 1000, truck, offroad, van, low, bus, low, low, -- rhino van, rc, low, truck, 500, low, boat, heli, bike, 0, -- monster, tram van, sport, boat, boat, boat, truck, van, 10, low, van, -- caddie plane, bike, bike, bike, rc, rc, low, low, bike, heli, van, bike, boat, 20, low, low, plane, sport, low, low, -- dinghy sport, bike, van, van, boat, 10, 75, heli, heli, offroad, -- baggage, dozer offroad, low, low, boat, low, offroad, low, heli, van, van, low, rc, low, low, low, offroad, sport, low, van, bike, bike, plane, plane, plane, truck, truck, low, low, low, plane, plane * 10, bike, bike, bike, truck, van, low, low, truck, low, -- hydra 10, 20, offroad, low, low, low, low, 0, 0, offroad, -- forklift, tractor, 2x train low, sport, low, van, truck, low, low, low, rc, low, low, low, van, plane, van, low, 500, 500, race, race, -- 2x monster race, low, race, heli, rc, low, low, low, offroad, 0, -- train trailer 0, 10, 10, offroad, 15, low, low, 3*plane, truck, low,-- train trailer, kart, mower, sweeper, at400 low, bike, van, low, van, low, bike, race, van, low, 0, van, 2*plane, plane, rc, boat, low, low, low, offroad, -- train trailer, andromeda low, truck, race, sport, low, low, low, low, low, van, low, low } car, wCars, bClose, bBuy, gCars, lCost, lColors, sCol1, sCol2 = nil activeShop, shopID = nil local function countVehicles( ) vehiclecount = {} for key, value in pairs( getElementsByType( "vehicle" ) ) do if isElement( value ) then local model = getElementModel( value ) if vehiclecount[ model ] then vehiclecount[ model ] = vehiclecount[ model ] + 1 else vehiclecount[ model ] = 1 end end end end local function copy( t ) if type(t) == 'table' then local r = {} for k, v in pairs( t ) do r[k] = copy( v ) end return r else return t end end local function sort( a, b ) return a[2] < b[2] end function showCarshopUI(id) shopID = id countVehicles() activeShop = copy( g_shops[id] ) local width, height = 400, 200 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth - width local y = scrHeight/10 wCars = guiCreateWindow(x, y, width, height, activeShop.name .. ": Purchase a Vehicle", false) guiWindowSetSizable(wCars, false) bClose = guiCreateButton(0.6, 0.85, 0.2, 0.1, "Close", true, wCars) bBuy = guiCreateButton(0.825, 0.85, 0.2, 0.1, "Buy", true, wCars) addEventHandler("onClientGUIClick", bClose, hideCarshopUI, false) addEventHandler("onClientGUIClick", bBuy, buyCar, false) car = createVehicle(451, unpack(activeShop.previewpos)) setVehicleColor(car, 0, 0, 0, 0) setVehicleEngineState(car, true) setVehicleOverrideLights(car, 2) if activeShop.rotate then addEventHandler("onClientRender", getRootElement(), rotateCar) end -- sort by price for key, value in ipairs( activeShop ) do if value[1] and value[2] and vehiclecount[ value[1] ] then value[2] = value[2] + ( vehiclecount[ value[1] ] or 0 ) * 600 end end table.sort( activeShop, sort ) gCars = guiCreateGridList(0.05, 0.1, 0.5, 0.75, true, wCars) addEventHandler("onClientGUIClick", gCars, updateCar, false) local col = guiGridListAddColumn(gCars, "Vehicle Model", 0.9) for key, value in ipairs( activeShop ) do local row = guiGridListAddRow(gCars) guiGridListSetItemText(gCars, row, col, tostring(getVehicleNameFromModel(value[1])), false, false) guiGridListSetItemData(gCars, row, col, tostring(key), false, false) end lCost = guiCreateLabel(0.15, 0.85, 0.4, 0.1, "Cost: --- - Tax: ---", true, wCars) guiSetFont(lCost, "default-bold-small") guiLabelSetHorizontalAlign(lCost, "right") guiGridListSetSelectedItem(gCars, 0, 1) updateCar() lColors = guiCreateLabel(0.6, 0.15, 0.2, 0.1, "Colors:", true, wCars) guiSetFont(lColors, "default-bold-small") sCol1 = guiCreateScrollBar(0.6, 0.25, 0.35, 0.1, true, true, wCars) sCol2 = guiCreateScrollBar(0.6, 0.35, 0.35, 0.1, true, true, wCars) addEventHandler("onClientGUIScroll", sCol1, updateColors) addEventHandler("onClientGUIScroll", sCol2, updateColors) guiSetProperty(sCol1, "StepSize", "0.01") guiSetProperty(sCol2, "StepSize", "0.01") setCameraMatrix(unpack(activeShop.cameramatrix)) guiSetInputEnabled(true) outputChatBox("Welcome to " .. activeShop.name .. ".") end addEvent("showCarshopUI", true) addEventHandler("showCarshopUI", getRootElement(), showCarshopUI) function updateCar() local row, col = guiGridListGetSelectedItem(gCars) if row ~= -1 and col ~= -1 then local key = tonumber(guiGridListGetItemData(gCars, row, col)) local value = activeShop[key] setElementModel(car, value[1]) guiSetText(lCost, "Cost: " .. tostring(value[2]) .. "$" .. " - Tax: " .. ( vehicleTaxes[value[1]-399] or 25 ) .. "$") local money = exports.global:getMoney(getLocalPlayer()) if value[2] > money then guiLabelSetColor(lCost, 255, 0, 0) guiSetEnabled(bBuy, false) else guiLabelSetColor(lCost, 0, 255, 0) guiSetEnabled(bBuy, true) end else guiSetEnabled(bBuy, false) end end function updateColors() local col1 = guiScrollBarGetScrollPosition(sCol1) local col2 = guiScrollBarGetScrollPosition(sCol2) setVehicleColor(car, col1, col2, col1, col2) end function rotateCar() local rx, ry, rz = getElementRotation(car) setElementRotation(car, rx > 5 and rx < 355 and 0 or rx, ry > 5 and ry < 355 and 0 or ry, rz+1) local x, y, z = unpack(activeShop.previewpos) if getDistanceBetweenPoints3D(x, y, z, getElementPosition(car)) > 2 then setElementPosition(car, x, y, z) end end function hideCarshopUI() destroyElement(bClose) bClose = nil destroyElement(bBuy) bBuy = nil destroyElement(car) car = nil destroyElement(gCars) gCars = nil destroyElement(lCost) lCost = nil destroyElement(lColors) lColors = nil destroyElement(sCol1) sCol1 = nil destroyElement(sCol2) sCol2 = nil destroyElement(wCars) wCars = nil if activeShop.rotate then removeEventHandler("onClientRender", getRootElement(), rotateCar) end activeShop = nil shopID = nil setCameraTarget(getLocalPlayer()) guiSetInputEnabled(false) end function buyCar(button) if (button=="left") then if exports.global:hasSpaceForItem(getLocalPlayer(), 3) then local row, col = guiGridListGetSelectedItem(gCars) local key = tonumber(guiGridListGetItemData(gCars, row, col)) local value = activeShop[key] local car = value[1] local cost = value[2] local col1 = guiScrollBarGetScrollPosition(sCol1) local col2 = guiScrollBarGetScrollPosition(sCol2) local px, py, pz, prz = unpack(activeShop.player) local x, y, z, rz = unpack(activeShop.car) local shopid = shopID hideCarshopUI() triggerServerEvent("buyCar", getLocalPlayer(), car, cost, col1, col2, x, y, z, rz, px, py, pz, prz, shopid) else outputChatBox("You can't carry the car keys - your inventory is full.", 255, 0, 0) end end end server: local mysql = exports.mysql local priceCache = { } local vehiclecount = { } carshopPickup = createPickup(544.4990234375, -1292.7890625, 17.2421875, 3, 1239) exports['anticheat-system']:changeProtectedElementDataEx(carshopPickup, "shopid", 1, false) boatshopPickup = createPickup(715.35546875, -1705.5791015625, 2.4296875, 3, 1239) exports['anticheat-system']:changeProtectedElementDataEx(boatshopPickup, "shopid", 2, false) cheapcarshopPickup = createPickup( 2131.8115234375, -1151.3212890625, 24.060283660889, 3, 1239) exports['anticheat-system']:changeProtectedElementDataEx(cheapcarshopPickup, "shopid", 3, false) function pickupUse(thePlayer) if getElementData(source, "shopid") then if getElementData(thePlayer, "license.car") == 1 then triggerClientEvent(thePlayer, "showCarshopUI", thePlayer, getElementData(source, "shopid")) else outputChatBox("You need a Driving License to buy a car.", thePlayer, 255, 0, 0) end end cancelEvent() end addEventHandler("onPickupHit", getResourceRootElement(), pickupUse) local function copy( t ) if type(t) == 'table' then local r = {} for k, v in pairs( t ) do r[k] = copy( v ) end return r else return t end end local function countVehicles( ) vehiclecount = {} for key, value in pairs( getElementsByType( "vehicle" ) ) do if isElement( value ) then local model = getElementModel( value ) if vehiclecount[ model ] then vehiclecount[ model ] = vehiclecount[ model ] + 1 else vehiclecount[ model ] = 1 end end end end function buildPriceCache(shopID) priceCache[shopID] = { } local activeShop = copy( g_shops[shopID] ) for key, value in ipairs( activeShop ) do if value[1] and value[2] and vehiclecount[ value[1] ] then priceCache[shopID][ value[1] ] = value[2] + ( vehiclecount[ value[1] ] or 0 ) * 600 end end end function buyCar(id, cost, col1, col2, x, y, z, rz, px, py, pz, prz, shopID) countVehicles() buildPriceCache(shopID) if not(priceCache[shopID][id]) then exports.logs:logMessage("[CAR SHOP] " .. getPlayerIP(client).." \ ".. getPlayerName( client ) .. " tried to buy an " .. getVehicleNameFromModel( id ) .. " at an non existing shop for $".. cost..")", 32) return end if not (priceCache[shopID][id] == cost) then exports.logs:logMessage("[CAR SHOP] " .. getPlayerIP(client).." \ " .. getPlayerName( client ) .. " tried to buy an " .. getVehicleNameFromModel( id ) .. " at shop ".. shopID .." for $".. cost..")", 32) return end if exports.global:hasMoney(client, cost) then if exports.global:canPlayerBuyVehicle(client) then outputChatBox("You bought a " .. getVehicleNameFromModel(id) .. " for " .. cost .. "$. Enjoy!", client, 255, 194, 14) if shopID == 1 then outputChatBox("You can set this vehicles spawn position by parking it and typing /park", client, 255, 194, 14) outputChatBox("Vehicles parked near the dealership or bus spawn point will be deleted without notice.", client, 255, 0, 0) elseif shopID == 2 then outputChatBox("You can set this boats spawn position by parking it and typing /park", client, 255, 194, 14) outputChatBox("Boats parked near the marina will be deleted without notice.", client, 255, 0, 0) end outputChatBox("If you do not use /park within an hour, your car will be DELETED.", client, 255, 0, 0) outputChatBox("Press 'K' to unlock this vehicle.", client, 255, 194, 14) makeCar(client, id, cost, col1, col2, x, y, z, rz, px, py, pz, prz) else outputChatBox("You tried to buy a car, but you have too many vehicles already.", client, 255, 0, 0) end end end addEvent("buyCar", true) addEventHandler("buyCar", getRootElement(), buyCar) function makeCar(thePlayer, id, cost, col1, col2, x, y, z, rz, px, py, pz, prz) if not exports.global:takeMoney(thePlayer, cost) then return end if not exports.global:canPlayerBuyVehicle(source) then return end local rx = 0 local ry = 0 setElementPosition(thePlayer, px, py, pz) setPedRotation(thePlayer, prz) local username = getPlayerName(thePlayer) local dbid = getElementData(thePlayer, "dbid") 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) local locked = 0 local insertid = mysql:query_insert_free("INSERT INTO vehicles SET model='" .. mysql:escape_string(id) .. "', x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .. "', z='" .. mysql:escape_string(z) .. "', rotx='" .. mysql:escape_string(rx) .. "', roty='" .. mysql:escape_string(ry) .. "', rotz='" .. mysql:escape_string(rz) .. "', color1='" .. mysql:escape_string(col1) .. "', color2='" .. mysql:escape_string(col2) .. "', faction='-1', owner='" .. mysql:escape_string(dbid) .. "', plate='" .. mysql:escape_string(plate) .. "', currx='" .. mysql:escape_string(x) .. "', curry='" .. mysql:escape_string(y) .. "', currz='" .. mysql:escape_string(z) .. "', currrx='0', currry='0', currrz='" .. mysql:escape_string(rz) .. "', locked='" .. mysql:escape_string(locked) .. "'") if (insertid) then local veh = call( getResourceFromName( "vehicle-system" ), "createShopVehicle", insertid, id, x, y, z, 0, 0, rz, plate ) exports['anticheat-system']:changeProtectedElementDataEx(veh, "fuel", 100, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "Impounded", 0) setVehicleRespawnPosition(veh, x, y, z, 0, 0, rz) exports['anticheat-system']:changeProtectedElementDataEx(veh, "respawnposition", {x, y, z, 0, 0, rz}, false) setVehicleLocked(veh, false) setVehicleColor(veh, col1, col2, col1, col2) setVehicleOverrideLights(veh, 1) setVehicleEngineState(veh, false) setVehicleFuelTankExplodable(veh, false) -- make sure it's an unique key call( getResourceFromName( "item-system" ), "deleteAll", 3, insertid ) exports.global:giveItem( thePlayer, 3, insertid ) exports['anticheat-system']:changeProtectedElementDataEx(veh, "fuel", 100, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "engine", 0, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "oldx", x, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "oldy", y, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "oldz", z, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "faction", -1) exports['anticheat-system']:changeProtectedElementDataEx(veh, "owner", dbid, false) exports['anticheat-system']:changeProtectedElementDataEx(veh, "job", 0, false) exports['vehicle-system']:reloadVehicle(insertid) if getVehicleType" class="kw2">getVehicleType(veh) == "Boat" then exports.global:givePlayerAchievement(thePlayer, 27) else exports.global:givePlayerAchievement(thePlayer, 17) -- my ride end exports.logs:logMessage("[CAR SHOP] " .. getPlayerName( thePlayer ) .. " bought car #" .. insertid .. " (" .. getVehicleNameFromModel( id ) .. ")", 9) end end there are like 15 other scripts from Vedic's car shop ._. Anyone else bumped into this problem and knows the fix?
  14. Eshtiz

    Problemo - HUD

    Still have the same problem also noticed that the clock/watch doesn't show either after a relog/login/reconnect. local screenX, screenY = guiGetScreenSize() local screenXStart = screenX - screenX local screenYStart = screenY - screenY function drawBox( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then dxDrawRectangle(screenX - 115, screenYStart + 70, 110, 12.5, tocolor(0, 0, 0, 230)) dxDrawRectangle(screenX - 115, screenYStart + 83, 110, 12.5, tocolor(0, 0, 0, 230)) end end -- CLOCK function getDayName( day ) if day == 0 then return "Sun" elseif day == 1 then return "Mon" elseif day == 2 then return "Tue" elseif day == 3 then return "Wed" elseif day == 4 then return "Thu" elseif day == 5 then return "Fri" elseif day == 6 then return "Sat" end end function getGameTime( ) local hour, mins = getTime() if mins < 10 then mins = "0".. mins -- show '01' instead of '1' in minutes end return hour.. " : ".. mins end -- HEALTH function getBarWidth( hp ) if hp >= 100 then return 100 -- If hp is more than 100, it shouldn't go out of the bar else return hp end end function drawHealthBar( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local health = getElementHealth( getLocalPlayer() ) if health >= 80 then r = 153 g = 0 b = 0 a = 255 elseif health >= 60 and health < 80 then r = 153 g = 0 b = 0 a = 255 elseif health >= 40 and health < 60 then r = 153 g = 0 b = 0 a = 255 elseif health < 40 then r = 153 g = 0 b = 0 end dxDrawRectangle(screenX - 110, screenYStart + 85, getBarWidth( health ), 8, tocolor(r, g, b, a)) end end -- ARMOR function getAmourBarWidth ( armour ) if armour >= 100 then return 100 -- If armour is more than 100, it shouldn't go out of the bar else return armour end end function drawArmourBar( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local armour = getPedArmor( getLocalPlayer() ) if armour > 0 then -- Only if he has armor dxDrawRectangle(screenX - 110, screenYStart + 72, getAmourBarWidth( armour ), 8, tocolor(200, 200, 200, 255)) end end end -- MONEY function drawPocketMoney( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local money = getPlayerMoney( getLocalPlayer() ) dxDrawText("$".. string.format("%08d", money), screenX - 105, screenYStart + 42, screenX, screenY, tocolor(0, 0, 0, 200), 0.8, "pricedown") dxDrawText("$".. string.format("%08d", money), screenX - 105, screenYStart + 43, screenX, screenY, tocolor(204, 204, 0, 200), 0.8, "pricedown") end end -- MONEY function drawMoney( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local money = getPlayerMoney( getLocalPlayer() ) local money = getElementData(localPlayer, "bankmoney") dxDrawText("Bank:".. string.format("%08d", money), screenX - 133, screenYStart + 96, screenX, screenY, tocolor(0, 0, 0, 200), 0.8, "pricedown") dxDrawText("Bank:".. string.format("%08d", money), screenX - 133, screenYStart + 94, screenX, screenY, tocolor(204, 204, 204, 200), 0.8, "pricedown") end end function onStartDisableHud( ) showPlayerHudComponent("ammo", false) showPlayerHudComponent("armour", false) showPlayerHudComponent("breath", false) showPlayerHudComponent("clock", false) showPlayerHudComponent("health", false) showPlayerHudComponent("money", false) showPlayerHudComponent("weapon", true) bindKey("r", "down", onWeaponReload) drawWeaponImageOnChange( 0, getPedWeaponSlot(getLocalPlayer())) -- Render! addEventHandler("onClientRender", getRootElement(), drawBox) -- box addEventHandler("onClientRender", getRootElement(), drawHealthBar) -- health addEventHandler("onClientRender", getRootElement(), drawArmourBar) -- armour addEventHandler("onClientRender", getRootElement(), drawMoney) -- bankmoney addEventHandler("onClientRender", getRootElement(), drawPocketMoney) -- pocketmoney end addEventHandler("onClientResourceStart", getRootElement(), onStartDisableHud) function onStopEnableHud( ) showPlayerHudComponent("ammo", false) showPlayerHudComponent("armour", true) showPlayerHudComponent("breath", true) showPlayerHudComponent("clock", false) showPlayerHudComponent("health", true) showPlayerHudComponent("money", true) end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), onStopEnableHud) function toggleHUD( state ) if state == true then bindKey("r", "down", onWeaponReload) drawWeaponImageOnChange( 0, getPedWeaponSlot(getLocalPlayer())) elseif state == false then if isElement(weaponImg) then destroyElement(weaponImg) end if isElement(weaponAmmo) then destroyElement(weaponAmmo) end removeEventHandler("onClientRender", getRootElement(), drawClock) -- clock removeEventHandler("onClientRender", getRootElement(), drawHealthBar) -- health removeEventHandler("onClientRender", getRootElement(), drawArmourBar) -- armour removeEventHandler("onClientRender", getRootElement(), drawMoney) -- money end end addEvent("toggleHUD", true) addEventHandler("toggleHUD", getLocalPlayer(), toggleHUD) local weaponMaxClip = -- Maximum ammo a weapon holds in its each clip { [16] = 1, [17] = 1, [18] = 1, [22] = 17, [23] = 17, [24] = 7, [25] = 1, [26] = 2, [27] = 7, [28] = 50, [29] = 30, [30] = 30, [31] = 50, [32] = 50, [33] = 1, [34] = 1, [35] = 1, [36] = 1, [39] = 1, [41] = 500, [42] = 500, [43] = 36, [37] = 50, [38] = 500 } function onWeaponReload( ) if (getPedWeapon(getLocalPlayer()) ~= 0) then setTimer(function() local ammoInClip = getPedAmmoInClip(getLocalPlayer()) local ammo = getPedTotalAmmo(getLocalPlayer()) - ammoInClip if isElement(weaponAmmo) then guiSetText(weaponAmmo, tostring(ammo) .." - ".. tostring(ammoInClip)) end end, 1500, 1) end end -- WEAPON HUD IMAGES & AMMO function drawWeaponImageOnChange( prevSlot, newSlot ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local weapon = getPedWeapon(getLocalPlayer(), newSlot) local ammoInClip = getPedAmmoInClip(getLocalPlayer()) local ammo = getPedTotalAmmo(getLocalPlayer()) - ammoInClip if (newSlot ~= 0 and newSlot ~= 1 and newSlot ~= 10 and newSlot ~= 11 and newSlot ~= 12) then if not isElement(weaponAmmo) then weaponAmmo = guiCreateLabel(screenX - 180, screenYStart + 86, 100, 100, tostring(ammo) .." - ".. tostring(ammoInClip), false) guiSetFont(weaponAmmo, "default-bold-small") else
  15. Eshtiz

    Problemo - HUD

    Nop, no errors at all EDIT: Trying to set it as the default weapon box / icons, that's all, but doesn't show after reconnecting or logging in. I have to restart the resource to make "new-ly" logged in players see it. NOTE: If I stop the hud-system resource, the weapon box doesn't show, even after it being stopped!
  16. Eshtiz

    Problemo - HUD

    That's fixed, but still if I /reconnect the weapon box / icons disappear. EDIT: doesn't seem to be fixed, I deleted the row where the error was and the same error I think, on the exact same row EDIT: Fixed. back to this: That's fixed, but still if I /reconnect the weapon box / icons disappear.
  17. Working on this, everything is fine, except for this: the weapon box / icons doesn't show after /reconnect'ing local screenX, screenY = guiGetScreenSize() local screenXStart = screenX - screenX local screenYStart = screenY - screenY function drawBox( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then dxDrawRectangle(screenX - 115, screenYStart + 70, 110, 12.5, tocolor(0, 0, 0, 200)) dxDrawRectangle(screenX - 115, screenYStart + 83, 110, 12.5, tocolor(0, 0, 0, 200)) end end -- CLOCK function getDayName( day ) if day == 0 then return "Sun" elseif day == 1 then return "Mon" elseif day == 2 then return "Tue" elseif day == 3 then return "Wed" elseif day == 4 then return "Thu" elseif day == 5 then return "Fri" elseif day == 6 then return "Sat" end end function getGameTime( ) local hour, mins = getTime() if mins < 10 then mins = "0".. mins -- show '01' instead of '1' in minutes end return hour.. " : ".. mins end -- HEALTH function getBarWidth( hp ) if hp >= 100 then return 100 -- If hp is more than 100, it shouldn't go out of the bar else return hp end end function drawHealthBar( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local health = getElementHealth( getLocalPlayer() ) if health >= 80 then r = 153 g = 0 b = 0 a = 255 elseif health >= 60 and health < 80 then r = 153 g = 0 b = 0 a = 255 elseif health >= 40 and health < 60 then r = 102 g = 0 b = 0 a = 255 elseif health < 40 then r = 51 g = 0 b = 0 if blink == 1 or not blink then -- Make the bar blink blink = 0 a = 0 elseif blink == 0 then blink = 1 a = 255 end end dxDrawRectangle(screenX - 110, screenYStart + 85, getBarWidth( health ), 8, tocolor(r, g, b, a)) end end -- ARMOR function getAmourBarWidth ( armour ) if armour >= 100 then return 100 -- If armour is more than 100, it shouldn't go out of the bar else return armour end end function drawArmourBar( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local armour = getPedArmor( getLocalPlayer() ) if armour > 0 then -- Only if he has armor dxDrawRectangle(screenX - 110, screenYStart + 72, getAmourBarWidth( armour ), 8, tocolor(200, 200, 200, 255)) end end end -- MONEY function drawMoney( ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local money = getPlayerMoney( getLocalPlayer() ) dxDrawText("$".. string.format("%08d", money), screenX - 121, screenYStart + 96, screenX, screenY, tocolor(0, 0, 0, 255), 1.03, "pricedown") dxDrawText("$".. string.format("%08d", money), screenX - 120, screenYStart + 97, screenX, screenY, tocolor(0, 102, 0, 255), 1, "pricedown") end end function onStartDisableHud( ) showPlayerHudComponent("ammo", false) showPlayerHudComponent("armour", false) showPlayerHudComponent("breath", false) showPlayerHudComponent("clock", true) showPlayerHudComponent("health", false) showPlayerHudComponent("money", false) showPlayerHudComponent("weapon", true) bindKey("r", "down", onWeaponReload) drawWeaponImageOnChange( 0, getPedWeaponSlot(getLocalPlayer())) -- Render! addEventHandler("onClientRender", getRootElement(), drawBox) -- box addEventHandler("onClientRender", getRootElement(), drawHealthBar) -- health addEventHandler("onClientRender", getRootElement(), drawArmourBar) -- armour addEventHandler("onClientRender", getRootElement(), drawMoney) -- money end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onStartDisableHud) function onStopEnableHud( ) showPlayerHudComponent("ammo", false) showPlayerHudComponent("armour", true) showPlayerHudComponent("breath", true) showPlayerHudComponent("clock", false) showPlayerHudComponent("health", true) showPlayerHudComponent("money", true) showPlayerHudComponent("weapon", false) end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), onStopEnableHud) function toggleHUD( state ) if state == true then bindKey("r", "down", onWeaponReload) drawWeaponImageOnChange( 0, getPedWeaponSlot(getLocalPlayer())) -- Render! addEventHandler("onClientRender", getRootElement(), drawBox) -- box addEventHandler("onClientRender", getRootElement(), drawHealthBar) -- health addEventHandler("onClientRender", getRootElement(), drawArmourBar) -- armour addEventHandler("onClientRender", getRootElement(), drawMoney) -- money elseif state == false then if isElement(weaponImg) then destroyElement(weaponImg) end if isElement(weaponAmmo) then destroyElement(weaponAmmo) end removeEventHandler("onClientRender", getRootElement(), drawClock) -- clock removeEventHandler("onClientRender", getRootElement(), drawHealthBar) -- health removeEventHandler("onClientRender", getRootElement(), drawArmourBar) -- armour removeEventHandler("onClientRender", getRootElement(), drawMoney) -- money end end addEvent("toggleHUD", true) addEventHandler("toggleHUD", getLocalPlayer(), toggleHUD) local weaponMaxClip = -- Maximum ammo a weapon holds in its each clip { [16] = 1, [17] = 1, [18] = 1, [22] = 17, [23] = 17, [24] = 7, [25] = 1, [26] = 2, [27] = 7, [28] = 50, [29] = 30, [30] = 30, [31] = 50, [32] = 50, [33] = 1, [34] = 1, [35] = 1, [36] = 1, [39] = 1, [41] = 500, [42] = 500, [43] = 36, [37] = 50, [38] = 500 } function onWeaponReload( ) if (getPedWeapon(getLocalPlayer()) ~= 0) then setTimer(function() local ammoInClip = getPedAmmoInClip(getLocalPlayer()) local ammo = getPedTotalAmmo(getLocalPlayer()) - ammoInClip if isElement(weaponAmmo) then guiSetText(weaponAmmo, tostring(ammo) .." - ".. tostring(ammoInClip)) end end, 1500, 1) end end -- WEAPON HUD IMAGES & AMMO function drawWeaponImageOnChange( prevSlot, newSlot ) if getElementData(getLocalPlayer(), "loggedin") == 1 then local weapon = getPedWeapon(getLocalPlayer(), newSlot) local ammoInClip = getPedAmmoInClip(getLocalPlayer()) local ammo = getPedTotalAmmo(getLocalPlayer()) - ammoInClip if (newSlot ~= 0 and newSlot ~= 1 and newSlot ~= 10 and newSlot ~= 11 and newSlot ~= 12) then if not isElement(weaponAmmo) then weaponAmmo = guiCreateLabel(screenX - 180, screenYStart + 86, 100, 100, tostring(ammo) .." - ".. tostring(ammoInClip), false) guiSetFont(weaponAmmo, "default-bold-small") else
  18. Thanks, worked, but had to add another 'end' in the last part, but what did you do exactly? Can't see any difference a part from the top part being removed and I aldready tried with / without it aldready and it didn't work. EDIT: How do I move around the texts? to different corners / sides?
  19. Ok, so I'm trying to learn lua, I know like MINIMUM, anyways, I'm trying my way with dxDrawText and bumps into a problem which I cannot seem to fix, I tried and tried and kept getting errors on line 1: expected #, ), ( and so on. https://wiki.multitheftauto.com/wiki/DxDrawText Most is copied from there as I'm trying to learn. This is what I got: bool= dxDrawText= ( ) string text, int left, int top [, int right=left, int bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false ] ) local screenWidth, screenHeight = guiGetScreenSize ( ) -- Get the screen resolution (width and height) function createText ( ) local playerX, playerY, playerZ = getElementPosition ( localPlayer ) -- Get our player's coordinates. local playerZoneName = getZoneName ( playerX, playerY, playerZ ) -- Get name of the zone the player is in. -- Draw zone name text's shadow. dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "bankgothic" ) -- Draw zone name text. dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. root = getRootElement () function updateCamera () local x, y, z = getElementPosition ( getLocalPlayer () ) setCameraMatrix ( x, y, z + 50, x, y, z ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) And a small side-question: where do I find functions/texts like this?: function createText ( ) local playerX, playerY, playerZ = getElementPosition ( localPlayer ) -- Get our player's coordinates. local playerZoneName = getZoneName ( playerX, playerY, playerZ ) -- Get name of the zone the player is in.
  20. For some reason, I failed two scripts. giveallmoney givemoney one is for a specific player, one is global. This is what I did, I added the 'hiddenadmin' things to it so it hide my admin status if I used it. Now if I'm on hidden admin duty, I don't receive money ( no one does ) if I use the command, but if I'm not hidden, they / I do. Here's the giveallmoney function function giveAllMoney(thePlayer, commandName, money) if (exports.global:isPlayerLeadAdmin(thePlayer)) then if (not money) then outputChatBox("SYNTAX: /" .. commandName .. " [Money]", thePlayer, 255, 194, 14) else local username = getPlayerName(thePlayer) end local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") if (hiddenAdmin==0) then local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) exports.global:sendMessageToAdmins("AdmCmd: " .. getPlayerName(thePlayer) .. " gave all players online " .. money .. " dollars.") outputChatBox("You have given $" .. money .. " to all players ", thePlayer) outputChatBox("" .. tostring(adminTitle) .. " " .. getPlayerName(thePlayer) .. " gave all players online " .. money .. " dollars.", getRootElement(), 255, 255, 255) else outputChatBox("Hidden Admin gave all players online " .. money .. " dollars.", getRootElement(), 255, 255, 255) end end end addCommandHandler("giveallmoney", giveAllMoney, false, false) Here's the givemoney function function giveMoney(thePlayer, commandName, target, money) if (exports.global:isPlayerLeadAdmin(thePlayer)) then if not (target) then outputChatBox("SYNTAX: /" .. commandName .. " [Partial Player Nick] [money]", thePlayer, 255, 194, 14) else local username = getPlayerName(thePlayer) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, target) if targetPlayer then local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") if (hiddenAdmin==0) then local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) exports.logs:logMessage("[GIVE] " .. getPlayerName(thePlayer):gsub("_", " ") .. " gave " .. targetPlayerName .. " to $" .. money, 23) exports.global:sendMessageToAdmins("AdmCmd: " .. getPlayerName(thePlayer) .. " gave " .. targetPlayerName .. " " .. money .. " dollars.") exports.global:giveMoney(targetPlayer, money) outputChatBox("You have given " .. targetPlayerName .. " $" .. money .. ".", thePlayer) outputChatBox("Admin " .. username .. " has given you $" .. money .. ".", targetPlayer) outputChatBox("" .. tostring(adminTitle) .. " " .. getPlayerName(thePlayer) .. " gave " .. targetPlayerName .. " " .. money .. " dollars.", getRootElement(), 255, 255, 255) else outputChatBox("Hidden Admin gave " .. targetPlayerName .. " " .. money .. " dollars.", getRootElement(), 255, 255, 255) end end end end end addCommandHandler("givemoney", giveMoney, false, false) Would appreciate help, I messed it up somewhere.
  21. I'm making a command to show the 'Admin' who used it the 'report commands', but the thing is, it shows to everyone online and that's really not what I'm trying to accomplish, trying to make it visible to only him if he uses it. Here's the script: function reportHelp(thePlayer) if (exports.global:isPlayerAdmin(thePlayer)) then outputChatBox("~-~-~-~-~-~ Report Commands ~-~-~-~-~", showPlayer, 255, 194, 14) outputChatBox("/reports - display reports", showPlayer, 255, 194, 14) outputChatBox("/ri [id] - report info", showPlayer, 255, 194, 14) outputChatBox("/tr [id] - transfer report", showPlayer, 255, 194, 14) outputChatBox("/cr [id] - close report", showPlayer, 255, 194, 14) outputChatBox("/ar [id] - accept report", showPlayer, 255, 194, 14) outputChatBox("/dr [id] - drop report", showPlayer, 255, 194, 14) outputChatBox("/fr [id] - false report", showPlayer, 255, 194, 14) end end addCommandHandler("rh", reportHelp)
  22. Doesn't work, I removed return then it duplicates the chat with tag & without as a player/admin. with return it doesn't let the player talk in GOOC. the other tags goes over it, duplicates the chat etc..
  23. (sorry solid >.<) Yeh.. how do I put a specific player with a tag? Need a special member of ours to have a specific unique tag. How do I trigger it to his account name & then put a tag in GOOC? Here's the complete script: function globalOOC(thePlayer, commandName, ...) local logged = tonumber(getElementData(thePlayer, "loggedin")) if (logged==1) then if not (...) then outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) else local oocEnabled = exports.global:getOOCState() message = table.concat({...}, " ") local muted = getElementData(thePlayer, "muted") if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) elseif (muted==1) then outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) else local players = exports.pool:getPoolElementsByType("player") local playerName = getPlayerName(thePlayer) local playerID = getElementData(thePlayer, "playerid") local r, g, b = getPlayerNametagColor(thePlayer) local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") local adminLevel = exports.global:getPlayerAdminLevel(thePlayer) exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) for k, arrayPlayer in ipairs(players) do local logged = tonumber(getElementData(arrayPlayer, "loggedin")) local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") if (logged==1) and (targetOOCEnabled==1) then if exports.global:isPlayerAdmin(thePlayer) then if (hiddenAdmin == 0) then if (adminLevel >= 1 and adminLevel < 4) then outputChatBox("(( [GOOC] #33FF00[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) elseif (adminLevel >= 4 and adminLevel < 1337) then outputChatBox("(( [GOOC] #c41212[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) end else if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) else outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) end end else if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) else outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) end end end end end end end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC)
  24. Eshtiz

    BankMoney

    Thanks, all I could find was online banks ._.
  25. Eshtiz

    BankMoney

    I mean tutorial(s)/guideline(s), I can't find anything on the internet to help me get started with it.
×
×
  • Create New...