RdX Posted May 11, 2014 Share Posted May 11, 2014 السلام عليكم ورحمة الله وبركاته انا سويت سكربت - Points و سويت في الاسكور بورد Levels لكن ابيه اذا اخذ 500 بوينت يحطه في الاسكور بورد 1 3000 نقطه يخليه لفل 2 و زي كذا ممكن تسوون لي الكود واسم الالمنت حق البوينت Points Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 اول شي حنا هنا ما نعطي اكواد كاملة + انت تقول سويت الكود لكن عندك مشكلة، طيب اطرح الكود ونساعدك + Level in Scripting : 37% المفروض تعرف تسوي المود وتحل مشاكله كلها اذا كان هذا لفلك ذذ Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 هي مهيب مشكله انا ابيه يتأأكد ان عنده 250 نقطه و اذا عنده 250 نقطه يزيد لفل في الاسكور Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 انت كذا تحتاج الى اثنين من الالمنت داتا واحد سويته انت الي هو حق النقاط وواحد ثاني الي هو حق لفل النقاط بعدين تقدر تسوي فنكشن تمرر له اللاعب وهو يشوف نقاطه ويحط له لفل هذا مثال function updatePlayerRank ( player ) if ( isElement(player) ) and ( getElementType( player ) == "player" ) then local points = getElementData( player, "Points" ) or 0 local rank = "Level 0" if ( points >= 200 ) then rank = "Level 1" end if ( points >= 400 ) then rank = "Level 2" end if ( points >= 600 ) then rank = "Level 3" end setElementData ( player, "Rank", rank ) end end طبعا الكود ما يعتبر احترافي، واذا تبي تزيد عدد اللفلات، سوي تشييك مثل ما سويت انا حق لفل 1 و 2 و3 Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 انت كذا تحتاج الى اثنين من الالمنت داتا واحد سويته انت الي هو حق النقاط وواحد ثاني الي هو حق لفل النقاط بعدين تقدر تسوي فنكشن تمرر له اللاعب وهو يشوف نقاطه ويحط له لفل هذا مثال function updatePlayerRank ( player ) if ( isElement(player) ) and ( getElementType( player ) == "player" ) then local points = getElementData( player, "Points" ) or 0 local rank = "Level 0" if ( points >= 200 ) then rank = "Level 1" end if ( points >= 400 ) then rank = "Level 2" end if ( points >= 600 ) then rank = "Level 3" end setElementData ( player, "Rank", rank ) end end طبعا الكود ما يعتبر احترافي، واذا تبي تزيد عدد اللفلات، سوي تشييك مثل ما سويت انا حق لفل 1 و 2 و3 طيب الحين احط الالمنت حق الاسكور بورد Rank ? + اذا جاب 600 نقطه يكتب في الاسكور لفل 3 ؟ Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 ما صار شيء ما يزيد زي ما هو0 Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 (edited) مررت اللاعب الي تبيه على الفنكشن ولا لا؟؟؟ الداتا حقينك نفسها حقين الفنكشن ولا لا؟؟ Edited May 11, 2014 by Guest Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 totallevel = guiCreateLabel(200,280,120,16,"",false,statswin) guiSetFont(totallevel,"default-bold-small") addEventHandler( "onClientGUIClick", resourceRoot, function( ) if ( source == gridOnlinePlayers ) then if ( guiGridListGetSelectedItem ( source ) ~= -1 ) then guiSetText( totallevel, "Levels : "..tonumber( getElementData ( getPlayerFromName( guiGridListGetItemData ( source, guiGridListGetSelectedItem ( source ), 1 ) ), "Rank" ) or 0 ) ) end end end ) Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 اخوي واضح انك ما طرحت كودك كامل، لكذا انا مدري هل انت مررت اللاعب على الفنكشن ولا لا لازم تمرر اللاعب على الفنكشن كل ما تعطي اللاعب نقاط Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 كل شيء كويس نقاطي 6000 الاف لكن الافل يقعد 0 Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 مررت اللاعب الي تبيه على الفنكشن ولا لا؟؟؟ الداتا حقينك نفسها حقين الفنكشن ولا لا؟؟ جاوب على الاسئلة عشان اعرف وش مشكلتك Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 لازم كل ما تعطي اللاعب نقاط انك تستدعي هذا الفنكشن تستدعيه كذا updatePlayerRank ( player ) تحطه على طول بعد ما تعطي اللاعب نقاط اذا ما تعرف، اطرح كودك كامل Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 ---ServerSide function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 if dPlayers + aPlayers >= 1 then local cashForPlayer = math.floor((1000/Position)*(dPlayers + aPlayers)) local pointsForPlayer = math.floor((150/Position)*(dPlayers + aPlayers)) givePlayerMoney(thePlayer,cashForPlayer) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) if Position == 1 then outputChatBox ("#ff9900[system] #ffffff1st! You got #FFFFFF" .. pointsForPlayer .." #FFFFFFPoints #abcdefAnd Won #FFFFFF" .. cashForPlayer .."$",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 LastWinners[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[system] #ffffffYou got #FFFFFF" .. pointsForPlayer .." #FFFFFFpoints #abcdefand #FFFFFF" .. cashForPlayer .."$",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[system] #ffffffMinimum 2 players to get stats and cash!",thePlayer,255,255,255,true) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 ---ServerSide function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 if dPlayers + aPlayers >= 1 then local cashForPlayer = math.floor((1000/Position)*(dPlayers + aPlayers)) local pointsForPlayer = math.floor((150/Position)*(dPlayers + aPlayers)) givePlayerMoney(thePlayer,cashForPlayer) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) updatePlayerRank ( thePlayer ) if Position == 1 then outputChatBox ("#ff9900[system] #ffffff1st! You got #FFFFFF" .. pointsForPlayer .." #FFFFFFPoints #abcdefAnd Won #FFFFFF" .. cashForPlayer .."$",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 LastWinners[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[system] #ffffffYou got #FFFFFF" .. pointsForPlayer .." #FFFFFFpoints #abcdefand #FFFFFF" .. cashForPlayer .."$",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[system] #ffffffMinimum 2 players to get stats and cash!",thePlayer,255,255,255,true) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 الظاهر انك ما حطيت الكود الرئيسي مع الاكواد + تحتاح تسوي تايمر تحدث فيه الـ label ---ServerSide function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 if dPlayers + aPlayers >= 1 then local cashForPlayer = math.floor((1000/Position)*(dPlayers + aPlayers)) local pointsForPlayer = math.floor((150/Position)*(dPlayers + aPlayers)) givePlayerMoney(thePlayer,cashForPlayer) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) updatePlayerRank ( thePlayer ) if Position == 1 then outputChatBox ("#ff9900[system] #ffffff1st! You got #FFFFFF" .. pointsForPlayer .." #FFFFFFPoints #abcdefAnd Won #FFFFFF" .. cashForPlayer .."$",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 LastWinners[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[system] #ffffffYou got #FFFFFF" .. pointsForPlayer .." #FFFFFFpoints #abcdefand #FFFFFF" .. cashForPlayer .."$",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[system] #ffffffMinimum 2 players to get stats and cash!",thePlayer,255,255,255,true) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) function updatePlayerRank ( player ) if ( isElement(player) ) and ( getElementType( player ) == "player" ) then local points = getElementData( player, "Points" ) or 0 local rank = "Level 0" if ( points >= 200 ) then rank = "Level 1" end if ( points >= 400 ) then rank = "Level 2" end if ( points >= 600 ) then rank = "Level 3" end setElementData ( player, "Rank", rank ) end end Link to comment
RdX Posted May 11, 2014 Author Share Posted May 11, 2014 ---ClientSide totallevel = guiCreateLabel(200,280,120,16,"",false,statswin) guiSetFont(totallevel,"default-bold-small") addEventHandler( "onClientGUIClick", resourceRoot, function( ) if ( source == gridOnlinePlayers ) then if ( guiGridListGetSelectedItem ( source ) ~= -1 ) then guiSetText( totallevel, "Levels : "..tonumber( getElementData ( getPlayerFromName( guiGridListGetItemData ( source, guiGridListGetSelectedItem ( source ), 1 ) ), "Ranks" ) or 0 ) ) end end end ) ---ServerSide function onPlayerDeadInRace() local thePlayer = source local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local Position = aPlayers + 1 if dPlayers + aPlayers >= 1 then local cashForPlayer = math.floor((1000/Position)*(dPlayers + aPlayers)) local pointsForPlayer = math.floor((150/Position)*(dPlayers + aPlayers)) givePlayerMoney(thePlayer,cashForPlayer) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+pointsForPlayer) updatePlayerRank ( thePlayer ) if Position == 1 then outputChatBox ("#ff9900[system] #ffffff1st! You got #FFFFFF" .. pointsForPlayer .." #FFFFFFPoints #abcdefAnd Won #FFFFFF" .. cashForPlayer .."$",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 LastWinners[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[system] #ffffffYou got #FFFFFF" .. pointsForPlayer .." #FFFFFFpoints #abcdefand #FFFFFF" .. cashForPlayer .."$",thePlayer,255,255,255,true) setElementData(thePlayer,"Deaths",tonumber(getElementData(thePlayer,"Deaths"))+1) end else outputChatBox("#ff9900[system] #ffffffMinimum 2 players to get stats and cash!",thePlayer,255,255,255,true) end end addEvent("onPlayerWasted", true) addEventHandler("onPlayerWasted", gRoot , onPlayerDeadInRace) function updatePlayerRank ( player ) if ( isElement(player) ) and ( getElementType( player ) == "player" ) then local points = getElementData( player, "Points" ) or 0 local rank = "Level 0" if ( points >= 200 ) then rank = "Level 1" end if ( points >= 400 ) then rank = "Level 2" end if ( points >= 600 ) then rank = "Level 3" end setElementData ( player, "Ranks", rank ) end end Link to comment
Bssol Posted May 11, 2014 Share Posted May 11, 2014 ماشوف اخطاء في الكود جرب اقتل نفسك في السباق وشوف يتحدث ولا لا 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