SmoKing Posted March 12, 2013 Share Posted March 12, 2013 السلام عليكم شباب انا سويت مود عباره عن لفلات ونقاط واشياء ومايشتغل المود --- server side --- gRoot = getRootElement() LastWinners={"","","","",""} function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerpoints = getElementData(source,"Points") local playerwins = getElementData(source,"Wins") local playerdeaths = getElementData(source,"Deaths") local playerhunters = getElementData(source,"Hunters") local playerlevels = getElementData ( source, "lvl" ) setAccountData ( playeraccount, "points", playerpoints ) setAccountData ( playeraccount, "wins", playerwins ) setAccountData ( playeraccount, "deaths", playerdeaths ) setAccountData ( playeraccount, "hunters", playerhunters ) setAccountData ( playeraccount, "lvl", playerlevels ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerpoints = getAccountData ( playeraccount, "points" ) local playerwins = getAccountData ( playeraccount, "wins" ) local playerdeaths = getAccountData ( playeraccount, "deaths" ) local playerhunters = getAccountData ( playeraccount, "hunters" ) local playerlevels = getAccountData ( playeraccount, "lvl" ) setElementData(source,"Points",playerpoints or 0) setElementData(source,"Wins",playerwins or 0) setElementData(source,"Deaths",playerdeaths or 0) setElementData(source,"Hunters",playerhunters or 0) setElementData(source,"lvl",playerlevels or 0) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) addEventHandler ("onPlayerChat",getRootElement(), function checkForHunter(number,sort,model) thePlayer = source if sort == "vehiclechange" then if model == 425 then if getElementData(thePlayer,"playerGotHunter") == false then setElementData(thePlayer,"playerGotHunter",true) outputChatBox ( "#ff9900[iNFO] #c0c0c0"getPlayerName(source).." #FFFFFFgot #c0c0c0(400)points #FFFFFFhunter bonus!", getRootElement(), 255, 255, 255, true ) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+400) setElementData(thePlayer,"Hunters",tonumber(getElementData(thePlayer,"Hunters"))+1) end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),checkForHunter) function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 local playerpoints = getElementData(source,"Points") local needexp = lvl * 35 local lvl = lvl + 1 if dPlayers + aPlayers >= 2 then local pointsForPlayer = math.floor((30/Position)*(dPlayers + aPlayers)) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) if Position == 1 then outputChatBox ("#ff9900[iNFO] #c0c0c01st #ffffffYou got #c0c0c0(" .. pointsForPlayer ..")points !",thePlayer,255,255,255,true) setElementData(thePlayer,"Wins",tonumber(getElementData(thePlayer,"Wins"))+1) if LastWinners[1] == "" then if LastWinners[2] == "" then if LastWinners[3] == "" then if LastWinners[4] == "" then if LastWinners[5] == "" then LastWiners[5] = thePlayer else LastWinners[4] = thePlayer end else LastWinners[3] = thePlayer end else LastWinners[2] = thePlayer end else LastWinners[1] = thePlayer end else LastWinners[5] = LastWinners[4] LastWinners[4] = LastWinners[3] LastWinners[3] = LastWinners[2] LastWinners[2] = LastWinners[1] LastWinners[1] = thePlayer end else outputChatBox ("#ff9900[iNFO]#ffffff You got #c0c0c0(" .. pointsForPlayer ..")points !",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[iNFO] #ffffffMinimum 2 players to get Points !",thePlayer,255,255,255,true) end if tonumber(playerpoints) == 10000 then setElementData(thePlayer, "lvl", "1") elseif tonumber(playerpoints) == 15000 then setElementData(thePlayer, "lvl", "2") elseif tonumber(playerpoints) == 25000 then setElementData(thePlayer, "lvl", "3") elseif tonumber(playerpoints) == 50000 then setElementData(thePlayer, "lvl", "4") elseif tonumber(playerpoints) == 60000 then setElementData(thePlayer, "lvl", "5") elseif tonumber(playerpoints) == 80000 then setElementData(thePlayer, "lvl", "6") elseif tonumber(playerpoints) == 100000 then setElementData(thePlayer, "lvl", "7") elseif tonumber(playerpoints) == 125000 then setElementData(thePlayer, "lvl", "8") elseif tonumber(playerpoints) == 130000 then setElementData(thePlayer, "lvl", "9") elseif tonumber(playerpoints) == 150000 then setElementData(thePlayer, "lvl", "10") elseif tonumber(playerpoints) == 200000 then setElementData(thePlayer, "lvl", "11") elseif tonumber(playerpoints) == 220000 then setElementData(thePlayer, "lvl", "12") elseif tonumber(playerpoints) == 250000 then setElementData(thePlayer, "lvl", "13") elseif tonumber(playerpoints) == 275720 then setElementData(thePlayer, "lvl", "14") elseif tonumber(playerpoints) == 305274 then setElementData(thePlayer, "lvl", "15") elseif tonumber(playerpoints) == 315247 then setElementData(thePlayer, "lvl", "16") elseif tonumber(playerpoints) == 332452 then setElementData(thePlayer, "lvl", "17") elseif tonumber(playerpoints) == 365785 then setElementData(thePlayer, "lvl", "18") elseif tonumber(playerpoints) == 400000 then setElementData(thePlayer, "lvl", "19") elseif tonumber(playerpoints) == 410000 then setElementData(thePlayer, "lvl", "20") elseif tonumber(playerpoints) == 427857 then setElementData(thePlayer, "lvl", "21") elseif tonumber(playerpoints) == 442787 then setElementData(thePlayer, "lvl", "22") elseif tonumber(playerpoints)", "485757") setElementData(thePlayer, "lvl", "23") elseif tonumber(playerpoints) == 512547 then setElementData(thePlayer, "lvl", "24") elseif tonumber(playerpoints) == 520557 then setElementData(thePlayer, "lvl", "25") elseif tonumber(playerpoints) == 535757 then setElementData(thePlayer, "lvl", "26") elseif tonumber(playerpoints) == 555785 then setElementData(thePlayer, "lvl", "27") elseif tonumber(playerpoints) == 604854 then setElementData(thePlayer, "lvl", "28") elseif tonumber(playerpoints) == 622752 then setElementData(thePlayer, "lvl", "29") elseif tonumber(playerpoints) == 642785 then setElementData(thePlayer, "lvl", "30") elseif tonumber(playerpoints) == 747547 then setElementData(thePlayer, "lvl", "31") elseif tonumber(playerpoints) == 785757 then setElementData(thePlayer, "lvl", "32") elseif tonumber(playerpoints) == 855785 then setElementData(thePlayer, "lvl", "33") elseif tonumber(playerpoints) == 952000 then setElementData(thePlayer, "lvl", "34") elseif tonumber(playerpoints) == 1000000 then setElementData(thePlayer, "lvl", "35") end if lvls == needexp then outputChatBox("#ff9900* #c0c0c0".. getPlayerName(source).. " #ffffffis now #ffff00 Level. ".. lvl .." #ffffff!", getRootElement(), 0, 255, 0) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) function getAliveRacePlayers() local alivePlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive" then alivePlayers = alivePlayers + 1 end end return alivePlayers end function getDeadRacePlayers() local deadPlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "dead" then deadPlayers = deadPlayers + 1 end end return deadPlayers end --- client side --- localPlayer = getLocalPlayer() function addColumns() exports.scoreboard:scoreboardAddColumn("Points") end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) addEventHandler('onClientPlayerJoin', root, function() setElementData(source,"Points",0) setElementData(source,"Wins",0) setElementData(source,"Deaths",0) setElementData(source,"Hunters",0) setElementData(source,"lvl",0) end ) Link to comment
#ikAkA Posted March 12, 2013 Share Posted March 12, 2013 -- Server Side gRoot = getRootElement() LastWinners={"","","","",""} function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerpoints = getElementData(source,"Points") local playerwins = getElementData(source,"Wins") local playerdeaths = getElementData(source,"Deaths") local playerhunters = getElementData(source,"Hunters") local playerlevels = getElementData ( source, "lvl" ) setAccountData ( playeraccount, "points", playerpoints ) setAccountData ( playeraccount, "wins", playerwins ) setAccountData ( playeraccount, "deaths", playerdeaths ) setAccountData ( playeraccount, "hunters", playerhunters ) setAccountData ( playeraccount, "lvl", playerlevels ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerpoints = getAccountData ( playeraccount, "points" ) local playerwins = getAccountData ( playeraccount, "wins" ) local playerdeaths = getAccountData ( playeraccount, "deaths" ) local playerhunters = getAccountData ( playeraccount, "hunters" ) local playerlevels = getAccountData ( playeraccount, "lvl" ) setElementData(source,"Points",playerpoints or 0) setElementData(source,"Wins",playerwins or 0) setElementData(source,"Deaths",playerdeaths or 0) setElementData(source,"Hunters",playerhunters or 0) setElementData(source,"lvl",playerlevels or 0) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) function checkForHunter(number,sort,model) thePlayer = source if sort == "vehiclechange" then if model == 425 then if getElementData(thePlayer,"playerGotHunter") == false then setElementData(thePlayer,"playerGotHunter",true) outputChatBox ( "#ff9900[iNFO] #c0c0c0"..getPlayerName(source).." #FFFFFFgot #c0c0c0(400)points #FFFFFFhunter bonus!", getRootElement(), 255, 255, 255, true ) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+400) setElementData(thePlayer,"Hunters",tonumber(getElementData(thePlayer,"Hunters"))+1) end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),checkForHunter) function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 local playerpoints = getElementData(source,"Points") local needexp = lvl * 35 local lvl = lvl + 1 if dPlayers + aPlayers >= 2 then local pointsForPlayer = math.floor((30/Position)*(dPlayers + aPlayers)) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) if Position == 1 then outputChatBox ("#ff9900[iNFO] #c0c0c01st #ffffffYou got #c0c0c0(" .. pointsForPlayer ..")points !",thePlayer,255,255,255,true) setElementData(thePlayer,"Wins",tonumber(getElementData(thePlayer,"Wins"))+1) if LastWinners[1] == "" then if LastWinners[2] == "" then if LastWinners[3] == "" then if LastWinners[4] == "" then if LastWinners[5] == "" then LastWiners[5] = thePlayer else LastWinners[4] = thePlayer end else LastWinners[3] = thePlayer end else LastWinners[2] = thePlayer end else LastWinners[1] = thePlayer end else LastWinners[5] = LastWinners[4] LastWinners[4] = LastWinners[3] LastWinners[3] = LastWinners[2] LastWinners[2] = LastWinners[1] LastWinners[1] = thePlayer end else outputChatBox ("#ff9900[iNFO]#ffffff You got #c0c0c0(" .. pointsForPlayer ..")points !",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[iNFO] #ffffffMinimum 2 players to get Points !",thePlayer,255,255,255,true) end if tonumber(playerpoints) == 10000 then setElementData(thePlayer, "lvl", "1") elseif tonumber(playerpoints) == 15000 then setElementData(thePlayer, "lvl", "2") elseif tonumber(playerpoints) == 25000 then setElementData(thePlayer, "lvl", "3") elseif tonumber(playerpoints) == 50000 then setElementData(thePlayer, "lvl", "4") elseif tonumber(playerpoints) == 60000 then setElementData(thePlayer, "lvl", "5") elseif tonumber(playerpoints) == 80000 then setElementData(thePlayer, "lvl", "6") elseif tonumber(playerpoints) == 100000 then setElementData(thePlayer, "lvl", "7") elseif tonumber(playerpoints) == 125000 then setElementData(thePlayer, "lvl", "8") elseif tonumber(playerpoints) == 130000 then setElementData(thePlayer, "lvl", "9") elseif tonumber(playerpoints) == 150000 then setElementData(thePlayer, "lvl", "10") elseif tonumber(playerpoints) == 200000 then setElementData(thePlayer, "lvl", "11") elseif tonumber(playerpoints) == 220000 then setElementData(thePlayer, "lvl", "12") elseif tonumber(playerpoints) == 250000 then setElementData(thePlayer, "lvl", "13") elseif tonumber(playerpoints) == 275720 then setElementData(thePlayer, "lvl", "14") elseif tonumber(playerpoints) == 305274 then setElementData(thePlayer, "lvl", "15") elseif tonumber(playerpoints) == 315247 then setElementData(thePlayer, "lvl", "16") elseif tonumber(playerpoints) == 332452 then setElementData(thePlayer, "lvl", "17") elseif tonumber(playerpoints) == 365785 then setElementData(thePlayer, "lvl", "18") elseif tonumber(playerpoints) == 400000 then setElementData(thePlayer, "lvl", "19") elseif tonumber(playerpoints) == 410000 then setElementData(thePlayer, "lvl", "20") elseif tonumber(playerpoints) == 427857 then setElementData(thePlayer, "lvl", "21") elseif tonumber(playerpoints) == 442787 then setElementData(thePlayer, "lvl", "22") elseif tonumber(playerpoints) == 485757 then setElementData(thePlayer, "lvl", "23") elseif tonumber(playerpoints) == 512547 then setElementData(thePlayer, "lvl", "24") elseif tonumber(playerpoints) == 520557 then setElementData(thePlayer, "lvl", "25") elseif tonumber(playerpoints) == 535757 then setElementData(thePlayer, "lvl", "26") elseif tonumber(playerpoints) == 555785 then setElementData(thePlayer, "lvl", "27") elseif tonumber(playerpoints) == 604854 then setElementData(thePlayer, "lvl", "28") elseif tonumber(playerpoints) == 622752 then setElementData(thePlayer, "lvl", "29") elseif tonumber(playerpoints) == 642785 then setElementData(thePlayer, "lvl", "30") elseif tonumber(playerpoints) == 747547 then setElementData(thePlayer, "lvl", "31") elseif tonumber(playerpoints) == 785757 then setElementData(thePlayer, "lvl", "32") elseif tonumber(playerpoints) == 855785 then setElementData(thePlayer, "lvl", "33") elseif tonumber(playerpoints) == 952000 then setElementData(thePlayer, "lvl", "34") elseif tonumber(playerpoints) == 1000000 then setElementData(thePlayer, "lvl", "35") end if lvls == needexp then outputChatBox("#ff9900* #c0c0c0".. getPlayerName(source).. " #ffffffis now #ffff00 Level. ".. lvl .." #ffffff!", getRootElement(), 0, 255, 0) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) function getAliveRacePlayers() local alivePlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive" then alivePlayers = alivePlayers + 1 end end return alivePlayers end function getDeadRacePlayers() local deadPlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "dead" then deadPlayers = deadPlayers + 1 end end return deadPlayers end Link to comment
TAPL Posted March 12, 2013 Share Posted March 12, 2013 شباب انا سويت مود عباره عن لفلات ونقاط واشياء ؟ Link to comment
iMr.Dawix~# Posted March 13, 2013 Share Posted March 13, 2013 شباب انا سويت مود عباره عن لفلات ونقاط واشياء ؟ Link to comment
TAPL Posted March 14, 2013 Share Posted March 14, 2013 ذي ملاحظة من الويكي https://wiki.multitheftauto.com/index.php?title=Resource:Race Events for version 0.8.3 Note: You may have to add the events in your script using addEvent() if you want to use them. و ذا الكود مدري وشي يبي addEvent("onPlayerWasted", true) Link to comment
#Al-Ha[J]aRii Posted March 14, 2013 Share Posted March 14, 2013 كودك في اغلاط كثيرة استخدم هذه البرنامج يساعدك في معرفة الاغلاط viewtopic.php?f=91&t=24834&hilit=MTA+Script+Editor Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now