Szerző Téma: Admin stats  (Megtekintve 756 alkalommal)

Admin stats
« Dátum: 2017. Július 10. - 19:33:24 »
0
Sziasztok, lenne egy olyan problémám hogy írtam egy olyan scriptet ami a szuperadminoknak elérhető ez nem más mint az astats és az megmutatja mennyi a küldött és mennyi a fogadott PM-e és a fixelés száma. Az vele a probléma hogy megírtam neki egy savefixek functiont : 
 

function savefixek(source, dataName,oldValue)
        if (dataName == \"char:adminduty\") and isElement(source) and getElementData(source, \"acc:admin\") >= 1 then
   local currFix = getElementData(source, \'admin:fixes\')
--   outputChatBox(currFix .. \" \" .. getPlayerName(source))
   dbExec(con, \"UPDATE characters SET fixVehicles=? WHERE id=\'\" .. getElementData(source, \"char:id\") .. \"\'\", currFix)
--      outputDebugString(getPlayerName(source) .. \" fixei mentve! (\" .. currFix .. \")\")
   end
end
addEventHandler(\"onElementDataChange\", getRootElement(), savefixek)

 
Valamint beleírtam a fixveh parancsba is hogy insertelje a mysqlbe
 
 
 

function fixPlayerVehicle(thePlayer, commandName, targetPlayer)
if getElementData(thePlayer, \"acc:admin\") >= 1 then

   if not (targetPlayer) then
      outputChatBox(\"#7cc576Használat: #ffffff/\" .. commandName .. \" [Név / ID]\", thePlayer, 255, 255, 255, true)
   else      
      local targetPlayer, targetPlayerName = exports.mta_main:findPlayer(thePlayer, targetPlayer)
      local adminduty = getElementData(thePlayer, \"char:adminduty\")
      local alevel = getElementData(thePlayer, \"acc:admin\")
      local veh = getPedOccupiedVehicle(targetPlayer)
      local currFix = getElementData(thePlayer, \'admin:fixes\') or 0
      
         if not targetPlayer or not getElementData(targetPlayer, \"loggedin\") then return end
      
      if veh then
         if (adminduty) == 0 then
            if (alevel) >= 6 then
               fixVehicle(veh)
               triggerClientEvent(root, \"setvehicleCompVisible\", root, targetPlayer)
               outputChatBox(\"#32b3ef \" .. getPlayerAdminName(thePlayer) .. \"#ffffff megjavította a járművedet. \", targetPlayer, 255, 255, 255, true)
               outputChatBox(\"Sikeresen megjavítottad #7cc576\" .. targetPlayerName:gsub(\"_\", \" \") .. \"#ffffff járművét.\", thePlayer, 255, 255, 255, true)
               outputAdminMessage(\"#7cc576\" .. getPlayerAdminName(thePlayer) .. \"#ffffff megjavította #7cc576\" .. targetPlayerName:gsub(\"_\",\" \") .. \"#ffffff járművét.\")
               setElementData(thePlayer, \'admin:fixes\', currFix + 1)
               
               --adminlog
               dbExec(con, adminlog, getPlayerAdminName(thePlayer), getElementData(thePlayer, \"acc:id\"), \"FIXVEH\", \"\" .. getPlayerAdminName(thePlayer) .. \" megjavította \" .. targetPlayerName:gsub(\"_\",\" \") .. \" járművét.\", targetPlayerName, getElementData(targetPlayer, \"acc:id\"))
            else
               outputChatBox(exhiba .. \"Nincs jogosultságod adminduty-n kívül megjavítani a járművet. Hibakód: FIXVEHAD1\", thePlayer, 255, 255, 255, true)
               --adminlog
               dbExec(con, adminlog, getPlayerAdminName(thePlayer), getElementData(thePlayer, \"acc:id\"), \"FIXVEHAD1\", \"\" .. getPlayerAdminName(thePlayer) .. \" megpróbálta megjavitani \" .. targetPlayerName:gsub(\"_\",\" \") .. \" járművét. [ACCES DENIED] [Hibakod: FIXVEHAD1]\", targetPlayerName, getElementData(targetPlayer, \"acc:id\"))
            end
         else
            triggerClientEvent(root, \"setvehicleCompVisible\", root, targetPlayer)
            fixVehicle(veh)
            outputChatBox(\"#32b3ef \" .. getPlayerAdminName(thePlayer) .. \"#ffffff megjavította a járművedet. \", targetPlayer, 255, 255, 255, true)
            outputChatBox(\"Sikeresen megjavítottad #7cc576\" .. targetPlayerName:gsub(\"_\", \" \") .. \"#ffffff járművét.\", thePlayer, 255, 255, 255, true)
            outputAdminMessage(\"#7cc576\" .. getPlayerAdminName(thePlayer) .. \"#ffffff megjavította #7cc576\" .. targetPlayerName:gsub(\"_\",\" \") .. \"#ffffff járművét.\")
            --adminlog
               dbExec(con, \"UPDATE characters SET fixVehicles=? WHERE id=\'\" .. getElementData(thePlayer, \"char:id\") .. \"\'\", currFix)
         end
      else
         outputChatBox(exhiba .. \"A játékos nincsen járműben.\", thePlayer, 255, 255, 255, true)
      end
   end
end
end
addCommandHandler(\"fixveh\", fixPlayerVehicle, false, false)

 
Nem kezdi el beleírni a mysql-be a Characters/fixvehicles-be. az alapértelmezetten van és nem moccan sehova hogyha tolok egy reconnectet akkor 0-zódik a fixek száma IG. Ha valaki tudna ebben segíteni megköszönném.

Admin stats
« Válasz #1 Dátum: 2017. Július 10. - 21:42:27 »
0
debugscript-et küld el, az outpotChatBoxokat kiirja e jól. Ezeket küld és akkor tudunk mégjobban segíteni. 6/telo

Admin stats
« Válasz #2 Dátum: 2017. Július 11. - 20:19:13 »
0
Hát ha csak 1-ig mentél, akkor a \"currFix\" az elején meg van határozva. Mivel még nem csináltál vele semmit se, így 0 lesz. Az elementDatát utána beállítod, jelenlegi+1-re, tehát ha elsőre csináltad, akkor 1-lesz. Viszont a \"currFix\" még mindig 0, mert azt nem állítottad be újra, csak az elementDatát. Utána a \"currFix\"-et lekérve írtad be a mysql-be, ami 0. Ha viszont nem így van, tényleg egy debug kellene.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal