Jump to content

sylver

Members
  • Posts

    38
  • Joined

  • Last visited

sylver's Achievements

Rat

Rat (9/54)

0

Reputation

  1. sylver

    Save To Mysql

    I did already write in a mysql database. But now my question is how do I read? Saving made as follows: local function savePlayer( player ) if not player then for key, value in ipairs( getElementsByType( "player" ) ) do savePlayer( value ) end else if isLoggedIn( player ) then -- save character since it's logged in local sw22 = getPlayerPkt1(player) local x, y, z = getElementPosition( player ) exports.sql:query_free( "UPDATE characters SET money = " .. getPlayerMoney( player ) .. ", pkt = ".. sw22..", rotation = " .. getPedRotation( player ) .. ", health = " .. math.floor( getElementHealth( player ) ) .. ", armor = " .. math.floor( getPedArmor( player ) ) .. ", weapons = " .. getWeaponString( player ) .. ", lastLogin = NOW() WHERE characterID = " .. tonumber( getCharacterID( player ) ) ) end end end setTimer( savePlayer, 3000, 0 ) -- Auto-Save every five minutes function getPlayerPkt1(player) if isElement(player) then local pkt = getElementData(player,"Pkt") if tonumber(pkt) then return tonumber(pkt) else return tonumber(0) end else return tonumber(0) end end Only now how to load it on the scoreboard it was?
  2. sylver

    Save To Mysql

    Downloading statistics such code: function getPlayerPkt(player) if isElement(player) then local pkt = getElementData(player,"Pkt") if tonumber(pkt) then return tonumber(pkt) else return tonumber(0) end else return tonumber(0) end end
  3. sylver

    Save To Mysql

    What do you want me to say? I made a script to show money in the scoreboard I after reconnect is: is 0 cash in scoreboard and I'm have 21 ...
  4. sylver

    Save To Mysql

    Hello. I want to do to save some data from mysql I did so, however, do not save local function savePlayer( player ) if not player then for key, value in ipairs( getElementsByType( "player" ) ) do savePlayer( value ) end else if isLoggedIn( player ) then -- save character since it's logged in local x, y, z = getElementPosition( player ) exports.sql:query_free( "UPDATE characters SET money = " .. getPlayerMoney( player ) .. ", karne = ".. getPlayerPkt(value)..", rotation = " .. getPedRotation( player ) .. ", health = " .. math.floor( getElementHealth( player ) ) .. ", armor = " .. math.floor( getPedArmor( player ) ) .. ", weapons = " .. getWeaponString( player ) .. ", lastLogin = NOW() WHERE characterID = " .. tonumber( getCharacterID( player ) ) ) end end end setTimer( savePlayer, 3000, 0 ) -- Auto-Save every five minutes function getPlayerPkt(player) if isElement(player) then local pkt = getElementData(player,"Pkt") if tonumber(pkt) then return tonumber(pkt) else return tonumber(0) end else return tonumber(0) end end I made a simple script to save but nothing is save function onPlayerLogin () local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then if not isGuestAccount ( playeraccount ) then local playerpkt = getAccountData ( playeraccount, "Pkt" ) if ( playerpkt ) then setElementData(source, "Pkt", tonumber(playerpkt)) end end end end function onPlayerQuit () local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then if not isGuestAccount ( playeraccount ) then local playerpkt = getElementData ( source, "Pkt" ) if ( playerpkt ) then setAccountData ( playeraccount, "Pkt", playerpkt ) end end end end addEventHandler ( "onPlayerLogin", getRootElement (), onPlayerLogin ) addEventHandler ( "onPlayerQuit", getRootElement (), onPlayerQuit )
  5. Problem był w tym że konto test nie było dodane w accounts.xml a: $settings['mta_port'] = 22126; To Port od http
  6. Pisze Tak: The connection with the MTA Server is lost. Please wait while the system is trying to reconnect... Czyli nie potrafi połączyć się z serwerem
  7. Hello. I would like to make a script that for example, how is it 25 wins gets like $ 1000 or 1 point of reputation. When I did this: if getAccountData (playeraccount, "SW ") == 1 then setAccountData (player, "Rep","2") Jumped Error Bad argument @ 'GetAccountData'
  8. Dzięki teraz zadziałało. A mam jeszcze pytanie ściągnąłem Dashboard z community wgrałem to na serwer i na www, powpisywałem dane lecz piszę że nie działa <?php //settings.php //settings for the source. $settings['mta_host'] = "62.75.141.161"; //The location without the HTTP port of your server. $settings['mta_port'] = 22126; $settings['admin_user'] = "test"; //An user with web acces on the SERVER. $settings['admin_pass'] = "test"; //The password for the user. ?> Użytkownik test ma dostęp do uprawnień admina.
  9. Spróbowałem tym 1 sposobem. Zrobiłem wszystko jak pisało typ gry itd itp, jednak nie pobiera danych ani nic bo jest błąd server 1 The server did not respond within the specified time. Taki mam kod na połączenie w example.php: 'server 1' => array('mtasa', '62.75.141.161', '22003')
  10. Witam wszystkich. Chciałbym się dowiedzieć jak mógłbym zrobić listę teamów oraz listę graczy pobieraną z serwera mta na stronę www ? Jeżeli chodzi o Php sdk to słabo mi w tym idzie więc prosiłbym o pomoc.
  11. sylver

    Problem

    Hey, I want to do on the server list with the number of players and teams. I know that this can be done using php sdk but I do not understand! Please help
  12. I also do not work it too much ... Please help my settings.php <?php //settings.php //settings for the source. $settings['mta_host'] = "********"; //The location without the HTTP port of your server. $settings['mta_port'] = 22008; $settings['admin_user'] = "test"; //An user with web acces on the SERVER. $settings['admin_pass'] = "test"; //The password for the user. ?>
  13. No trudno . Ej a jest jakiś sposób żeby na www wyświetlało ilość graczy team itd ?
  14. I co każdy będzie mieć to samo ? Czy będzie musiał sam wgrywać ?
×
×
  • Create New...