Jump to content

GTX

Members
  • Posts

    1,273
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by GTX

  1. GTX

    Short question

    Oh, yes, I didn't even think about this.
  2. GTX

    Short question

    Sorry for double-posting but I've got a weird problem! When I change nick, for example: I change nick to "xG|GTX" and then I see top: it returns the previous nick name and not "xG|GTX"! function save() local account = getPlayerAccount(source) setAccountData(account,"Name",getPlayerName(source)) end addEventHandler("onPlayerChangeNick", getRootElement(), save) addEventHandler("onPlayerLogin", getRootElement(), save) addEventHandler("onResourceStart", getRootElement(), save)
  3. GTX

    Short question

    Thank you, I was thinking about this too. Thanks to everyone who helped me.
  4. GTX

    Short question

    Well, not exactly; I want to get the "owner" of account
  5. GTX

    Short question

    This returns userdata also. But anyways, I want to edit this code: function tables() outputChatBox("Top 3 points:", getRootElement(), 255,255,255) for index, data in ipairs(sortAccounts()) do outputChatBox("#"..tostring(index)..": ".. tostring(data.account) .." - ".. tostring(data.points), getRootElement(), 255, 255, 255) if index == 3 then break end end end addCommandHandler("top", tables) function sortAccounts() local rowdata = {} for index, account in pairs(getAccounts()) do rowdata[index] = { account = getAccountPlayer(account), points = getAccountData(account,"Points"), } end local comparator = function (a, b) return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) end table.sort(rowdata, comparator) return rowdata end This must get all account's "owners".
  6. GTX

    Short question

    I think this: account = getAccountPlayer(account), line 17
  7. GTX

    Short question

    function tables() outputChatBox("Top 3 points:", getRootElement(), 255,255,255) for index, data in ipairs(sortAccounts()) do outputChatBox("#"..tostring(index)..": ".. tostring(data.account) .." - ".. tostring(data.points), getRootElement(), 255, 255, 255) if index == 3 then break end end end addCommandHandler("top", tables) function sortAccounts() local rowdata = {} for index, account in pairs(getAccounts()) do rowdata[index] = { account = getAccountPlayer(account), points = getAccountData(account,"Points"), } end local comparator = function (a, b) return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) end table.sort(rowdata, comparator) return rowdata end You gave me this code, remember? Well, I tryied to make a fuse but I failed. This returns a userdata value, how can I fix it?
  8. GTX

    Short question

    Hello, I'm wondering how to get player name from account. I would be grateful if someone will help me
  9. I fixed it by myself, thanks anyways
  10. I fixed the problem by myself, thanks anyways! Hello, I have problem. I don't know what's the problem here: *CONFIDENTIAL* This should get colour from each player, why it doesn't? (This is not full code) Thanks in advance
  11. GTX

    Push script

    function push (thePlayer, commandName, namepart) player = findPlayer(namepart) if not player then outputChatBox("* /push: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z + 0.25 ) end end addCommandHandler("push", push) Try this
  12. GTX

    MTA:SA 1.2 Released!

    Nice! I'm downloading it now
  13. GTX

    Files got deleted?

    I can't because I need to test it on the map.
  14. GTX

    Files got deleted?

    Hello, I don't know how but when I test my map (scripts are in the file where .map file is) scripts got deleted, this happened to me 3 times and I don't know what to do. I have the latest version of map editor. I hope you don't understand me wrong
  15. Thank you! But this only gets account names, can it get player's names too?
  16. But the example will get only number of all accounts...
  17. Hello, I'm wondering how to get all offline players and get them into a top list (I have no idea where to start) Code: function tables() local table1 = {} local table2 = {} local players = getElementsByType("player") local data1 local data2 local data3 for i, v in ipairs(players) do local account = getPlayerAccount(v) if not (isGuestAccount(account)) then local dataValue = tonumber(getAccountData(account, "Points")) local name = getPlayerName(v) table.insert(table1, dataValue) table2[dataValue] = name end end table.sort(table1) if (#table1 == 1) then data1 = "1. " .. table2[table1[1]] .. " - " .. table1[1] .. " points." elseif (#table1 == 2) then data1 = "1. " .. table2[table1[2]] .. " - " .. table1[2] .. " points." data2 = "2. " .. table2[table1[1]] .. " - " .. table1[1] .. " points." elseif (#table1 >= 3) then data1 = "1. " .. table2[table1[#table1]] .. " - " .. table1[#table1] .. " points." data2 = "2. " .. table2[table1[#table1 - 1]] .. " - " .. table1[#table1 - 1] .. " points." data3 = "3. " .. table2[table1[#table1 - 2]] .. " - " .. table1[#table1 - 2] .. " points." end setTimer(outputChatBox,50,1,"Top 3 points:", root, 255,255,255) if (data1) then setTimer(outputChatBox,60,1, data1, root, 255,255,255) end if (data2) then setTimer(outputChatBox,70,1, data2, root, 255,255,255) end if (data3) then setTimer(outputChatBox,80,1, data3, root, 255,255,255) end table.remove( table1 ) table.remove( table2 ) end addCommandHandler("top", tables) Thanks in advance.
  18. Thanks for the maps! Good luck with your life.
  19. Hello, I have simple question: It is possible to get offline players AND online players? Well, I am creating Ranking system so I need fast reply.
  20. A. Sad Q. How much is (5 * 9) + (sqrt(10)^3)?
  21. Oh, I fixed the problem. So, moderator can lock this topic EDIT: The debug says: attempt to perform arithmetic on a boolean value
  22. Hello, I was about to make the stats system (based on race) and I had some problems... addEvent("onPlayerDDDMWin",true) function DDDMWin(winner) if getPlayerCount() < count then --nothing else if not isGuestAccount( getPlayerAccount ( winner ) ) then local PlayerName = getPlayerName( winner ) local getPlayerAcc = getPlayerAccount ( winner ) outputChatBox("#FFFFFF>> " .. PlayerName .. " #ff9000won as last player alive!", getRootElement(), 255, 255, 255, true) givePlayerMoney( winner , 500) setElementData(winner, "wins", getElementData(winner,"wins") + 1) outputChatBox("#FFFFFF>> #ff9000Earned #FFFFFF200 #ff9000points (Total: #FFFFFF" .. getElementData(winner,"Points") .. "#ff9000) and #FFFFFF1000 #ff9000cash (Total: #FFFFFF" .. getPlayerMoney(winner) .. "$#ff9000)", getRootElement(), 255, 255, 255, true) else outputChatBox("#FFFFFF>> " .. getPlayerName( winner ) .. " #ff9000won as last player alive! (Guest)", getRootElement(), 255, 255, 255, true) end end end addEventHandler("onPlayerDDDMWin",getRootElement(),DDDMWin) Don't worry about the rest of code. Thanks in advance
  23. You posted in wrong section. Next time you have to post in Scripting section, so moderator should move this topic Anyways, try this: teamModerators = createTeam ( "Moderators", 0, 255, 0 ) function addtoteam1(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PModerators" ) ) then setPlayerTeam ( player,teamModerators ) end end function addtoteamtimer1() setTimer(addtoteam1,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer1) teamSubAdmins = createTeam ( "Sub Admins", 0, 255, 0 ) function addtoteam2(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PSubAdmins" ) ) then setPlayerTeam ( player,teamSubAdmins ) end end function addtoteamtimer2() setTimer(addtoteam2,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer2) teamAdmins = createTeam ( "Admins", 0, 255, 0 ) function addtoteam3(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PAdmins" ) ) then setPlayerTeam ( player,teamAdmins ) end end function addtoteamtimer3() setTimer(addtoteam3,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer3) teamOwners = createTeam ( "Owners", 0, 255, 0 ) function addtoteam4(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "POwners" ) ) then setPlayerTeam ( player,teamOwners ) end end function addtoteamtimer4() setTimer(addtoteam4,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer4) teamDevelopers = createTeam ( "Developers", 0, 255, 0 ) function addtoteam5(player) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)) , aclGetGroup ( "PDevelopers" ) ) then setPlayerTeam ( player,teamDevelopers ) end end function addtoteamtimer5() setTimer(addtoteam5,3000,1,source) end addEventHandler("onPlayerLogin",getRootElement(),addtoteamtimer5)
×
×
  • Create New...