Jump to content

Fury

Members
  • Posts

    265
  • Joined

  • Last visited

Everything posted by Fury

  1. Fury

    trigger problem

    server: ----------------------- -- Player Stats tabi -- ----------------------- function getPlayerStats(triggeringPlayer,thePlayer) local account = getPlayerAccount( thePlayer ) local points = tonumber(getAccountData( account,"points" )) local wins = tonumber(getAccountData( account,"wins" )) local second = tonumber(getAccountData( account,"second" )) local third = tonumber(getAccountData( account,"third" )) local rank = getElementData(source,"rank") callClientFunction1(triggeringPlayer,"displayPersonalStats",thePlayer,points,wins,second,third,rank) end -------------- function callServerFunction1(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction1", true) addEventHandler("onClientCallsServerFunction1", resourceRoot , callServerFunction) function callClientFunction1(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction1", resourceRoot, funcname, unpack(arg or {})) end client: GUIEditor_Tab[6] = guiCreateTab("Player Stats",GUIEditor_TabPanel[1]) gridOnlinePlayers = guiCreateGridList(20,51,162,280,false,GUIEditor_Tab[6]) guiGridListSetSortingEnabled(gridOnlinePlayers, false) guiGridListAddColumn(gridOnlinePlayers,"Name",0.9) for _,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow (gridOnlinePlayers) guiGridListSetItemText(gridOnlinePlayers,row,1,string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", ""),false,false) end lblConnectedPlayers = guiCreateLabel(20,26,162,19,"Connected players",false,GUIEditor_Tab[6]) guiLabelSetColor(lblConnectedPlayers,255,120,0) guiLabelSetVerticalAlign(lblConnectedPlayers,"center") guiLabelSetHorizontalAlign(lblConnectedPlayers,"center",false) guiSetFont(lblConnectedPlayers,"default-bold-small") btnViewStats = guiCreateButton(196,96,128,36,"View stats",false,GUIEditor_Tab[6]) playerStatsWindow = guiCreateWindow(screenWidth/2-SWindowWidth/2,screenHeight/2-SWindowHeight/2,SWindowWidth,SWindowHeight,"Loading, please wait...",false) guiWindowSetSizable(playerStatsWindow,false) guiSetVisible(playerStatsWindow,false) lblPStats = guiCreateLabel(17,22,107,49,"Stats",false,playerStatsWindow) guiLabelSetColor(lblPStats,255,120,0) guiSetFont(lblPStats,"sa-header") lblPwins = guiCreateLabel(17,97,129,16,"Wins: N/A",false,playerStatsWindow) guiSetFont(lblPwins,"default-bold-small") lblPpoints = guiCreateLabel(17,81,97,16,"Points: N/A",false,playerStatsWindow) guiSetFont(lblPpoints,"default-bold-small") lblPsecond = guiCreateLabel(17,123,204,18,"Second Places: N/A",false,playerStatsWindow) guiSetFont(lblPsecond,"default-bold-small") lblPthird = guiCreateLabel(17,165,204,18,"Third Places: N/A",false,playerStatsWindow) guiSetFont(lblPthird,"default-bold-small") lblPrank = guiCreateLabel(17,178,230,14,"Rank: N/A",false,playerStatsWindow) guiSetFont(lblPrank,"default-bold-small") btnClosePlayerStatsWindow = guiCreateButton(428,226,102,38,"Close",false,playerStatsWindow) function closeStatsWindow() guiSetVisible(playerStatsWindow,false) end function getPersonalStats() local row,column = guiGridListGetSelectedItem(gridOnlinePlayers) local playerName = guiGridListGetItemText(gridOnlinePlayers,row,1) if not (playerName == "") then callServerFunction1("getPlayerStats",getLocalPlayer(),findPlayerByName(playerName)) else outputChatBox("#c0c0c0* ERROR! Please select a player!",255,255,255,true) end end function displayPersonalStats(thePlayer,points,wins,second,third,rank) guiSetText (lblPpoints, "Points: "..points) guiSetText (lblPwins, "Wins: "..wins) guiSetText (lblPsecond, "Second Places: "..second) guiSetText (lblPthird, "Third Places: "..third) guiSetText (lblPMrank,"Rank: "..rank) guiSetText(playerStatsWindow,string.gsub(getPlayerName(thePlayer),"#%x%x%x%x%x%x", "").."'s stats") end addEventHandler ( "onClientGUIClick", btnViewStats, getPersonalStats, false ) addEventHandler ( "onClientGUIClick", btnClosePlayerStatsWindow, closeStatsWindow, false ) function findPlayerByName (name) local player = getPlayerFromName(name) if player then return player end for i, player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then return player end end return false end function callClientFunction1(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onServerCallsClientFunction1", true) addEventHandler("onServerCallsClientFunction1", resourceRoot, callClientFunction) function callServerFunction1(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end triggerServerEvent("onClientCallsServerFunction1", resourceRoot , funcname, unpack(arg)) end error in line 47 client: guiSetText (lblPLevel, "Points: "..points)
  2. addEvent ( "onMapStarting" ) function setLightColours ( source, commandName, r, g, b ) theVehicle = getPedOccupiedVehicle ( source ) if theVehicle then local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then setAccountData ( playerAccount, "idd.cchcr", r) setAccountData ( playerAccount, "idd.cchcg", g) setAccountData ( playerAccount, "idd.cchcb", b) setVehicleHeadLightColor ( theVehicle, r,g,b) setVehicleOverrideLights ( theVehicle, 2 ) outputChatBox ( "Your Chosen Light Colours have Been Saved!", source) else outputChatBox ( "You are not logged in!", source) end else outputChatBox ( "You do not have a Vehicle!", source) end end addCommandHandler("setLightColours", setLightColours) function setCarColours () theVehicle = getPedOccupiedVehicle ( source ) if theVehicle then local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then local color1, color2, color3, color4 = getVehicleColor ( theVehicle ) setAccountData ( playerAccount, "idd.ccolor1", colour1 ) setAccountData ( playerAccount, "idd.ccolor2", colour2 ) setAccountData ( playerAccount, "idd.ccolor3", colour3 ) setAccountData ( playerAccount, "idd.ccolor4", colour4 ) local crdone = outputChatBox ( "Your Current Car Colours have Been Saved!", source) else outputChatBox ( "You are not logged in!", source) end else outputChatBox ( "You do not have a Vehicle!", source) end end addCommandHandler("setCarColours", setCarColours) function setAllColours(_, playerAccount) theVehicle = getPedOccupiedVehicle ( source ) if theVehicle then local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then outputChatBox ("Broken!",source) local color1 = getAccountData ( playerAccount, "idd.ccolor1") local color2 = getAccountData ( playerAccount, "idd.ccolor2") local color3 = getAccountData ( playerAccount, "idd.ccolor3") local color4 = getAccountData ( playerAccount, "idd.ccolor4") local r = getAccountData ( playerAccount, "idd.cchcr" ) local g = getAccountData ( playerAccount, "idd.cchcg" ) local b = getAccountData ( playerAccount, "idd.cchcb" ) local cr = tonumber ( r ) local cg = tonumber ( g ) local cb = tonumber ( b ) setVehicleColor ( theVehicle, color1, color2, color3, color4 ) setVehicleHeadLightColor ( theVehicle, cr,cg,cb) else outputChatBox ( "You are not logged in!", source) end else outputChatBox ( "You do not have a Vehicle!", source) end end addCommandHandler ( "restoreColours", setAllColours) addEventHandler ( "onMapStarting", getRootElement(),setAllColours )
  3. Fury

    trigger problem

    I think he doesn't want us to continue because the script was stolen. no i fixed the problem. i dont need your humiliation. i was just want some help. nevermind...
  4. empty teams are showing on scoreboard. how can we delete empty team? It's fixed now. Thanks for reporting that minor bug. its same..
  5. empty teams are showing on scoreboard. how can we delete empty team?
  6. if getActivePlayerCount() <= 1 then find this and replace with this on your default destructionderby.lua if getActivePlayerCount() <= 0 then
  7. DestructionDerby = setmetatable({}, RaceMode) DestructionDerby.__index = DestructionDerby DestructionDerby:register('Destruction derby') function DestructionDerby:isApplicable() return not RaceMode.checkpointsExist() and RaceMode.getMapOption('respawn') == 'none' end function DestructionDerby:getPlayerRank(player) return #getActivePlayers() end -- Copy of old updateRank function DestructionDerby:updateRanks() for i,player in ipairs(g_Players) do if not isPlayerFinished(player) then local rank = self:getPlayerRank(player) if not rank or rank > 0 then setElementData(player, 'race rank', rank) end end end -- Make text look good at the start if not self.running then for i,player in ipairs(g_Players) do setElementData(player, 'race rank', '' ) setElementData(player, 'checkpoint', '' ) end end end function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end function DestructionDerby:onPlayerQuit(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() end end end function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) end end ------------------------------------------------------------ -- activePlayerList stuff -- function isActivePlayer( player ) return table.find( g_CurrentRaceMode.activePlayerList, player ) end function addActivePlayer( player ) table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) end function removeActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) end function finishActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) end function getFinishedPlayerCount() return #g_CurrentRaceMode.finishedPlayerList end function getActivePlayerCount() return #g_CurrentRaceMode.activePlayerList end function getActivePlayers() return g_CurrentRaceMode.activePlayerList end change destructionderby.lua with this.
  8. Fury

    top list

    thank you so much
  9. Fury

    top list

    thanks you okay its done but i have this now. if player is not in the server it shows "false" ...
  10. Fury

    top list

    local amountOfTopsToDisplay = 5 addCommandHandler("top", function(player, command, value) if value == "wins" or value == "points" then local tableOrder = {} for i,v in ipairs(getAccounts()) do table.insert(tableOrder,{name = getAccountData(v, "nick"),data = getAccountData(v, value)}) end table.sort(tableOrder, function(a,b) return ( tonumber(a.data) or 0 ) > ( tonumber(b.data) or 0 ) end) outputChatBox("#c0c0c0* Top 5 #abcdef"..value, player, 255,255,255,true) for i,v in ipairs(tableOrder) do outputChatBox("#c0c0c0* #abcdef"..i.."#c0c0c0. #abcdef"..v.name.." #c0c0c0- #abcdef"..v.data, player, 255,255,255,true) if i == amountOfTopsToDisplay then break end end else outputChatBox("#c0c0c0* Syntax : #abcdef/top #c0c0c0[#abcdefwins #c0c0c0| #abcdefpoints#c0c0c0]", player, 255,255,255,true) end end) on line of 12
  11. Fury

    top list

    ah i didnt see your post now i have got this problem.. local amountOfTopsToDisplay = 5 addCommandHandler("top", function(player, command, value) if value == "wins" or value == "points" then local tableOrder = {} for i,v in ipairs(getAccounts()) do table.insert(tableOrder,{name = getAccountData(v, "nick"),data = getAccountData(v, value)}) end table.sort(tableOrder, function(a,b) return ( tonumber(a.data) or 0 ) > ( tonumber(b.data) or 0 ) end) outputChatBox("#c0c0c0* Top 5 #abcdef"..value, player, 255,255,255,true) for i,v in ipairs(tableOrder) do outputChatBox("#c0c0c0* #abcdef"..i.."#c0c0c0. #abcdef"..v.name.." #c0c0c0- #abcdef"..v.data, player, 255,255,255,true) if i == amountOfTopsToDisplay then break end end else outputChatBox("#c0c0c0* Syntax : #abcdef/top #c0c0c0[#abcdefwins #c0c0c0| #abcdefpoints#c0c0c0]", player, 255,255,255,true) end end) on line of 12
  12. Fury

    top list

    bad argument in table.insert(tableOrder,{name = getAccountData(v, "nick"),data = getAccountData(v, vaule)})
  13. Fury

    top list

    when i try that it gives me bad argument in subTable.name = getAccountData( v, "nick" ) subTable.data = getAccountData( v, vaule )
  14. Fury

    top list

    hello guys, i have made a stats system for race with getAccountData and setAccountData. i want to make a top list for it. i have "nick" data and i want make it top "wins", "points", "second", "third" list like that. top 5 wins 1. F*ckN|V - 18 2. F*ckN|Deiter - 12 3. F*ckN|Vendetta - 10 4. F*ckN|Deitas - 8 5. F*ckN|Vienetta - 2 i know i have to use table.sort. but i dont know to use account database thing. local amountOfTopsToDisplay = 5 addCommandHandler("top", function(player, command, value) if value == "wins" or value == "points" or value == "second" or value == "third" then local tableOrder = {} local subTable = {} for i,v do subTable.name = getAccountData( v, "nick" ) subTable.data = getAccountData( v, vaule ) table.insert(tableOrder, subTable) subTable = {} end table.sort(tableOrder, function(a,b) return tonumber(a.data)>tonumber(b.data) end) outputChatBox("#c0c0c0* Top 5 #abcdef"..value, player, 255,255,255,true) for i,v in ipairs(tableOrder) do outputChatBox("#c0c0c0* #abcdef"..i.."#c0c0c0. #abcdef"..v.name.." #c0c0c0- #abcdef"..v.data, player, 255,255,255,true) if i == amountOfTopsToDisplay then break end end else outputChatBox("#c0c0c0* Syntax : #abcdef/top #c0c0c0[#abcdefwins #c0c0c0| #abcdefpoints#c0c0c0]", player, 255,255,255,true) end end) is this code right? thanks for now
  15. follow these steps viewtopic.php?f=91&p=347583#p347548
  16. Fury

    censor words

    words = {"ananı","sikerim","orospu","amına","kancık","dick","yarrak","yarak","yarrağ","yarağ","bacını","ırzı","piç","mına","skerim","siktir","anan","lick","ass","asshole"} _root = getRootElement() _warnings = get("*Warnings") addEventHandler("onPlayerChat",_root, function (_msg,_type) for _,_x in pairs(words) do if string.find(_msg,string.lower(_x)) then local _msg = string.lower(_msg) cancelEvent() if _type == 0 then local _number = string.len(_x) local g_Name = getPlayerName(source) local _r,_g,_b = getPlayerNametagColor(source) _msg = string.rep("*",tonumber(_number)) outputChatBox( g_Name .. ":#FDE3B3 " .. _msg , _root, _r, _g, _b, true) else return end end end end ) hi guys whats wrong with that? its not working and not giving any errors
  17. addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winner) savePlayerData (winner,"cash",loadPlayerData(winner,"cash") + 1000) outputChatBox ("* " ..getPlayerName (winner).." wins!", root, 255, 255, 255, true ) end) you should learn english first if you wanna write scripts. /// biraz ingilizce öğren bence ne dediğin anlaşılmıyor. kodlamada ilerlemek istiyorsan ingilizcen çok iyi olmalı.
  18. function ebeninami() local rank = exports.race:getPlayerRank( source ) + 1 if (rank == 2) then savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) elseif(rank == 3) then savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) elseif(rank == 4) then savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) elseif(rank == 5) then savePlayerData (source,"cash",loadPlayerData(source,"cash") + 1000) end end addEventHandler("onPlayerWasted", getRootElement(), ebeninami) try that. // bunu dene. //// ayrıca savePlayerData ve LoadPlayerData fonksyonlarını paylaşta yanlışlığın nerde olduğuna bakalım. fonksyonları Nextreme'den aldıysan yanlış kullanıyorsun..
  19. hahahahahah 20$ for that? xDXD NO WAY. You can search on the communty https://community.multitheftauto.com/ind ... ls&id=4041 maybe is that something for you... you can just edit it. i made a new rate system for that. if you dont like it just shut the fuck up..
  20. i made this. if you want i can sell it to you for 20€.
  21. Fury

    stats system

    yeah. i solved the problem. its about with rankingboard.lua
×
×
  • Create New...