Jump to content

Hoffmann

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by Hoffmann

  1. Hello, community! Can you help me? What is the best method to send RGB/HEX colors in function? function meChat(thePlayer, cmd, ...) ProxDetector(30, thePlayer, ..., color1, color2, color3, color4, color5) end addCommandHandler("do", meChat) function ProxDetector(radius, thePlayer, ..., color1) local text = table.concat({...}," ") local oldposx, oldposy, oldposz = getElementPosition(thePlayer) for k, v in pairs(getElementsByType("player")) do local posx, posy, posz = getElementPosition(v) if getElementDimension(v) == getElementDimension(thePlayer) then local getRadius = getDistanceBetweenPoints3D(oldposx, oldposy, oldposz, posx, posy, posz) if (getRadius < radius / 16) then outputChatBox(getPlayerName(thePlayer).." "..text, v, color1, false) elseif (getRadius < radius / 8) then outputChatBox(getPlayerName(thePlayer).." "..text, v, color2, false) elseif(getRadius < radius / 4) then outputChatBox(getPlayerName(thePlayer).." "..text, v, color3, false) elseif(getRadius < radius / 2) then outputChatBox(getPlayerName(thePlayer).." "..text, v, color4, false) elseif(getRadius < radius) then outputChatBox(getPlayerName(thePlayer).." "..text, v, color5, false) end end end return true end I tried something like COLOR_PURPLE = 0xC2A2DAAA and then convert in to RGB in outputchatBox function but it says that ")" expected near "," in function string.
  2. Hoffmann

    Need help :(

    Nobody will make it for free. This forum is for helping newbies. Try to make it yourself and we will help you, fix your mistakes and etc.
  3. Похоже, что интересный сервер с реально гоночной атмосферой. Будет время - загляну.
  4. Hoffmann

    Mute

    setTimer(setPlayerMuted, minutes*60000, 1, target, false) setPlayerMuted has only two arguments. Look https://wiki.multitheftauto.com/wiki/SetPlayerMuted So you have to make unmute with timer yourself.
  5. Didn't see. He gets team element from name. Sry.
  6. function open() playerTeam = getPlayerTeam ( hitElement ) Clann = getTeamFromName ("BOPE") if (playerTeam) == Clann then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) Here you compare team element "playerTeam" with string "Clann". Try this: function open() playerTeam = getPlayerTeam ( source ) playerTeamName = getTeamName(playerTeam) Clann = getTeamFromName ("BOPE") if (playerTeamName == Clann) then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open )
  7. Don't use leaked and opensource gamemodes. Sometimes they're hard coded or vice versa so you will never learn scripting editing them. Secondly, those gamemodes have unhandy structure(as for me) so I prefer to stage scripts like modules and take something from them.
  8. Element data is deleted when player quit.
  9. Use GeoIP tools: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3685 But you need to edit this resource because function to get city works only for Russia. Good luck!
  10. Hoffmann

    help

    What's keyRot?
  11. Use getElementData and setElementData or export tables.
  12. If you want to make such thing on client side use tables and export them among the scripts because it's very useful and safely to use them if you don't need to synchronize this data with all scripts. usermoney = {} -- Create empty table to insert data Setting data for player example(an element is used as table's index in MTA): usermoney[player] = 500 -- Set player's money to 500
  13. function format(n) local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right end Example of using: outputChatBox("You have: $"..format(getPlayerMoney(player)), player) Also see http://lua-users.org/wiki/FormattingNumbers Good luck with numbers!
  14. As I said, see how this function works https://wiki.multitheftauto.com/wiki/OutputChatBox
  15. function siema(playerSource) outputChatBox(getPlayerName(playerSource)..":Siema!", playerSource) end addCommandHandler("s", siema) Try to understand what have changed. Firstly, if you want to show this message to playerSource use it as second argument(see https://wiki.multitheftauto.com/wiki/OutputChatBox). Secondly, you should put your command in "" as it is a string. As for third, you don't need to write function, just enter a name. Good luck!
×
×
  • Create New...