Jump to content

monumento

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by monumento

  1. If I understand correctly, you want to have multi-language phrases.

    If that's the case, I wouldn't use neither. I'd use just standard files that contain a table of phrases. This way translators are able to edit these quite easily and you can strip it all in PHP to make a web application for translators and generate a new Lua file on each save.

    I don't like fetching irrelevant information continuously from the database, especially stuff like translations that could be saved in files for easier accessibility. Many translation programs also allow importing of some specific type of files, including files that consist out of arrays, which contains different nodes for different sub-pages or so, and then within those they have a node for events and common phrases.

    And then there's XML and JSON.

    P.S.

    Doesn't matter where you trigger your MySQL queries, it's the same speed and efficiency everywhere especially if they're all located in a single box and so hosted locally.

    And I wouldn't use mysql_query, or that module anyway. Use the standard database functionality built within MTA:SA instead.

    Isn't a db easier to edit? Or... maybe the better idea would be loading all phrases from DB (i really want to make a PHP interfrace so the MySQL is best for me) when server starts and then just making a table with them. Also good.

    P.S:

    I just wont to call the query from MTA SERVER because i want maximum speed, the PHP server and callRemote will do their job correctly. (I guess it's faster :D)

    P.S2: Is there a possibility to change the callRemote user-agent (if the MTA is acting like a browser(?) when executing a callRemote)?

    @Edit: Nevermind P.S2. I found LuaSocket, i'll testi it later. Hope it'll give me exactly what what i expect.

  2. [url=https://community.multitheftauto.com/?p=resources&s=details&id=]https://community.multitheftauto.com/?p=resources&s=details&id=[/url]8612 
    

    Here is it. Just make a timer to save them or

    [url=https://wiki.multitheftauto.com/wiki/OnResourceStop]https://wiki.multitheftauto.com/wiki/OnResourceStop[/url] 
    

  3. Hey. I have a question about the multi-language. What would be best for you?

    #1:

      
    -- some code 
    if getElementData(element, "s:lang") == "pl_PL" then 
       outputChatBox("omgwtf POL") 
    elseif getElementData(element, "s:lang") == "en_US" then 
       outputChatBox("omgwtf ENG") 
    end 
    -- somecode 
      
    

    or...

      
    function langKey(playah, langKey) 
       if getElementData(element, "s:lang") == "pl_PL" then 
          -- searching for langKey in mysql database 
       elseif getElementData(element, "s:lang") == "en_US" then 
          -- searching for langKey in mysql database 
       end 
       return langKey 
    end 
    function cmd(player) 
       outputChatBox(langKey(playah, "lang.command.test")) 
    end 
    -- command handler 
    

    (it's just pseudocode)

    Which would be better for you? The second option wouldnt lag me cuz i'd use the PHP requests instead of lagging mysql_query from MTA.

  4. HI. I have ubuntu 14 and i want to play MTA:SA so... I just installed the GTA: San Andreas and with single player everything is okay. Literally, no general problems. Then i installed MTA:SA. When im opening it in wine:

    wine "Multi Theft Auto.exe" 
    

    Then it's showing the virtual desktop and and its closing - the mod doesnt work. I tried to change some options in wine graphic configuration but nothing is helping. Can any1 help me?

    Thanks.

    Edit: THE logfile:

    09:31:51 - [DEBUG] BeginEventLog

    09:31:52 - [DEBUG] AV health: (-1)

    09:31:52 - [DEBUG] AV Searched 43 dlls, but could not find av helper

    09:31:52 - [DEBUG] AV Searched 6 processes, but could not find av helper

    09:31:52 - [DEBUG] DLL_PROCESS_ATTACH 00000000

    09:31:52 - [DEBUG] DLL_PROCESS_DETACH 00000000

    09:31:52 - [DEBUG] D3DStuff -------------------------

    09:31:52 - [DEBUG] D3DStuff - Direct3DCreate9: 0x002171b8

    09:31:52 - [DEBUG] D3DStuff - 1 Adapters

    09:31:52 - [DEBUG] D3DStuff 0 Identifier - Driver:nv4_disp.dll

    09:31:52 - [DEBUG] Description:NVIDIA GeForce 9600 GT

    09:31:52 - [DEBUG] DeviceName:\\.\DISPLAY1

    09:31:52 - [DEBUG] DriverVersion:0x0006000f 0x000c1a02

    09:31:52 - [DEBUG] VendorId:0x000010de DeviceId:0x00000622 SubSysId:0x00000000 Revision:0x00000000 WHQLLevel:0x00000001

    09:31:52 - [DEBUG] DeviceIdentifier:aeb2cdd4-6e41-43ea-941c-8361cc760781

    09:31:52 - [DEBUG] D3DStuff 0 DisplayMode - Width:800 Height:600 RefreshRate:60 Format:22

    09:31:52 - [DEBUG] D3DStuff 0 hMonitor:0x00000001 ModeCount:6

    09:31:52 - [DEBUG] D3DStuff 0 Caps9 - VertexShaderVersion:0xfffe0300 PixelShaderVersion:0xffff0300 DeclTypes:0x30f

    09:31:52 - [DEBUG] aero-enabled: 1

    09:31:52 - [DEBUG] aero-changeable: 1

    09:31:52 - [DEBUG] driver-overrides-disabled:

    09:31:52 - [DEBUG] device-selection-disabled:

    09:31:52 - [DEBUG] customized-sa-files-using:

    09:31:52 - [DEBUG] times-connected:

    09:31:52 - [DEBUG] times-connected-editor:

    09:31:52 - [DEBUG] optimus-force-detection:

    09:31:52 - [DEBUG] optimus-export-enablement: 0

    09:31:52 - [DEBUG] optimus: 0

    09:31:52 - [DEBUG] optimus-rename-exe: 0

    09:31:52 - [DEBUG] optimus-alt-startup: 0

    09:31:52 - [DEBUG] optimus-force-windowed: 0

    09:31:52 - [DEBUG] optimus-dialog-skip:

    09:31:52 - [DEBUG] optimus-startup-option:

    09:31:52 - [DEBUG] send-dumps:

    09:31:52 - [DEBUG] last-minidump-time:

    09:31:52 - [DEBUG] user-confirmed-bsod-time:

    09:31:52 - [DEBUG] num-minidump-detected:

    09:31:52 - [DEBUG] num-minidump-confirmed:

    09:31:52 - [DEBUG] preloading-upgrades-lowest-unsafe:

    09:31:52 - [DEBUG] noav-user-says-skip: 1

    09:31:52 - [DEBUG] noav-last-asked-time: 388351

    09:31:52 - [DEBUG] noav-last-asked-time-hours-delta: 0

    09:31:52 - [DEBUG] Loader - Process created: C:\Games\GTA San Andreas\gta_sa.exe

    09:31:52 - [DEBUG] Loader - InsertWinMainBlock

    09:31:52 - [DEBUG] Loader - ApplyLoadingCrashPatch

    09:31:52 - [DEBUG] DLL_PROCESS_ATTACH 00000000

    09:31:52 - [DEBUG] ModuleFileName: C:\Games\GTA San Andreas\gta_sa.exe

    09:31:52 - [DEBUG] DLL_PROCESS_DETACH 00000000

    09:31:52 - [DEBUG] Loader - Core injected: C:\Program Files\MTA San Andreas 1.3\mta\core.dll

    09:31:52 - [DEBUG] Loader - Waiting for L3 to close

    09:31:52 - [DEBUG] Loader - Wait for game to exit

    09:31:52 - [DEBUG] Loader - Finishing

  5. function checkAllNicksOfPlayer(who, cmd, playah) 
        local targetPlayer = getPlayerFromNamePart(playah) -- searching player from name part so we dont need to write all the name 
        if not targetPlayer then 
            outputChatBox("this player does not exist", who) 
        else 
        local targetSerial = getPlayerSerial(targetPlayer) -- getting serial to check the db 
        local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking 
        if #searchForANicks > 0 then -- we found player 
            outputChatBox("#FFD330History of nicks for "..getPlayerName(targetPlayer)..":#FAFAFA "..searchForANicks[1].nicks, who, 0, 0, 0, true) -- show message to command executor with player nicks history 
        else 
            outputChatBox("#FFD330This player doesnt have a nick history (Which mean problem with your sqlite db...)", who, 0, 0, 0, true)  
        end 
        end 
    end 
    

    as always debugscript 3 then try. if you got This player doesnt have a nick history (Which mean problem with your sqlite db...) then send me your registry.db (better on the pm)

    #edit: i just gave it to my friends and it works fine for them :)

  6. Dat's because you put wrong nick... :)

    Look at this

        local targetPlayer = getPlayerFromNamePart(playah) -- searching player from name part so we dont need to write all the name 
        local targetSerial = getPlayerSerial(targetPlayer) -- getting serial to check the db 
    

    And think. Change all the function for this:

    function checkAllNicksOfPlayer(who, cmd, playah) 
        local targetPlayer = getPlayerFromNamePart(playah) -- searching player from name part so we dont need to write all the name 
        if not targetPlayer then 
            outputChatBox("this player does not exist", who) 
        else 
        local targetSerial = getPlayerSerial(targetPlayer) -- getting serial to check the db 
        local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking 
        if #searchForANicks == 1 then -- we found player 
            outputChatBox("#FFD330History of nicks for "..getPlayerName(targetPlayer)..":#FAFAFA "..searchForANicks[1].nicks, who, 0, 0, 0, true) -- show message to command executor with player nicks history 
        end 
        end 
    end 
    

    Then try.

    Line 32 in his code returned nil. I think it's because of typo.
    local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking 
    --> 
    local searchForANicks = executeSQLQuery("SELECT `nicks` FROM `aliases` WHERE `serial`=?", targetSerial) -- checking 
      
    

    Nahh men. Both forms are ok.

  7. Default radar uses hardcoded blips.

    CreateBlipAttachedTo 
    

    createBlip 
    createBlipAttachedTo 
    getBlipColor 
    getBlipIcon 
    getBlipSize 
    setBlipColor 
    setBlipIcon 
    setBlipSize 
    getBlipOrdering 
    setBlipOrdering 
    getBlipVisibleDistance 
    setBlipVisibleDistance 
    

  8. 1. Search and use the "VUVUZELE"/"VUVUZELA" script. It have in-built alias/pma.

    2. I wrote smthing for you

    function whenPlayerJoinTheServer() 
        local playerNick = removeHexColorCode(getPlayerName(source)) 
        local playerSerial = getPlayerSerial(source) 
        local searchForAPlayer = executeSQLQuery("SELECT `nicks` FROM `aliases` WHERE `serial`=?", playerSerial) -- trying to select a player from the db 
        if #searchForAPlayer == 0 then -- if we havent found our player then 
            executeSQLQuery("INSERT INTO `aliases`(serial, nicks) VALUES (?, ?)", playerSerial, playerNick) -- insert his record to the table 
        else -- we found our player 
            local actualNicks = searchForAPlayer[1].nicks -- get the 'nicks' data from record 
            if string.find(actualNicks, playerNick) then -- if he have SAME NICK as in the database 
                -- do nothing, why we should double player nicks in db? 
            else -- he dont have this nick in DB 
                local addNewNick = actualNicks .. ", " .. playerNick -- expand variable by adding nick player have now 
                executeSQLQuery("UPDATE `aliases` SET `nicks`=? WHERE `serial`=?", addNewNick, playerSerial) -- executing sql query which updates `texts` value with extanded variable containing new nick 
            end -- ending  
        end-- ending 
    end-- ending 
    addEventHandler ("onPlayerJoin", getRootElement(), whenPlayerJoinTheServer) -- adding event handler, you should know why you need to do it, if not then click "addeventhandler" and you'll get an wiki article. 
    function getPlayerFromNamePart(name) 
        local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil 
        if name then 
            for _, player in ipairs(getElementsByType("player")) do 
                local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() 
                if name_:find(name, 1, true) then 
                    return player 
                end 
            end 
        end 
    end 
    function checkAllNicksOfPlayer(who, cmd, playah) 
        local targetPlayer = getPlayerFromNamePart(playah) -- searching player from name part so we dont need to write all the name 
        local targetSerial = getPlayerSerial(targetPlayer) -- getting serial to check the db 
        local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking 
        if #searchForANicks == 1 then -- we found player 
            outputChatBox("#FFD330History of nicks for "..getPlayerName(targetPlayer)..":#FAFAFA "..searchForANicks[1].nicks, who, 0, 0, 0, true) -- show message to command executor with player nicks history 
        end 
    end 
    addCommandHandler("pma", checkAllNicksOfPlayer) -- adding command 
      
    function createTables() 
        local a = executeSQLQuery("CREATE TABLE IF NOT EXISTS `aliases` (`serial` TEXT, `nicks` TEXT)") -- adding sqlite table with serial (to identificate player) and all nicks 
        if a then outputDebugString("Created table for players aliases") end -- show a msg in console to be sure it all works 
    end 
    addEventHandler("onResourceStart", getResourceRootElement(), createTables) -- adding event handler, you should know why you need to do it, if not then click "addeventhandler" and you'll get an wiki article. 
      
      
    function removeHexColorCode(s) 
        return s:gsub( '#%x%x%x%x%x%x', '' ) or s 
    end 
    

    My english is bad so if you dont understand comments just tell me. And you need also to make a saving when player CHANGE nick while being on the server. Have fun :)

  9. 1. You can make your own weapon system (you can make your own binds, then when bind getElementData if he have gun and give it to him, or smthing similiar.

    2. Try to use this script:

    addEventHandler ( 'onPlayerWeaponSwitch', getRootElement ( ), -- adding an event handler for onplayerweaponswitch 
        function ( previousWeaponID, currentWeaponID ) 
            if previousWeaponID == 22 and getElementData(source, "deagle") == true then -- checking if previous weapon was colt and giving dgl 
                giveWeapon(source, 24, 30)  -- giving playah a dgl   
            end 
            if previousWeaponID == 24 and getElementData(source, "colt") == true then -- checking if previous weapon was dgl and giving colt 
                giveWeapon(source, 22, 30) -- giving playah a colt 
            end 
        end 
    ) 
    function givePlayerAGun (who, cmd, agun) 
    -- 'gun' argument: 1 - colt, 2 - deagle 
        outputChatBox("YOU EXECUTED: "..tostring(cmd), who) 
        if agun == "1" then 
            giveWeapon(who, 22, 30, true) -- giving playah a colt 
            setElementData(who, "colt", true) -- element data fun, i think there is other idea to do it, think 
        elseif agun == "2" then 
            giveWeapon(who, 24, 30, true)  -- giving playah a dgl 
            setElementData(who, "deagle", true) -- element data fun, i think there is other idea to do it, think 
        end 
    end 
    addCommandHandler ( "givemeagun", givePlayerAGun )-- command giving a weapon, use /givemeagun 1 or /givemeagun2 
    

    It works but its just basic, you need to do some shit client-side also to get ammo and recover it, blah blah :) It works as it should.

×
×
  • Create New...