Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. Take a look at this tutorial: viewtopic.php?f=148&t=38203
  2. JR10

    Buy map bug.

    ERROR: [gamemodes]\[race]\userpanel\userpanel_server.lua:1684: Database query failed: no such table: race_mapmanager_maps The error is more than self-explanatory the table race_mapmanager_maps does not exist in the database. Looking at your code, you're using a part of the race resource, but missing some of the functions it uses. So your script is pretty messed up. I recommend you either copy it again or consult the one who wrote that code, if it's not you.
  3. Saving vehicles client-side is a very bad idea. Also, try to be more specific about your issue, like, does it output any errors (/debugscript 3)? It's hard to look at a 300+ lines of code trying to figure out the problem for you.
  4. JR10

    Buy map bug.

    I tried to fix the errors you've posted, is it fixed or not? Does it still output the same error? If it outputs other errors, post them.
  5. JR10

    Buy map bug.

    Next time surround your code with [lua.] tags (without the period) and if it's that big use pastebin. Try this: userpanel_server.lua ------------------------------------------------------------------------------------------------------------- -- Original file by NeXTreme. Thanks for you'r awesome resource. -- -- -- -- This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.-- -- [url=http://creativecommons.org/licenses/by-nc-nd/3.0/ ]http://creativecommons.org/licenses/by-nc-nd/3.0/ [/url] -- -- -- -- Edited by Quitler#. All right reserved. Copyright 2013. -- ------------------------------------------------------------------------------------------------------------- -- String.random characters chars = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"} local dataTable = { "cash", "points", "firstTimeJoin", "totalTimesJoined", "unlockedAchievements", "mapsWon", "totalToptimes", "totalHunters", "mapsPlayed", "totalDeaths", "totalPlayingTimeMinutes", "totalPlayingTimeHours", "highestWinstreak", "totalSpins", "buyedMaps", "ach1", "ach2", "ach3", "ach4", "ach5", "ach6", "ach7", "ach8", "ach9", "ach10", "ach11", "ach12", "ach13", "ach14", "ach15", "ach16", } textDataTable = {"nick"} playerTableStats = {} ----------------------------------- --- Protect Userpanel ----------------------------------- function protectUserpanel() onResourceStart() end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),protectUserpanel) ----------- -- Settings ----------- mapCost = 5000 -- The price for setting maps. vehicleColor = 15000 headlightColor = 10000 moneyEarnPart = 30 -- The amount of money to calculate with to get the final money to give to the player. reactionMin = 900 -- Minimum money for the reaction test reactionMax = 2100 -- Maximum money for the reaction test reactionDuration = 20 -- Duration of the reaction test in seconds reactionMinRedo = 300 -- Minimum amount of time to pass before a new reaction test is started in seconds reactionMaxRedo = 400 -- Maximum amount of time to pass before a new reaction test is started in seconds reactionLength = 12 -- Number of characters to use in the reaction test function onResourceStart() mapIsAlreadySet = false reactionString = "" reactionMoney = 0 mapType = "" mapName = "" mapBlock = "" messegeSent = false messegeSentR = false setTimer(newReactionTest,math.random(reactionMinRedo*1000,reactionMaxRedo*1000),1) outputDebugString("Resource is restarting, please stand by...") setTimer(outputDebugString,700,1,"Resource sucessfully started: FFP Userpanel by Xiti. ") end function clientMsgLoad() local toptimesMsg = get( "msgToptime" ) enableTopMsg = false if toptimesMsg then if(toptimesMsg == "true") then enableTopMsg = true else enableTopMsg = false end end end addEvent("onClientLoaded", true) addEventHandler( "onClientLoaded", getRootElement(), clientMsgLoad) -- Prices for each horn hornPrice={2000,4000,6000,8000,10000,15000,20000} -- Disable voting function disableVote() cancelEvent() end addCommandHandler("voteredo",disableVote) addCommandHandler("new",disableVote) ----------------------------------------------------------------------------------- -----------------------------------| USERPANEL |----------------------------------- ----------------------------------------------------------------------------------- ---------------------------- -- Refresh Players ---------------------------- function triggerRebuildPlayerGridlist(thePlayer) local loggedPlayers = {} for i,player in ipairs(getElementsByType("player")) do if not (isGuestAccount(getPlayerAccount(player))) then table.insert(loggedPlayers, tostring(getPlayerName(player))) end setTimer(callClientFunction,1000,1,getRootElement(),"refreshConnectedPlayers",loggedPlayers) end end addEventHandler("onPlayerChangeNick",getRootElement(),triggerRebuildPlayerGridlist) addEventHandler("onPlayerLogin",getRootElement(),triggerRebuildPlayerGridlist) addEventHandler("onPlayerJoin",getRootElement(),triggerRebuildPlayerGridlist) addEventHandler("onPlayerLogout",getRootElement(),triggerRebuildPlayerGridlist) addEventHandler("onPlayerQuit",getRootElement(),triggerRebuildPlayerGridlist) ---------------------------------- -- Tables System based on Accounts ---------------------------------- function createNewTables() local account = getPlayerAccount(source) if not (isGuestAccount(account)) then for i, data in ipairs(dataTable) do if not (getAccountData(account, data)) then setAccountData(account, data, "0") outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(source)).." to 0") end end end if not (isGuestAccount(account)) then for i, data in pairs(textDataTable) do if not (getAccountData(account, data)) then setAccountData(account, data, getPlayerName(source)) end end end end addEventHandler("onPlayerLogin", getRootElement(), createNewTables) addCommandHandler("resetStats", function (player, cmd, arg1) if (arg1) then local account = getPlayerAccount(player) if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then local target = getPlayerWildcard(arg1) if (target) then local account = getPlayerAccount(target) if not (isGuestAccount(account)) then for i, data in ipairs(dataTable) do setAccountData(account, data, "0") outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(target)).." to 0") end end if not (isGuestAccount(account)) then for i, data in pairs(textDataTable) do end end end end end end) ------------------------------------------- -- Userpanel - handle requests from clients ------------------------------------------- function timesJoin() setElementData(source,"join","joined") scoreboardRefresh(source) end addEventHandler("onPlayerJoin",getRootElement(),timesJoin) -- Stats view function getPlayerStats(triggeringPlayer,thePlayer) local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then playerTableStats[1] = tonumber(getAccountData(account,"cash")) playerTableStats[2] = tonumber(getAccountData(account,"points")) playerTableStats[3] = tonumber(getAccountData(account,"mapsPlayed")) playerTableStats[4] = tonumber(getAccountData(account,"totalDeaths")) playerTableStats[5] = tonumber(getAccountData(account,"mapsWon")) playerTableStats[6] = 0 -- Win ratio if playerTableStats[3] == 0 and playerTableStats[5] == 0 then playerTableStats[6] = "0%" elseif playerTableStats[3] ~= 0 and playerTableStats[5] == 0 then playerTableStats[6] = "0%" elseif playerTableStats[3] ~= 0 and playerTableStats[5] ~= 0 then playerTableStats[6] = math.floor(math.round(((100/playerTableStats[3])*playerTableStats[5]),2)).."%" elseif playerTableStats[5] > playerTableStats[3] then playerTableStats[6] = "0%" end playerTableStats[7] = tonumber(getAccountData(account,"unlockedAchievements")).."/16" playerTableStats[8] = tonumber(getAccountData(account,"highestWinstreak")) playerTableStats[9] = tonumber(getAccountData(account,"totalTimesJoined")) playerTableStats[10] = "00:00" minutes = tonumber(getAccountData(account,"totalPlayingTimeMinutes")) hours = tonumber(getAccountData(account,"totalPlayingTimeHours")) if hours < 10 then hours = "0"..hours end if minutes < 10 then minutes = "0"..minutes end playerTableStats[10] = ""..hours..":"..minutes.."" -- Total Playing Time playerTableStats[11] = tonumber(getAccountData(account,"totalHunters")) playerTableStats[12] = tonumber(getAccountData(account,"totalToptimes")) playerTableStats[13] =
  6. JR10

    Buy map bug.

    Post the code if you want anyone to help you.
  7. JR10

    Map Shop - Race

    That's an exported function in the mapmanager resource, you can also use that. Here's how to sort the raceMaps table: table.sort(raceMaps, function(a, b) return getResourceName(b) > getResourceName(a) end) Not tested but should work.
  8. JR10

    Please Help me :(

    i already told you, you can only modify the reason that is shown to the banned player. You can't fully change what the gui shows.
  9. JR10

    Map Shop - Race

    Try this: local raceMaps = {} addEventHandler('onResourceStart', resourceRoot, function() for index, resource in pairs(getResources()) do if (getResourceInfo(resource, "type") == "map" and string.find(getResourceInfo(resource, "gamemodes") or "", "race") then table.insert(raceMaps, resource) end end end)
  10. JR10

    Please Help me :(

    You can't use hex codes in a ban reason, there's absolutely no need to color a reason. You can only modify the reason that is shown to the banned player, and if the reason is too big, nothing will be shown.
  11. JR10

    Help thanks.

    Here's what you need to use: https://wiki.multitheftauto.com/wiki/OnPlayerTarget https://wiki.multitheftauto.com/wiki/OnPlayerDamage setPlayerWantedLevel
  12. GUIEditor.memo[1] = guiCreateMemo(1, 1, 711, 334, "Line 1\nLine 2\nLine 3\nLine 4", false, GUIEditor.tab[1])
  13. You need to change ResourceName to the name of the resource that script is in.
  14. Are you sure that the player logged in with one of the accounts in the table and his serial was different? Anything in /debugscript 3? If not, try explaining what you really want to accomplish.
  15. Yes, I didn't really understand what you wanted. Try the code in my last post. Here it is: serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } function antiUser(_, acc) local name = getAccountName(acc) local serial = getPlayerSerial (source) if (serials[name]) then if (serial == serials[name]) then outputChatBox ( "#FF0000* #00C4FFSerial was checked it is", getRootElement(), 0, 255, 0, true ) else outputChatBox ( "** Warning ** #FFff00he is Tradition and not", getRootElement(), 255, 0, 0, true ) addBan( nil, nil, serial, source, "bye bye You'r not" ) end end end addEventHandler("onPlayerLogin",root,antiUser)
  16. The code won't work. I now understand what you need, try this: serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } function antiUser(_, acc) local name = getAccountName(acc) local serial = getPlayerSerial (source) if (serials[name]) then if (serial == serials[name]) then outputChatBox ( "#FF0000* #00C4FFSerial was checked it is", getRootElement(), 0, 255, 0, true ) else outputChatBox ( "** Warning ** #FFff00he is Tradition and not", getRootElement(), 255, 0, 0, true ) addBan( nil, nil, serial, source, "bye bye You'r not" ) end end end addEventHandler("onPlayerLogin",root,antiUser)
  17. Not sure I fully get you but, if you want to show the player's name who just logged in then getPlayerName will help you. If you want to show the name of the serial in the table then, in the loop, k will represent the name. For example, the first time the loop runs, k will equals to 'maznn' and v will equal to the serial. serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } function antiUser() for k,v in pairs (serials) do local serial = getPlayerSerial (source) if (serial == v) then outputChatBox ( "#FF0000* #00C4FFSerial was checked it is", getRootElement(), 0, 255, 0, true ) outputChatBox("Your name is "..k, source) else outputChatBox ( "** Warning ** #FFff00he is Tradition and not", getRootElement(), 255, 0, 0, true ) addBan( nil, nil, serial, source, "bye bye You'r not" ) end end end addEventHandler("onPlayerLogin",root,antiUser)
  18. It was meant for Anubhav, try this code: serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } function antiUser() for k,v in pairs (serials) do local serial = getPlayerSerial (source) if (serial == v) then outputChatBox ( "#FF0000* #00C4FFSerial was checked it is", getRootElement(), 0, 255, 0, true ) else outputChatBox ( "** Warning ** #FFff00he is Tradition and not", getRootElement(), 255, 0, 0, true ) addBan( nil, nil, serial, source, "bye bye You'r not" ) end end end addEventHandler("onPlayerLogin",root,antiUser)
  19. Your code is not going to work. He's comparing an account name against the string 'serials' which doesn't make any sense. Please, stop helping unless you know what you're doing, as what you're doing can be taken as a way to increase your post count. And as you can see, I've already posted a code for him to try. For the OP, check what I posted above.
  20. serials = { maznn= ["7C27DEB93C7DCE0FEDF877294A46C084"] mazn = ["7C27DEB93C7DCE0FEDF877294A46C084"] max = ["7C27DEB93C7DCE0FEDF877294A46C084"] khald = ["7C27DEB93C7DCE0FEDF877294A46C084"] a7md = ["7C27DEB93C7DCE0FEDF877294A46C084"] } Your table is syntactically wrong, should be: serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } And your script doesn't make sense and you're missing an end, also banSerial is deprecated and you should use addBan instead, try this: serials = { maznn= "7C27DEB93C7DCE0FEDF877294A46C084", mazn = "7C27DEB93C7DCE0FEDF877294A46C084", max = "7C27DEB93C7DCE0FEDF877294A46C084", khald = "7C27DEB93C7DCE0FEDF877294A46C084", a7md = "7C27DEB93C7DCE0FEDF877294A46C084", } function antiUser() for k,v in pairs (serials) do local serial = getPlayerSerial (source) if (serial == v) then outputChatBox ( "#FF0000* #00C4FFSerial was checked it is", getRootElement(), 0, 255, 0, true ) else outputChatBox ( "** Warning ** #FFff00he is Tradition and not", getRootElement(), 255, 0, 0, true ) addBan( nil, nil, serial, source, "bye bye You'r not" ) end end end addEventHandler("onPlayerLogin",root,antiUser)
  21. JR10

    Destroy Vehicles

    addEventHandler('onVehicleExplode', root, function() setTimer(destroyElement, 5000, 1, source) end)
  22. You can use this to check if a name has color codes: if (string.find(name, '#%x%x%x%x%x%x')) then To remove color codes: string.gsub(name, '#%x%x%x%x%x%x', '')
  23. Your code is messed up. zombies resource only has two exported functions: createZombie which returns the ped variable if it was created successfully, and isPedZombie which should be self-explanatory. I've no idea what you're trying to accomplish, but you need to learn more before working on something as advanced as this.
  24. JR10

    Vote redo problem

    if nbVotes >= 4 then Change that line to: if nbVotes >= getPlayerCount() then
  25. How else would anyone be able to help you? We need to see the script. Post it inside [lua] tags.
×
×
  • Create New...