-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
A. No, it isn't Q. Is it?
-
Oh, yes, I didn't even think about this.
-
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)
-
Thank you, I was thinking about this too. Thanks to everyone who helped me.
-
Well, not exactly; I want to get the "owner" of account
-
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".
-
I think this: account = getAccountPlayer(account), line 17
-
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?
-
Hello, I'm wondering how to get player name from account. I would be grateful if someone will help me
-
I fixed it by myself, thanks anyways
-
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
-
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
-
I can't because I need to test it on the map.
-
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
-
Thank you! But this only gets account names, can it get player's names too?
-
But the example will get only number of all accounts...
-
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.
-
Thanks for the maps! Good luck with your life.
-
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.
-
A. It's 9 Q. Are you lazy?
-
A. Sad Q. How much is (5 * 9) + (sqrt(10)^3)?
-
Oh, I fixed the problem. So, moderator can lock this topic EDIT: The debug says: attempt to perform arithmetic on a boolean value
-
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
-
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)