Jump to content

mjr

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by mjr

  1. just of interest i want to watch it
  2. Понял о чем ты говоришь) Ну, короче, пусть ТС уже сам додумает скрипт
  3. аа, я думал там в процентах что-ли) ну тогда setElementHealth (v,2000) и getElementHealth (source) < 260
  4. kay, i got it. there is no possibility to do that) stuff with images is too mess and uneffective
  5. mjr

    Help

    yes, to save "licenceGot" state till the end of game session. On game guit it should be written in database. The algorithm is: 1) You press key to buy licence 2) If your cash is > cost of licence 3) Cash -= cost of licence 4) Write in playerData string 5) On quit checks the string in playerData, if true, write value in database
  6. Is there a way to put it in the game? [i know, MTA GUI is more comfortable, i'm just interested ]
  7. function carHealth() setTimer(function() for i, v in ipairs (getElementsByType("vehicle")) do setElementHealth (v,200) end, 1500,1) -- если ресурс основной, таблица с машинами некоторое время подгружается end addEventHandler ("onResourceStart",getResourceRootElement(getThisResource()),carHealth) function carSaver(source) if isPedInVehicle (getLocalPlayer()) then if getElementHealth (source) < 26 then setVehicleEngineState (source,false) setVehicleDamageProof (source,true) setVehicleFrozen (source,true) end end end addEventHandler("onVehicleDamage", getRootElement(),carSaver)
  8. Никогда таким не занимался, но можно предположить, что стрельба и прицеливание должны быть в цикле
  9. thx, Dwane. if tonumber(recipient) == getElementData (v,"id") works! final form: function privateMessage(source,commandName,recipient,...) local origin = { ... } local message = table.concat(origin, "") if tonumber(recipient) then for i, v in ipairs (getElementsByType("player")) do if tonumber(recipient) == getElementData(v,"id") then target = v break end end else target = (getPlayerByName (recipient)) end [...immaterial code...] target = nil end thanks to everybody for help!
  10. haha, same code, same result
  11. if tonumber(recipient) then for i, v in ipairs (getElementsByType("player")) do if recipient == getElementData(v,"id") then target = v break end end else target = (getPlayerByName (recipient)) end don't work too /pm 1 msg --player not found getElementData(source,"id") --1
  12. getPlayerByName - my function that is similar to standart getPlayerFromName, but in addition it converts any coloured name to normal form okay, my mistake, but it isn't what try to solve. variable "recipient" always is a "string" type. Even if i type number instead on nichname. type(recipient) == "string" triggers all the time. Statement don't want to progress.
  13. yeh yeh sorry :) i type very fast how it's possible to press "H" button when buttons with letters "W" and "A" are not even close to it? ps. "whant" was hilarious
  14. working on PM function now. problem is that 6th string of code isn't working. even when i write /pm 1 msg, "if" statement anyway goes to type(recipient) == "string" case. what's the problem? function privateMessage(source,commandName,recipient,...) local origin = { ... } local message = table.concat(origin, "") if type(recipient) == "string" then target = (getPlayerByName (recipient)) elseif type(recipient) == "number" then for i, v in ipairs (getElementsByType("players")) do if recipient == getElementData(v,"id") then target = v break end end end [...immaterial code...] end
  15. YEES! Kenix, you are my saviour i didn't thought of using for "aQuery[ 1 ]" in loop! ps. chatbox outputted "COUNT(*)" as index variable, that's what i wanted to know when i started this topic. Tnaks to everyone!
  16. read previous messages, Kenix used "table[1]['password']" syntax to get result from query, that's why 1 is outputted
  17. chatbox outputs "1"
  18. function bindCarFix() bindKey (source,"mouse2","down",fixCar,source) end addEventHandler ("onPlayerLogin",getRootElement(),bindCarFix)
  19. haha, not closed. i will be grateful to you if you tell me how exactly result writes in table? i have another query: local count = dbPoll(dbQuery(SQLconnect, "SELECT COUNT(*) FROM players"),-1) which returns amount of rows in mysql table. In previous query with your help i somehow figure out how to get returned variable, but here idk what to do. edit: for i, v in ipairs(count) do outputChatBox (tostring(v)) end outputs weird thing to the chatbox: what does it mean? one table in another table?
  20. omg, next time, put code in [lua] tag, this mess is hard to read. specify what exactly do you want
  21. setPlayerName (getRootElement, "Cheater")
  22. mjr

    runcode

    executed? what do you mean?
×
×
  • Create New...