Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. That format is in fact IPv4, afaik. And there is no MTA function to get the server's IP.
  2. A player does not lose health if he doesn't eat like in single player. You have to script it yourself.
  3. What do you mean running? Do you mean handled? If so, check this out: https://wiki.multitheftauto.com/wiki/GetEventHandlers But note that it's from version 1.4.
  4. JR10

    [HELP] Please

    What?? If you have a code post it along with the errors. Else, please try to explain better.
  5. Not sure I understand, are you asking if the admin panel can modify tables? That would be a no, it's not possible.
  6. JR10

    [PROBLEM]

    The condition is not correct. If the player's gang is SWAT, ban him from using the car, else, he's welcome. Should be this I think: vehicle = createVehicle ( 411, 1852, -1391, 13, 0, 0, 90 ) state = setVehicleDoorState ( vehicle, 1, 1 ) setVehicleDamageProof ( vehicle, true ) function lockPrivate( player, seat, jacked ) if ( getElementData ( player, "gang" ) == "SWAT" ) then outputChatBox ( "Welcome!", player, 0, 255, 0, false ) else cancelEvent ( ) outputChatBox ( "This car is Locked For SWAT!", player, 0, 245, 82, false ) end end addEventHandler ( "onVehicleStartEnter", vehicle, lockPrivate )
  7. JR10

    HELP!

    This event will be triggered when the player dies, so get his skin and then set a timer to spawn him again with the skin. addEventHandler('onPlayerWasted', root, function() local skin = getElementModel(source) --Now spawn the player using the skin variable with a setTimer end)
  8. A quick look on the community and you will find most of what you need. The best scoreboard is the default one that comes with MTA. There are a lot of speedometers on the community, just search for speedo and you will find some. Here's one: https://community.multitheftauto.com/index.php?p= ... ils&id=559
  9. thePlayer is not defined in the command handler function.
  10. That function will set the total ammo he has, so you can set his ammo to 250.
  11. I don't understand, try to explain your problem better. Any errors?
  12. Also, I just noticed you have 4 arguments in setAccountData but it only accepts 3.
  13. JR10

    GUI

    You're welcome.
  14. In a command handler function, the second argument is the command. Try this: function seta( thePlayer, cmd, arg1 ) theAccount = getPlayerAccount ( thePlayer ) if not isGuestAccount ( theAccount ) then local theData = getAccountData(theAccount, "Test.criminalsJailed") if(theData == true) then local setData = setAccountData(theAccount, "Test.criminalsJailed", amountJailed, arg1 ) outputChatBox("Testsset") elseif (theData == false) then outputChatBox("Failed to set your arrests number") end end end addCommandHandler ( "setar", seta )
  15. JR10

    Help needed

    Because in your triggerClientEvent, you forgot to supply the baseElement argument. Try this: addEventHandler("onPlayerLogin",root, function() local account = getPlayerAccount( source ) local win = tonumber(getAccountData(account, "Wins")) local dead = tonumber(getAccountData(account, "Deaths")) triggerClientEvent(source,"myEvent",root,win,dead) end )
  16. If the image is correct and while the chatbox is visible nothing was output, then it might be because of the username and password being blank. The function dxLibEditGetText might be the problem. Try to check and debug if it returns correct values.
  17. JR10

    [Solved] Uhm Hi

    Not exactly, this way it will always return the first item which is the 'Please choose your language..'. You need it to change when the combobox is changed. You can use the onClientGUIComboBoxAccepted: addEventHandler('onClientGUIComboBoxAccepted', LanguageWindow, function(combo) local item = guiComboBoxGetSelected (combo) if (item == 0) then return end local text = tostring (guiComboBoxGetItemText(combo, item)) unbindKey('l', 'down', 'chatbox') bindKey('l', 'down', 'chatbox', 'language', text) end)
  18. What he was asking about was the download progress bar that appears when you're downloading server files, he wanted to know how to do it.
  19. in the removeBody function, source is the localPlayer, first argument is the ped. You're trying to get the element data 'parent' of the ped, while what you need is to get the 'parent' from the collision. Try this: if itemName == "hide" then local col = getElementData(getLocalPlayer(), "currentCol") local gearName = "Hide Body" triggerServerEvent("removeBody", getLocalPlayer(), col, getElementData(col, "parent")) disableMenu() return end function removeBody(col, ped) setPedAnimation(source, "BOMBER", "BOM_Plant", nil, false, false, nil, false) --not sure whether u mean to set the animation of the ped or the localPlayer destroyElement(col) destroyElement(ped) end addEvent("removeBody", true) addEventHandler("removeBody", getRootElement(), removeBody)
  20. JR10

    GUI

    It doesn't matter, just use whatever is easier for you to deal with.
  21. That's not what he wants...
  22. You don't need anything for that. It's hard-coded into MTA. You just need to add the files that should be downloaded in the meta.xml, and when the player joins your server they will download it and then the client-side scripts will be started for them.
  23. 'money' at line 18 is nil, either it's a string which tonumber returned nil or it's nil before tonumber. Check where money is sent and confirm that it's correct.
  24. Use tonumber to turn v.id to a number. function make_db () executeSQLQuery ("CREATE TABLE IF NOT EXISTS dealercars (id NUMERIC, owner TEXT, model NUMERIC, name TEXT, health NUMBERIC, paintjob NUMERIC, color NUMERIC, upgrades NUMERIC)") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), make_db) local dealerMarker1 = createMarker(2131.75, -1148.138671875, 23.406946182251, "cylinder", 2, 0, 255, 0, 255) createBlipAttachedTo(dealerMarker1, 55, 2, 0, 0, 0, 0, 0, 300) function open_dealer_server (hitElement) if source == dealerMarker1 then triggerClientEvent(hitElement, "open_dealer_wdw", root) triggerClientEvent(hitElement, "list_dealer_cars", root) end end addEventHandler("onMarkerHit", getRootElement(), open_dealer_server) function buy_car_from_dealer (owner,model,name,money) if getPlayerMoney(owner) >= tonumber(money) then local ID = executeSQLQuery("SELECT * FROM dealercars") for i,v in ipairs(ID) do carid = tonumber(v.id)+1 end local account = getAccountName(getPlayerAccount(owner)) local modela = getVehicleModelFromName(model) local carbought = executeSQLQuery("INSERT INTO dealercars(id,owner,model,name,health,paintjob,color,upgrades) VALUES(?,?,?,?,?,?,?,?)", carid, tostring(account), tonumber(modela), tostring(model), 1000, 0, 0, 0) takePlayerMoney(owner, money) setElementData(owner, "gotCar", "no") outputChatBox("Congratulations you've bought a "..model.." for "..money, owner, 0, 255, 0) else outputChatBox("You don't have enough money", owner, 255, 0, 0) end end addEvent("buy_dealer_car", true) addEventHandler("buy_dealer_car", getRootElement(), buy_car_from_dealer) ---------------------------------------------- --------------- Spawner Panel ---------------- ---------------------------------------------- function keybindpla () for i,v in ipairs(getElementsByType("player")) do bindKey(v, "f2", "down", open_spawner_pla) setElementData(v, "gotCar", "no") end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), keybindpla) addEventHandler("onPlayerLogin", getRootElement(), keybindpla) function open_spawner_pla (source) triggerClientEvent(source, "open_spawner_wdw", root) end function list_owned_cars_server (player) local playerAcc = getAccountName(getPlayerAccount(player)) local carlmao = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", playerAcc) for i,k in ipairs(carlmao) do triggerClientEvent(player, "list_owned_cars", root, k.name, k.health) end end addEvent("list_owned_cars_S", true) addEventHandler("list_owned_cars_S", getRootElement(), list_owned_cars_server) function spawn_car_pleaseD (ownerName,carName) if getElementData(ownerName, "gotCar") == "no" then local gayowner = getAccountName(getPlayerAccount(ownerName)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(ownerName) OwnerVehicle = createVehicle(carModel, x, y, z) setTimer(warpPedIntoVehicle, 50, 1, ownerName, OwnerVehicle) setElementData(OwnerVehicle, "owner", tostring(gayowner)) setElementData(ownerName, "gotCar", "yes") local carlma = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", gayowner) else outputChatBox("You don't own a car", ownerName, 255, 0, 0) end end addEvent("spawn_dealer_car", true) addEventHandler("spawn_dealer_car", getRootElement(), spawn_car_pleaseD) function destroy_car_pleaseD (ownerName) pedCar = getPedOccupiedVehicle(ownerName) gayownerAcc = getAccountName(getPlayerAccount(ownerName)) if isPedInVehicle(ownerName) == true then if getElementData(ownerName, "gotCar") == "yes" and getElementData(pedCar, "owner") == gayownerAcc then CurrentCar = getPedOccupiedVehicle(ownerName) destroyElement(CurrentCar) setElementData(ownerName, "gotCar", "no") else outputChatBox("You can't park a car you don't own", ownerName, 255, 0, 0) end else outputChatBox("You aren't in a vehicle", ownerName, 255, 0, 0) end end addEvent("destroy_dealer_car", true) addEventHandler("destroy_dealer_car", getRootElement(), destroy_car_pleaseD)
×
×
  • Create New...