Jump to content

xiti

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by xiti

  1. Hello!

    I have a one problem what i cant fix, is there any way to create a new directory in client script cache directory (i mean MTA San Andreas 1.3/mods/deathmatch/resource/), i tried fileCreate(:"..folderName.."/testFile") but this didnt worked and also os.execute("mkdir testfolder") but any way didnt worked...

    If it is possible please help me!

    Thanks!

    Regards, Xiti.

  2. Dear people who need help about scripts,

    I would like to start this topic by presenting myself in a few words. I'm XIti, i've just done new scripts which could be liked by you, i'm also selling them for a cheap and honest price. Using these scripts on your server would be really helpful to get a staff or players through the stats system and the awsome features. I want to show you what kind of script can i do by the following image:

    mtascreen20121010204105.png

    I can also change it as you want, otherwise i've done scripts for -RB-, DK and -ftw- servers, if you have seen them. Well if you want some more information of buy my scripts, contact me on skype: mateusz331169

    Best wishes!

  3. If u want to change this message font u need to make your own function.

    For example:

    function showMessage(player) 
    dxDrawText(getPlayerName(player).." WON!",sX/2,sY/2,500,200,tocolor(255,255,255,255),1,"default-bold") 
    end 
    

  4. Hello Everyone!

    I need help with my idea. I wanna make a simple resource with download function, but i can't put downloaded file do client memory. For example i have client.lua, when player joined to server script call function downloadFile and the file will saved. This is all, because the file is only saved, but not loaded to MTA memory. My question is: Is It possible to download this file without adding this to file meta.xml and load it to MTA memory?

    Thanks for helping, regards, Xiti!

  5. Thanks Jayz but this not work now i dont know why, i try get a value from column exp and this still dont work. When i try get this the debugscript say me: dbPoll failed; Unknown column "exp" in "filed list". Someone help me? Thanks

    Here is a code which i try get this from database.

    loadPlayerData(thePlayer,"exp") 
    

  6. Hello everyone.

    I want help from someone with my load data function. I wanna wright a userpanel and without this i cant make this. I work on this some time and i cant solwe this problem, i try a lot of combination and i dont see a different in this code and idk why this dont work. Please help with this!

    here is my Load system:

    function loadPlayerData (thePlayer,datatype) 
        if (thePlayer) and (datatype) then 
            local guest = getElementData(thePlayer, "loggedin") 
            if not (guest == false) then 
                local account = getElementData(thePlayer, "account") 
                local connect = dbConnect( "mysql", "dbname=localhost;host=localhost", "admin", "admin", "share=1" ) 
                local findQuery = dbQuery( connect,"SELECT '"..datatype.."' FROM smf_sdmembers WHERE passwd='"..account.."'", datatype, account) 
                if (findQuery) then 
                    outputChatBox(""..tostring(findQuery).."") 
                    local result, numrows, errmsg = dbPoll ( findQuery, -1 ) 
                        if numrows > 0 then 
                            outputChatBox(""..result.."") 
                            return result 
                        else 
                            return 0 
                        end 
                else 
                    outputDebugString("Failed to get "..datatype.." for player "..getPlayerName(thePlayer).." @ findQuery") 
                end 
            else 
                outputDebugString("Player not logged "..getPlayerName(thePlayer)..".") 
            end 
        else 
            outputDebugString("Bad arguments loadPlayerData.") 
        end 
    end 
    

    Thank for help! Regards, Xiti :D

  7. Thanks myonlake, this work and i now have other problem... When my script loadPlayerData that i have a error:

    [2012-01-14 15:15:25] WARNING: userpanel\main_server.Lua:3250: Bad argument @ 'dbQuery' [Expected db-connection at argument 2, got string 'SELECT cash FROM userdata WHERE serial='****************************************************''] 
    [2012-01-14 15:15:25] ERROR: userpanel\main_server.Lua:1078: bad argument #1 to 'tonumber' (value expected) 
    
     

    In line 1078 i have this function:

    function playingTimeAdd(thePlayer) 
        local totalPlayingTimeMinutes = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeMinutes")) 
        local totalPlayingTimeHours = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeHours")) 
        if totalPlayingTimeMinutes == 59 then 
            savePlayerData(thePlayer,"totalPlayingTimeMinutes",0) 
            savePlayerData(thePlayer,"totalPlayingTimeHours",totalPlayingTimeHours+1) 
        else 
            savePlayerData(thePlayer,"totalPlayingTimeMinutes",totalPlayingTimeMinutes+1) 
        end 
        local totalPlayingTimeMinutes = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeMinutes")) 
        local totalPlayingTimeHours = tonumber(loadPlayerData(thePlayer,"totalPlayingTimeHours")) 
        callClientFunction(thePlayer,"refreshTimePlaying",totalPlayingTimeMinutes,totalPlayingTimeHours) 
        achievement21(thePlayer) 
        achievement22(thePlayer) 
    end 
     

    I think that is tonumber...

    Please help...

  8. I have problem with my SQL save. I modificed the old MySQL to new SQL save with new mta 1.2 db functions and i now have problem but script dont save values to db file. I work maybe 3 days and i cant solve this problem. Please help me.

    Here is my code:

      
    sqlDefaultTable = "userdata" 
      
      
      
      
      
    -- Connect to the database 
    function mySQLConnect() 
        local server = dbConnect( "sqlite", "file.db" ) 
    end 
    addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),mySQLConnect) 
      
      
      
      
    -- Make a new entry to the mySQL database 
    function checkSqlData(source) 
        local player = source 
        local serial = getPlayerSerial(player) 
        local server = dbConnect( "sqlite", "file.db" ) 
        local entryCheck = dbQuery(server,"SELECT serial FROM "..sqlDefaultTable.." WHERE serial='"..serial.."'") 
        if (entryCheck) then 
            local result = dbPoll(entryCheck,1,1) 
            if (result == "") or (result == nil) then 
                outputDebugString("New entry added to the mySQL database!") 
                dbQuery(server,"INSERT INTO "..sqlDefaultTable.." (serial) VALUES ('"..serial.."')") 
                dbExec(server,"UPDATE "..sqlDefaultTable.." SET playerName='"..string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", "").."' WHERE serial='"..serial.."'") 
            end 
        else 
            outputDebugString("New entry added to the mySQL database!") 
            dbQuery(server,"INSERT INTO "..sqlDefaultTable.." (serial) VALUES ('"..serial.."')") 
            dbExec(server,"UPDATE "..sqlDefaultTable.." SET playerName='"..string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", "").."' WHERE serial='"..serial.."'") 
        end 
    end 
    addEventHandler("onPlayerJoin",getRootElement(),checkSqlData) 
      
      
    addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
    function() 
        for i,player in ipairs (getElementsByType("player")) do 
            checkSqlData(player) 
        end 
    end) 
      
      
      
      
      
      
    -- Load data from the database 
    function loadPlayerData (player,datatype) 
        if (player) and (datatype) then 
            local serial = getPlayerSerial(player) 
            local server = dbConnect( "sqlite", "file.db" ) 
            local findQuery = dbQuery(server,"SELECT "..datatype.." FROM "..sqlDefaultTable.." WHERE serial='"..serial.."'") 
            if (findQuery) then 
                local result = dbPoll(findQuery,1,1) 
                if not (result == nil) then 
                    if not (result == "") then 
                        dbFree(findQuery) 
                        return result 
                    else 
                        dbFree(findQuery) 
                        return 0 
                    end 
                else 
                    return 0 
                end 
            else 
                --outputDebugString("Failed to get "..datatype.." for player "..getPlayerName(player).." @ findQuery") 
                --outputDebugString("mysql_query failed: (" .. mysql_errno(sqlConnection) .. ") " .. mysql_error(sqlConnection)) 
            end 
        end 
    end 
      
      
      
      
      
    -- Save data to the database 
    function savePlayerData (player,datatype,newvalue) 
        if (player) and (datatype) and (newvalue) then 
            local serial = getPlayerSerial(player) 
            local server = dbConnect( "sqlite", "file.db" ) 
            local saveData = dbExec(server,"UPDATE "..sqlDefaultTable.." SET "..datatype.."='"..newvalue.."' WHERE serial='"..serial.."'") 
            if (saveData == nil) then 
                outputDebugString("Error executing the save query: (" .. mysql_errno(sqlConnection) .. ") " .. mysql_error(sqlConnection)) 
            end 
        end 
    end 
    

    Thanks for help.

×
×
  • Create New...