Jump to content

HassoN

Members
  • Posts

    636
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by HassoN

  1. HassoN

    gridlist

    Yes, but remove line 5. guiGridListAddRow(gridSms,name)
  2. local vehDB = dbConnect("sqlite", "vehicle.db") dbExec(vehDB, "CREATE TABLE IF NOT EXISTS vehicle_base (pAcc TEXT, vehicleID TEXT, vehicleName TEXT, vehiclePrice TEXT, vehicleStatus TEXT, vehicleHP TEXT)") function dateGetV() local accName = getAccountName(getPlayerAccount(source)) local qh = dbQuery(vehDB, "SELECT * FROM vehicle_base WHERE vehicleID=? AND pAcc=?", "520", accName) local result = dbPoll(qh, -1) if result then for _, row in ipairs(result) do outputDebugString(row["vehicleHP"]) end end end addEvent("dategetV", true) addEventHandler("dategetV", root, dateGetV) I'd do like this.
  3. Your code seems fine to me. Try to install DB browser to check if all the values really exist in your database.
  4. At line 5, use tostring(520) instead of 520.
  5. That's exactly what your code does. So what's your issue? Nothing prints out even if the value exists in the database?
  6. HassoN

    gridlist

    -- client side triggerServerEvent("sendText", resourceRoot, text) -- text represents the text string you want to show in everyone's GUI. -- server side local savedText = {} function savedText(text) table.insert(savedText, text) triggerClientEvent(root, "showText", root, savedText) end addEvent("sendText", true) addEventHandler("sendText", root, sendText) -- client side again function showText(myTable) for i, v in ipairs(myTable) do -- whatever you want, but for example: guiGridListAddRow(gridlist, v) end end addEvent("showText", true) addEventHandler("showText", root, showText) I have used a table so you can call it whenever you want to show the text even if the player reconnects. But if you don't care about if the text gets lost if the player reconnects then ignore the usage of tables.
  7. HassoN

    gridlist

    You send the text to server side, store it in a table, then whenever someone opens the panel, you trigger to server side to get the text from that table.
  8. @djharbi2 What do you mean by the matching value? Explain your issue better so we can assist you.
  9. You're welcome! I'd like to recommend you to use: triggerServerEvent("repotvet", resourceRoot, idrep) Instead of passing your 'localPlayer' as a parameter. and then on your server side use client instead of source.
  10. Your idrep variable is a string value and you are comparing it to a number. Use: if tonumber(id) == tonumber(idrep) then
  11. The trigger was at its right place.
  12. HassoN

    ¿Shop?

    addEventHandler "onClientMarkerHit" -- when a player hits a marker guiSetVisible -- shows the panel showCursor -- shows the cursor
  13. I have just tried the code. It is working fine.
  14. You can't...? -- client function PedLoad(ped) ped = createPed ( 36, 1623.5, 576.70001220703, 1.7999999523163 ) setElementFrozen( ped, true ) addEventHandler("onClientPedDamage", ped, cancelEvent) end addEventHandler("onClientResourceStart", resourceRoot, PedLoad) -- Marker coords -- X: 1623.5999755859 Y: 577.59997558594 Z: 0.79999995231628 marker = createMarker (1623.5999755859, 577.59997558594, 0.79999995231628, "cylinder", 1.2, 255, 0, 0, 140 ) function markerHit(plr) if (plr ~= localPlayer) then return false end guiSetVisible(GUIEditor.window[1], true) showCursor(true) end addEventHandler( "onClientMarkerHit", marker, markerHit) GUIEditor = { button = {}, window = {}, edit = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(448, 230, 504, 330, "Fisherman", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.85) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(7, 33, 222, 38, " Fisherman: Hello! Get some fish food!", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(10, 83, 105, 33, " x10 Food = 300$", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.button[1] = guiCreateButton(22, 133, 122, 80, " BUY FOODS(10)", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(283, 79, 192, 55, "Do you have enough fishes to sell?\n Let me have!", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(293, 33, 68, 20, " Fisherman:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[4], "default-bold-small") GUIEditor.button[2] = guiCreateButton(278, 134, 192, 73, " SELL FISHES", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(113, 266, 283, 18, " Note! You can buy maximum 20 foods for per deal", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[5], "default-bold-small") GUIEditor.button[4] = guiCreateButton(443, 27, 51, 26, "X", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[4], "default-bold-small") end ) addEventHandler("onClientGUIClick", resourceRoot, function() if (source == GUIEditor.button[4]) then -- replace closeButton with your button name. guiSetVisible(GUIEditor.window[1], false) -- replace window with your window name. showCursor(false) end end) addEventHandler( "onClientGUIClick", resourceRoot, function() if (source == GUIEditor.button[1]) then -- The button to buy guiSetVisible(GUIEditor.window[1], false) -- The window to buy showCursor(false) buyFish() end end) function buyFish() local money = getPlayerMoney(localPlayer) triggerServerEvent("buyFish", resourceRoot) if (money >= 300) then outputChatBox("You have bought a fish food.") else outputChatBox("You don't have enough money.") end end -- server side function buyFish() takePlayerMoney(client, 300) end addEvent("buyFish", true) addEventHandler("buyFish", root, buyFish)
  15. line 58 and 61, why they are the same button name? In that case, the panel will just close without doing the function... Either you put them all together or change the button name that closes the panel.
  16. What does your script say? /debugscript 3 or any message by the outputChatBox function? Try to locate the problem.
  17. Ah, so you want to compare the entered password, username with your SQL value? Then: for _, row in ipairs ( result_password ) do if row["password"] == password then -- row["password"] depends on the name of the column in your database. outputChatBox("Correct password.") end end
  18. You basically just use: logIn with the entered information, and if the function returns false, then either the password or the username is wrong, and if it returns true then everything is fine. Example: check = logIn(source, username, password) if (check) then outputChatBox("Welcome", source) else outputChatBox("Either your password or username is wrong", source) end
  19. local mrk = createMarker(-2518.617, -613.057, 131.700, "cylinder", 2, 255, 0, 0, 255) local vehicles = {} function dararma ( thePlayer ) giveWeapon (thePlayer, 31, 400) giveWeapon (thePlayer, 23, 400) giveWeapon (thePlayer, 29, 400) giveWeapon (thePlayer, 3, 400) setPedSkin (thePlayer, 284) vehicles[thePlayer] = createVehicle(523, -2510.977, -609.219, 132.563) warpPedIntoVehicle(thePlayer, vehicles[thePlayer]) end addEventHandler ("onMarkerHit",mrk, dararma)
  20. This section is for scripting, if you have a problem doing your script, we help you. Otherwise, you can't ask us to do a full script for you.
  21. طبعاً بيجي خطاء لان الكود اساساً خطاء ، الطريقة الي عطيتها لك والي انت مستعملها صح ، صراحة ما ادري ايش الي مسبب لك المشكلة لكن اقدر اكد لك ان الطريقة تمام
  22. HassoN

    Mysql

    Because your 'id' variable is not defined.
  23. Setting the 2nd argument of setVehiclePlateText to " " would just hide the text. Try this: for _, veh in ipairs(getElementsByType("vehicle")) do setVehiclePlateText(veh, " ") end For all current vehicles, and for newly created ones you have to manually set the vehicle's plate to " ".
  24. isChatBoxInputActive dxDrawTextOnElement -- (https://wiki.multitheftauto.com/wiki/DxDrawTextOnElement)
  25. Because your API that gets player's country is not working... Use the method that is being used in the default admin panel. And if you still use the default admin panel you could just use an export to get player's country.
×
×
  • Create New...