Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Everything posted by KariiiM

  1. If I'm not wrong it has no size limit
  2. Client files ? or the resource itself ?
  3. Send me the full code via pm, I will test it and fix it for you when I have a free time ofc.
  4. KariiiM

    create weapon

    Do you mean the default MTA Deathmatch script ?
  5. Don't give up, Delete the selected account and reconnect then check again
  6. KariiiM

    Money Hud

    Try that, function HudMoney() local money = string.format ( "%.8f", getPlayerMoney ( getLocalPlayer ( ) ) ) dxDrawText("$"..money.."", 1455, 53, 1478, 86, tocolor(255, 255, 255, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false) end
  7. The code that I wrote should work, debug the outputted values from database -- ACCOUNT CLIENT-SIDE -- function gAccountsToSend( getUserName ) local gAccount = getPlayerAccount( getUserName ) local gAccountName = getAccountName ( gAccount ) if ( gAccountName ) then local query = dbQuery (dataBase,"SELECT money,playerKills,playerDeaths,playerJoin FROM userDatabase WHERE accountName = ?",gAccountName) local result = dbPoll (query,-1) if ( #result > 0 ) then local userMoney = result.money local userKills = result.playerKills local userDeaths = result.playerDeaths local userJoins = result.playerJoin outputDebugString ( tostring ( userMoney ) ) outputDebugString ( tostring ( userKills ) ) outputDebugString ( tostring ( userDeaths ) ) outputDebugString ( tostring ( userJoins ) ) outputDebugString ( tostring ( getPlayerName ( getUserName ) ) triggerClientEvent( client, "onSendAccountNamesToClient", client, getUserName, userMoney, userKills, userDeaths, userJoins) end end end addEvent("onClientRequestAccountNames", true) addEventHandler("onClientRequestAccountNames", getRootElement(), gAccountsToSend)
  8. KariiiM

    Money Hud

    function HudMoney() local money = string.format ( "%09d", getPlayerMoney ( getLocalPlayer ( ) ) ) dxDrawText("$"..money.."", 1455, 53, 1478, 86, tocolor(255, 255, 255, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false) end
  9. I think I solved your problem, try that and tell me the results --Client side: function getGridPlayer ( getUserName, userMoney, userKills, userDeaths, userJoins ) guiSetText (nameLabel,"Username: ".. tostring ( getPlayerName ( getUserName ) ) ) guiSetText (moneyLabel,"Money: ".. tostring ( userMoney ) ) guiSetText (killsLabel,"Kills: ".. tostring ( userKills ) ) guiSetText (deathsLabel,"Deaths: ".. tostring ( userDeaths ) ) guiSetText (joinLabel,"Joins: ".. tostring ( userJoins ).."x") end addEvent ( "onSendAccountNamesToClient", true ) addEventHandler("onSendAccountNamesToClient", root, getGridPlayer) function onGridClick( ) if ( source == playersGridList ) then local getUserName = getPlayerFromName ( guiGridListGetItemText ( playersGridList, guiGridListGetSelectedItem ( playersGridList ), 1) ) if ( getUserName ) then triggerServerEvent ( "onClientRequestAccountNames", localPlayer, getUserName ) end end end addEventHandler ( "onClientGUIClick", guiRoot, onGridClick ) --Server side: Change the gAccountsToSendfunction with this one: -- ACCOUNT CLIENT-SIDE -- function gAccountsToSend( getUserName ) local gAccount = getPlayerAccount( getUserName ) local gAccountName = getAccountName ( gAccount ) if ( gAccountName ) then local query = dbQuery (dataBase,"SELECT money,playerKills,playerDeaths,playerJoin FROM userDatabase WHERE accountName = ?",gAccountName) local result = dbPoll (query,-1) if ( #result > 0 ) then local userMoney = result.money local userKills = result.playerKills local userDeaths = result.playerDeaths local userJoins = result.playerJoin triggerClientEvent( client, "onSendAccountNamesToClient", client, getUserName, userMoney, userKills, userDeaths, userJoins) end end end addEvent("onClientRequestAccountNames", true) addEventHandler("onClientRequestAccountNames", getRootElement(), gAccountsToSend)
  10. I found your problem as well, tell me are you pressing on something to get the statics of a player?
  11. Full server side: local dataBase = dbConnect ( "sqlite", "userDatabase.db" ) dbExec (dataBase ,"CREATE TABLE IF NOT EXISTS userDatabase(accountName TEXT,money INT,playerKills INT,playerDeaths INT,playerJoin INT)" ) -- ADD ACCOUNT DATA -- addEventHandler ("onPlayerLogin",root, function(_,acName) local userAccountName = getAccountName ( acName ) local accountNameQuery = dbQuery ( dataBase, "SELECT accountName FROM userDatabase WHERE accountName = ?", userAccountName ) local result = dbPoll ( accountNameQuery, -1 ) if ( #result == 0 ) then local createData = dbExec ( dataBase, "INSERT INTO userDatabase(accountName,money,playerKills,playerDeaths,playerJoin) VALUES (?,?,?,?,?)",userAccountName,0,0,0,0) if ( createData ) then outputChatBox ("#FF8600*#C1C1C1Your account data was successfully created.",source,255,255,255,true) end end end ) -- DELETE ACCOUNT DATA -- addCommandHandler ("deleteAccountData", function(thePlayer,command,accName) local aName = getAccountName( getPlayerAccount(thePlayer) ) if isObjectInACLGroup("user."..aName, aclGetGroup("Admin")) then if accName then local accountNameDB = dbQuery(dataBase, "SELECT accountName FROM userDatabase WHERE accountName = ?", accName) local result = dbPoll(accountNameDB, -1) if #result ~= 0 then deleteUserData = dbExec (dataBase,"DELETE FROM userDatabase WHERE accountName=?", accName) if (deleteUserData) then outputChatBox ("#FF8600*#C1C1C1Account data was deleted. ("..accName..")",source,255,255,255,true) end else outputChatBox ("#FF8600*#C1C1C1Account name could not be found. ("..accName..")",source,255,255,255,true) end end end end ) -- ACCOUNT CLIENT-SIDE -- function gAccountsToSend( user ) local gAccount = getPlayerAccount( user ) local gAccountName = getAccountName(gAccount) if (gAccountName) then local query = dbQuery (dataBase,"SELECT money,playerKills,playerDeaths,playerJoin FROM userDatabase WHERE accountName = ?",gAccountName) local result = dbPoll (query,-1) if ( #result > 0 ) then local userMoney = result.money local userKills = result.playerKills local userDeaths = result.playerDeaths local userJoins = result.playerJoin triggerClientEvent( client, "onSendAccountNamesToClient", client, userMoney,userKills,userDeaths,userJoins) end end end addEvent("onClientRequestAccountNames", true) addEventHandler("onClientRequestAccountNames", getRootElement(), gAccountsToSend) -- STATICS: DEATHS -- function deathPlayer() local playerAccount = getPlayerAccount(source) local userAccountName = getAccountName (playerAccount) dbExec(dataBase, "UPDATE userDatabase SET playerDeaths = IFNULL (playerDeaths, 0) + 1 WHERE accountName = ?", userAccountName) end addEventHandler ("onPlayerWasted",root,deathPlayer) -- STATICS: JOINS -- function joinsX(_,uName) local userAccountName = getAccountName (uName) dbExec(dataBase, "UPDATE userDatabase SET playerJoin = IFNULL (playerJoin, 0) + 1 WHERE accountName = ?", userAccountName) end addEventHandler ("onPlayerLogin",root,joinsX) Client side: function getGridPlayer(userMoney,userKills,userDeaths,userJoins) if ( guiGridListGetSelectedItem ( playersGridList ) ) then local thePlayerName = guiGridListGetSelectedItemText ( playersGridList ) local getUserName = getPlayerFromPartialName (thePlayerName) guiSetText (nameLabel,"Username: "..thePlayerName) outputDebugString ( "UserMoney: ".. tostring ( userMoney ) ) outputDebugString ( "UserKills: ".. tostring ( userKills ) ) outputDebugString ( "UserDeaths: ".. tostring ( userDeaths ) ) outputDebugString ( "UserJoins: ".. tostring ( userJoins ) ) triggerServerEvent("onClientRequestAccountNames", getLocalPlayer(),getUserName) guiSetText (moneyLabel,"Money: ".. tostring ( userMoney ) ) guiSetText (killsLabel,"Kills: ".. tostring ( userKills ) ) guiSetText (deathsLabel,"Deaths: ".. tostring ( userDeaths ) ) guiSetText (joinLabel,"Joins: ".. tostring ( userJoins ).."x") end end addEvent("onSendAccountNamesToClient", true) addEventHandler("onSendAccountNamesToClient", getRootElement(), getGridPlayer) addEventHandler ("onClientGUIClick",root,getGridPlayer)
  12. Well, I noticed that, the problem isn't in client side it's in server side Because with this line, as far as userMoney variable is a nil value it will keep outputting number 0 to your label. guiSetText (moneyLabel,"Money: "..(userMoney or 0) )
  13. Remove your client code by this code and open your panel be sure the debugscript is actived before you open the panel and show us what's on the debugscript. Code: function getGridPlayer(userMoney,userKills,userDeaths,userJoins) if ( guiGridListGetSelectedItem ( playersGridList ) ) then local thePlayerName = guiGridListGetSelectedItemText ( playersGridList ) getUserName = getPlayerFromPartialName (thePlayerName) guiSetText (nameLabel,"Username: "..thePlayerName) outputDebugString ( "UserMoney: ".. tostring ( userMoney ) ) outputDebugString ( "UserKills: ".. tostring ( userKills ) ) outputDebugString ( "UserDeaths: ".. tostring ( userDeaths ) ) outputDebugString ( "UserJoins: ".. tostring ( userJoins ) ) triggerServerEvent("onClientRequestAccountNames", getLocalPlayer(),getUserName) guiSetText (moneyLabel,"Money: "..(userMoney or 0) ) guiSetText (killsLabel,"Kills: "..(userKills or 0) ) guiSetText (deathsLabel,"Deaths: "..(userDeaths or 0) ) guiSetText (joinLabel,"Joins: "..(userJoins or 0).."x") end end addEvent("onSendAccountNamesToClient", true) addEventHandler("onSendAccountNamesToClient", getRootElement(), getGridPlayer) addEventHandler ("onClientGUIClick",root,getGridPlayer)
  14. Debug the outputted values.
  15. Yes, you're right.
  16. Hello MTA scripters, I found that the giveWeapon function doesn't work with the event onPlayerLogin but it does with onPlayerSpawn aswell, I need an confirmation from you, is that true? Thanks in advance, KariM
  17. The design and the features you added to this browser made it looking amazing, great job.
  18. Explain your problem with more details
  19. If I'm not wrong, That is because the tables don't exist in the SQLite database
  20. Why you didn't inform him about that?
  21. Also, showCursor is a resource based, if you use showCursor in another resource you have to hide it from the same resource else it won't be hidden.
  22. Post a screenshot of your router admin browser where you set the ports
×
×
  • Create New...