Jump to content

MajdMTA

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by MajdMTA

  1. local carCost = guiGridListGetItemText (carGrid, guiGridListGetSelectedItem(carGrid), 2) local convertedMoney = convertNumber(carCost) local carprice = guiGridListGetItemText(carGrid, guiGridListGetSelectedItem(carGrid), 2) local convertedMoney = convertNumber(carprice) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end So tell me where's the bug?
  2. "Try" words didn't work with me.
  3. Yes.. but i tried.. didn't work
  4. In my vehicle script grid list the price for Faggio-car is 5000 I wanna it 5,000
  5. Hello.. Some for this stupid thing, I tried to convert gridList number, Example my one is 5000 I wanna it 5,000, can someone gimme a function? and I'll put it.
  6. Omg i gave you wrong one, srry addEvent("DestroyMyVehicle", true) addEventHandler("DestroyMyVehicle", root, function (id) local vehicle = getVehicleByID(id) if isElement(vehicle) then local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then local aman = getVehicleOccupant(vehicle) destroyVehicle(vehicle) if isElement(source) and playerVehicles[source] then for i=1,#playerVehicles[source] do if playerVehicles[source][i] == vehicle then table.remove(playerVehicles[source],i) break end end else playerVehicles[source] = nil end exports.CSFtexts:output ("Your Vehicle "..getVehicleNameFromModel(data[1]["Model"]).." has been destroyed.", source, 255, 85, 0, true) cur = getElementData(source,"spawnedcars") or {} for ind,veh in ipairs(cur) do if veh == getVehicleNameFromModel(data[1]["Model"]) then table.remove(cur,ind) end end setElementData(source,"spawnedcars",cur) else exports.CSFtexts:output("Select the Vehicle that you want to destroy.", source, 255, 85, 0, true) end else exports.CSFtexts:output("Your Vehicle is not spawned.", source, 255, 85, 0, true) end end)
  7. Hello.. there's a small problem in addCommandHandler, because there's not function name. Check this addEvent("SpawnMyVehicle", true) addEventHandler("SpawnMyVehicle", root, function(id) if not playerVehicles[source] then playerVehicles[source] = {} end if #playerVehicles[source] >= 1 then for ind,car in ipairs(playerVehicles[source]) do if not isElement(car) then playerVehicles[source][ind] = nil end end end if #playerVehicles[source] >= 1 then exports.CSFtexts:output("You can only spawn 1 vehicle Destroy the Current vehicle first.", source, 255, 85, 0, true) return end local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then if getVehicleByID(id) then exports.CSFtexts:output("Your Vehicle "..getVehicleNameFromModel(data[1]["Model"]).." is already spawned.", source, 255, 85, 0, true) else local color = split(data[1]["Colors"], ',') r1 = color[1] or 255 g1 = color[2] or 255 b1 = color[3] or 255 r2 = color[4] or 255 g2 = color[5] or 255 b2 = color[6] or 255 vehicle = createVehicle(data[1]["Model"], data[1]["X"], data[1]["Y"], data[1]["Z"], 0, 0, data[1]["RotZ"]) setElementData(vehicle, "ID", id) table.insert(playerVehicles[source],vehicle) local fuelnu = data[1]["fuel"] or 100 local tune = fromJSON(data[1]["handling"]) -- outputChatBox(data[1]["handling"],source,255,0,0) --outputChatBox(tostring(tune),source,255,0,255) exports.CSFcarTune:setCarData(vehicle,tune,true) setElementData(vehicle, "vehicleFuel", fuelnu) local upd = split(tostring(data[1]["Upgrades"]), ',') for i, upgrade in ipairs(upd) do addVehicleUpgrade(vehicle, upgrade) end local Paintjob = data[1]["Paintjob"] or 3 setVehiclePaintjob(vehicle, Paintjob) setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) if data[1]["HP"] <= 255.5 then data[1]["HP"] = 255 end setElementHealth(vehicle, data[1]["HP"]) setElementData(vehicle, "Owner", source) vv[vehicle] = setTimer(function(source) -- if not isElement(source) and isTimer(vv[vehicle]) then killTimer(vv[source]) vv[source] = nil end -- if isElement(source) and getElementHealth(source) <= 255 then -- setElementHealth(source, 255.5) -- setVehicleDamageProof(source, true) -- setVehicleEngineState(source, false) -- end end, 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) exports.CSFtexts:output("Your Vehicle "..getVehicleNameFromModel(data[1]["Model"]).." has been spawned.", source, 255, 85, 0, true) cur = getElementData(source,"spawnedcars") or {} table.insert(cur,getVehicleNameFromModel(data[1]["Model"])) setElementData(source,"spawnedcars",cur) end else exports.CSFtexts:output("There might be problem with this vehicle, please call an admin.", source, 255, 85, 0, true) end end) Can't you add addCommandHandler for this function?
  8. There's setVehiclePosition Function?
  9. Nah, I'm not hiding a thing.. lemme share the pictures here. http://imgur.com/a/a75Af
  10. Hello there i tried to make instead of clicking "Login" pressing enter it will be logged automatic. function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(loginEdit["Username"]) local password = guiGetText(loginEdit["Password"]) if username and password then triggerServerEvent("submitLogin",localPlayer, username, password) end end end addEventHandler("onClientGUIClick", loginButton["Main"], clientSubmitLogin, false) bindKey ( player, "enter", "down", clientSubmitLogin )
  11. MajdMTA

    Solved.

    Thanks for you'r hard work! worked.
  12. MajdMTA

    Solved.

    It's worked........... but i need it if he fill the edit not if he click on "register button" ...
  13. MajdMTA

    Solved.

    yes, registerBut = guiCreateButton( 298, 570, 127, 42, "Create my account", false, regWnd)
  14. MajdMTA

    Solved.

    username = guiCreateEdit(13, 316, 223, 33, "", false, regWindow) nameLabel = guiCreateLabel(292, 42, 115, 25, "Enter a name", false, regWindow) guiSetFont(nameLabel, "clear-normal") guiLabelSetColor(nameLabel, 247, 0, 0) function nameLabel() local text = guiGetText(username) if (text ~= "") then guiSetText(nameLabel, "Available name!") end end
  15. MajdMTA

    Solved.

    It's didn't work, I tried debugscript, No errors.
  16. MajdMTA

    Solved.

    Did you correct it @KariiiM ? sorry for double post.
  17. MajdMTA

    Solved.

    Already.. it's bugged. Can you do it.. all? man.. you didn't understand me
  18. MajdMTA

    Solved.

    Solved, thanks @kariiim
  19. If you wan't to see the pictures.. contact me in facebook.
  20. Hello! I'll sell my resources! they're awesome. and none have them, I'll show you the pictures tonight, Because I'm not at home.. for FB add me: https://www.facebook.com/Ebaheem.sh thanks.
  21. As @Olle Risk said.. We don't give support for someone called 'Ajax' cause you, was attacking my server by using DDoS, cause you'r thinking that I advert in you'r sv to my sv, go check my logs before attacking my sv, and banning me in your server..
×
×
  • Create New...