Jump to content

PauloCascus

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by PauloCascus

  1. Кажется видел, что у вас проблема с тем, что кто то может узнать команду и использовать ее

    Если ГМ нужен только для админов или випов

    То вам нужно производить запуск функции через тригер с серверной стороны

    Серверная сторона

      
    function adminGMon() 
      local accName = getAccountName( getPlayerAccount(source)) 
      if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent( source, "onClientGMStart", getRootElement()) 
      else 
        outputChatBox("У вас нет прав на использование этой команды", source, 200, 0, 0 ) 
      end  
    end  
    addCommandHandler("ongodmode", adminGMon) 
      
    function adminGMoff() 
      local accName = getAccountName( getPlayerAccount(source)) 
      if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent( source, "onClientGMStop", getRootElement()) 
      else 
        outputChatBox("У вас нет прав на использование этой команды", source, 200, 0, 0 ) 
      end  
    end  
    addCommandHandler("offgodmode", adminGMoff) 
      
      
    

    Клиентская сторона

      
      
    function startgm() 
        gmtimer = setTimer(gmforad, 2000, 0) 
        outputChatBox ("GodMode режим был включен!",255, 0, 0,true) 
    end 
    addEvent("onClientGMStart", true) 
    addEventHandler("onClientGMStart", getRootElement(), startgm) 
      
    function offgm() 
        killTimer (gmtimer) 
        setElementData(getLocalPlayer(),"blood", 12000) 
        outputChatBox ("GodMode режим был выключен!",255, 0, 0,true) 
    end 
    addEvent("onClientGMStop", true) 
    addEventHandler("onClientGMStop", getRootElement(), offgm) 
      
    function gmforad() 
        if getElementData(getLocalPlayer(),"logedin") then 
            setElementData(getLocalPlayer(),"blood", 500000) 
            setElementData(getLocalPlayer(),"bleeding", 0) 
            setElementData(getLocalPlayer(),"cold", false) 
            setElementData(getLocalPlayer(),"temperature", 37) 
            setElementData(getLocalPlayer(),"pain", false) 
            setElementData(getLocalPlayer(),"brokenbone", false) 
            setElementData(getLocalPlayer(),"thirst", 100) 
            setElementData(getLocalPlayer(),"food", 100) 
            end 
    end 
    

  2. If I recall correctly there's a resource that helps you make smooth camera transitions, if you search I'm sure you'll find it.

    MTA uses HLSL Shaders, so if you google you'll find plenty of good tutorials and advices. Alternatively there's a few people on these forums which are pretty darn good with shaders. However, I usually do not mention names as I don't want them to be spammed with PMs :lol:

    ... i was looking for HLSL, but there are so many other formats not the same like fx

    and so many editors but a little count of tutorials...

    So shity mess...

  3. Серверная сторона предназначена для функций которые выполняет сервер, клиентская сторона для функций которые выполняет ваша MTA.

    https://wiki.multitheftauto.com/

    Посмотри там,

    Функции бывают клиентские, серверные и те которые можно использовать на обеих сторонах в зависимости от цели.

    Добавь меня в скайпе проведу тебе быстрый семинар по скриптингу МТА

    PauloManwen

  4. попробуй сделать на клиентской стороне

    скорее всего у тебя игрок не определяется как thePlayer

    что написано в debugscript ?

      
    addEventHandler("onClientResourceStart", getRootElement(), 
    function() 
    setDevelopmentMode(true) 
    end) 
      
    local gate = createObject(10841, 2595.5, -2140.3000488281,6.9000000953674 ) 
    local colshape = createColCircle ( 2595.5, -2140.3000488281, 25 ) 
      
    function moveUp() 
      if ( getElementModel(localPlayer) == 217 ) then  
        moveObject( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674, 0, 0, 0 )  
      else 
      return false 
      end  
    end  
    addEventHandler("onClientColshapeHit", colshape, moveUp) 
      
    function moveBack() 
      if ( getElementModel( localPlayer ) == 217 ) then  
        moveObject(  moveObject (gate, 6000, 2595.5, -2140.3000488281,6.9000000953674) 
      else 
      return false 
      end  
    end  
    addEventHandler("onClientColShapeLeave", colshape, moveBack) 
      
    

  5. dx Authotization System

    Information about script:

    • dxEditboxes

    • dxButtons

    • dxError Label

    • dxError Highlight line

    • hmm.. Copyrights or advertising on the element which move

    Updates:

    [28.01.2015] Open-Source: https://community.multitheftauto.com/index.php?p= ... s&id=10860

    Goals:

    • Want to add shader effects to the script instead the easing

    • To make it in oop ( need for the shaders )

    Second version

    First version

    viewtopic.php?f=108&t=81918

  6. Hi,

    The problem is that dxDrawText is not waiting for a size at the 4th and 5th argument, but its expecting for the absolute coordinate of the bottom right corner of the box in which it will write the text.

    * right: the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.

    * bottom: the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.

    So here is what you should write instead:

    dxDrawText( mbut.text, mbut.x, mbut.y, mbut.x + mbut.w, mbut.y + mbut.h, tocolor(0, 0, 0), sw/1600, "bankgothic", "center", "center") 
    

    It should work as expected.

    Regards,

    Citizen

    yeah, it's working. Thanks

  7. Hello, i think this is stupid situation but what i'm doing wrong...

    Position of the rectangle and text is the same.. but the text has moved in other on the test. It's not once happend, every time when i've started to write my code, i had this result...

    local sw, sh = guiGetScreenSize() 
      
      
    function renderMain() 
      addEventHandler("onClientRender", getRootElement(), renderMainButtons) 
      
      
    end  
    addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), renderMain)   
      
    mainbuttons = { 
    { x = sw * 0.5, y = sh * 0.5, w = sw * 0.2, h = sh * 0.2, text = "Login" } 
    } 
      
      
    function renderMainButtons() 
      for i, mbut in ipairs ( mainbuttons ) do  
        dxDrawRectangle( mbut.x, mbut.y, mbut.w, mbut.h ) 
        if mbut.text then  
          dxDrawText( mbut.text, mbut.x, mbut.y, mbut.w, mbut.h, tocolor(0, 0, 0), sw/1600, "bankgothic", "center", "center") 
        end 
      end 
    end 
    

    e10df4afcdcb3f150159da57c32074aa.png

  8. The javascript files are used for a web scoreboard, as far as I know, I'm not sure if that part is finished.

    As for the shader file, it's being used for the drawing part, not quite sure why though.

    To make your own scroll system, you can use render targets:

    dxCreateRenderTarget 
    dxSetRenderTarget 
    

    thank you for fast answer

    i will try to make it )

  9. Hi guys, i have some not ordinary question: how i can to hide a part of dx element on the screen? hmm stupid question...

    Okay.. Everybody saw default mta scoreboard, it's using dx functions, but when the player scrolled up or down the list of the players hidding. Okay we can open the package with this scoreboard script inside the resource folder and what we looking ? js file ( Javascript ) and FX file ( idk what is it, couze i'm begginer in the programming )

    So question is simple: i need to use Javascript to make dx scrolling grid list ? Or i can to use any vectors ?

    I think anyone who met dx in the Mta like it more then gui, but it's harder...

    So anyway i told not only about grid lists, but about dx functions in general :) I hope, u understand me

    It's not my native lang

    Thank you ))

  10. Hello, dudes, Minase Studio RP find people to start the working for Role Play gamemode

    If you want to join us, send the application to the [email protected] :

    We need:

    • UI Designer - the man should to have good skill into the Photoshop, GIMP, Corel Draw and etc

    • UI Developer - this man will work with UI Designer to develop any UI elements

    • GS Developer - the man should to have good skill into the MTA Lua scripting

    First name:

    Last name:

    Gender:

    Age:

    Country:

    City:

    Vacancy:

    Ability into this vacancy ( on a scale from 1 to 10 )

    Ur payment information ( PayPal, Webmoney, QIWI or plastic card ) to get payday

    Best wishes,

    Paulo Minase and HQ Staff of Minase Studio Inc

  11. Hello guys,

    I have a problem. When I create a house, it is entered into the database is not correct, the icon appears with a standard information that I entered when creating, I can open different windows, but when I restart the script, the house is lost, just when I try to buy it, debugstring: attempt to concatenate local 'value' (a nil value)

    local 'value' is the same like house ID

    then when i've closed house window and opened it again debugstring: attempt to concatenate local 'owner' ( a nil value )

    local owner in the client side, it's field with owner's name into the house window...

    Function with local 'value'

    function setHouseData(ID, typ, value) 
        -- Security array --  
        houseData[ID][typ] = value 
        setElementData(house[ID], typ, value) 
        if(saveableValues[typ]) then 
            local query = dbQuery(housingdab, "UPDATE houses SET "..saveableValues[typ].." = '"..value.."' WHERE ID = '"..ID.."';" ) 
            local result = dbPoll(query, -1) 
            if(result) then 
                dbFree(query) 
            else 
                error("Невозможно сохранить информацию "..typ.." со значением: "..value.." для дома с номером: "..ID..": Ошибка HD00") 
            end 
        end 
    end 
    

    Database:

    local housingdab = dbConnect("sqlite","housing.db") 
      
    function housingdb() 
    if (housingdab) then  
    dbExec(housingdab,"CREATE TABLE IF NOT EXISTS 'houses' ('ID' INT, 'X' FLOAT, 'Y' FLOAT, 'Z' FLOAT, 'INTERIOR' INT, 'INTX' FLOAT, 'INTY' FLOAT, 'INTZ' FLOAT, 'MONEY' INT, 'WEAP1' TEXT, 'WEAP2' TEXT, 'WEAP3' TEXT, 'LOCKED' INT, 'PRICE' INT, 'OWNER' TEXT, 'RENTABLE' INT, 'RENTALPRICE' INT, 'RENT1' INT, 'RENT2' INT, 'RENT3' INT, 'RENT4' INT, 'RENT5' INT)") 
    outputDebugString("Вы успешно подключились к базе данных SQLite", thePlayer, 0, 200, 0 ) 
    housesys_startup() 
    else 
    outputDebugString("Подключение сорвалось, пожалуйста проверьте базу данных", thePlayer, 200,0,0) 
    end  
    end 
    addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), housingdb) 
    

    CreateHouse function:

      
    addEventHandler("onHouseSystemHouseCreate", getRootElement(), function( x, y, z, int, intx, inty, intz, price) 
        local query = dbQuery(housingdab, "SELECT * FROM 'houses'") 
        local result, numrows = dbPoll(query, -1) 
        if(result) then 
            local newid = houseid+1 
            outputChatBox("Дом под номером: "..newid.." успешно создан", source, 0, 255, 0) 
            local weapontable = {} 
            weapontable[1] = 0 
            weapontable[2] = 0 
            weapontable[3] = 0 
            dbExec(housingdab, "INSERT INTO 'houses' ( ID, X, Y, Z, INTERIOR, INTX, INTY, INTZ, PRICE) VALUES ('"..newid.."','"..x.."', '"..y.."', '"..z.."', '"..int.."', '"..intx.."', '"..inty.."', '"..intz.."', '"..price.."');") 
            buildHouse(newid, x, y, z, int, intx, inty, intz, 0, weapontable, 0, price, "Недвижимость Штата", 0, 0, "Не арендовано", "Не арендовано", "Не арендовано", "Не арендовано", "Не арендовано") 
        else 
            outputChatBox("Сбой при создании дома: Ошибка #CH00", source, 255, 0, 0) 
            error("Дом номер: "..(houseid+1).." не может быть создан: Ошибка #CH01") 
        end 
    end) 
    

    Buy function:

    addCommandHandler("buyhouse", function(thePlayer) 
        if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false)  then 
            local house = getElementData(thePlayer, "house:lastvisit") 
            if(house) then 
                local id = house 
                local owner = houseData[id]["OWNER"] 
                if(owner ~= "Недвижимость Штата") then 
                    outputChatBox("Вы не можете купить этот дом", thePlayer, 255, 0, 0) 
                else 
                    local houses = 0 
                    for index, col in pairs(getElementsByType("colshape")) do 
                        local baga = getPlayerAccount(thePlayer) 
                        local bagas = getAccountName(baga) 
                        if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == bagas) then 
                            houses = houses+1 
                            if(houses == max_player_houses) then 
                                outputChatBox("У вас уже "..max_player_houses.." дома! Продайте один из них, чтобы приобрести новый", thePlayer, 255, 0, 0) 
                                return 
                            end 
                        end 
                    end 
                    local money = getPlayerMoney(thePlayer) 
                    local price = houseData[id]["PRICE"] 
                    if(money < price) then outputChatBox("У вас не достаточно денег, нужно еще "..(price-money).."$", thePlayer, 255, 0, 0) return end 
                    setHouseData(id, "OWNER", bagas) 
                    givePlayerMoney(thePlayer, -price) 
                    setAccountData(thePlayer,"owner", id) 
                    outputChatBox("Поздравляем! Вы приобрели себе новый дом", thePlayer, 0, 255, 0) 
                    setElementModel(houseData[id]["PICKUP"], 1272) 
                    setElementModel(houseData[id]["BLIP"], 32) 
                end 
            end 
        end 
    end) 
    

    Function to get houses from db after restart:

    function housesys_startup() 
        if(created == true) then 
            error("Дома уже созданы. Ошибка BD00") 
            return 
        end 
        buildStartTick = getTickCount() 
        local query = dbQuery(housingdab, "SELECT * FROM 'houses' " ) 
        local result, numrows = dbPoll(query, -1) 
        if (result and numrows > 0) then 
            for index, row in pairs(result) do 
                local id = row['ID'] 
                local x, y, z = row['X'], row['Y'], row['Z'] 
                local int, intx, inty, intz = row['INTERIOR'], row['INTX'], row['INTY'], row['INTZ'] 
                local money, weap1, weap2, weap3 = row['MONEY'], row['WEAP1'], row['WEAP2'], row['WEAP3'] 
                local locked = row['LOCKED'] 
                local price = row['PRICE'] 
                local owner = row['OWNER'] 
                local rentable = row['RENTABLE'] 
                local rentalprice = row['RENTALPRICE'] 
                local rent1, rent2, rent3, rent4, rent5 = row['RENT1'],row['RENT2'], row['RENT3'], row['RENT4'], row['RENT5'] 
                local weapontable = {} 
                weapontable[1] = weap1 
                weapontable[2] = weap2 
                weapontable[3] = weap3 
                buildHouse(id, x, y, z, int, intx, inty, intz, money, weapontable, locked, price, owner, rentable, rentalprice, rent1, rent2, rent3, rent4, rent5) 
            end 
            dbFree(query) 
        else 
            error("База данных не найдена или пустая. Ошибка BD01") 
        end 
        created = true 
        setTimer(function() 
            local elapsed = (buildEndTick-buildStartTick) 
            outputServerLog("Это займет "..(elapsed/1000).." секунд для постройки всех домов") 
        end, 1000, 1) 
        rentTimer = setTimer(takePlayerRent, 60*60*1000, -1) 
    end 
    

  12. Yes, ofc i thought about some graphic effects + need to fix some bugs which i have detected :S

    idk i have made remove handler for edit boxes but when i'm pressed to the empty place where was edit box and buttons

    debug string: INFO: Pressed button, INFO: Pressed editbox :D

    i think to make animation to hide login behind the screen

  13. i have a problem with sqlite database

    just i want to create special database for ACL groups

    and i saw function like this ( but my shit isn't work xD )

    executeSQLQuery do not created table into the db and i think this table has been created in internal.db becouze i saw some the same tables there

    sorry for bad english :)

    function groupdb() 
    groupdb = dbConnect("sqlite", "group.db") 
    if (groupdb) then 
    executeSQLQuery("CREATE TABLE IF NOT EXIST group ( name TEXT, permission TEXT, accounts TEXT )") 
    outputDebugString("You have seccessfully connected to the group.db") 
    else 
    outputDebugString("You have not connected to the group.db") 
    end 
    end 
    addEventHandler("onResourceStart", getRootElement(), groupdb) 
    

  14. • Animated menu ( boxes )

    • Username/Password saver

    • Blocker for unallowed signs like $%^@&$^@$%@^$ in the register

    • Staff box

    • Update box is not finished, but i think panel seems so nice to be posted :D

  15.   
    function createHero(heroname,herolastname, heroage, herocountry, herolang) 
        if not (heroname == "") then 
            if not (herolastname == "") then 
               if not heroname:find("%W") then 
                 if not (heroage == "") then 
                   if not (herocountry == "") then 
                      if not (herolang == "") then 
                        local account = getPlayerAccount(source) 
                        local accountname = getAccountName(account) 
                        local herona = dbQuery( connection, "SELECT heroname FROM character") 
                        local heroln = dbQuery( connection, "SELECT herolastname FROM character") 
                        local heroInA = dbPoll(heroIn, -1) 
                        local heronaA = dbPoll(herone, -1) 
                        if not (heroname == heronaA) and not ( herolastname == heroInA ) then 
                            dbExec( connection,"INSERT INTO character  VALUES(?, ?, ?, ?, ?, ?)", accountname, heroname, herolastname, heroage, herocountry, herolang) 
                            triggerClientEvent(source,"changeMessage",getRootElement(),"2","Character seccessfully created","green") 
                        else 
                            triggerClientEvent(source,"changeMessage",getRootElement(),"2","This name already taken", "red") 
                            triggerClientEvent(source,"changeMessage",getRootElement(),"4","", "red") 
                        end 
                else 
                triggerClientEvent(source,"changeMessage",getRootElement(),"2","Please enter your language", "red") 
                triggerClientEvent(source,"changeMessage",getRootElement(),"4","", "red") 
                end 
            else 
                triggerClientEvent(source,"changeMessage",getRootElement(),"2","Please enter your country", "red") 
                triggerClientEvent(source,"changeMessage",getRootElement(),"4","", "red") 
            end 
        else 
            triggerClientEvent(source,"changeMessage",getRootElement(),"2","Please enter your birthday date", "red") 
            triggerClientEvent(source,"changeMessage",getRootElement(),"4","", "red") 
        end 
        else 
    triggerClientEvent(source,"changeMessage", getRootElement(), "2","Your name has invalid characters", "red") 
    end 
    else 
    triggerClientEvent(source,"changeMessage", getRootElement(), "2","Please enter your last name", "red") 
    end 
    else 
    triggerClientEvent(source,"changeMessage", getRootElement(), "2","Please enter your name", "red") 
    end 
    end 
    addEvent("createHero",true) 
    addEventHandler("createHero",getRootElement(),createHero) 
      
    

    thanks

×
×
  • Create New...