X-SHADOW Posted March 28, 2012 Share Posted March 28, 2012 Hi all i just made this but there is 3 problems #1 is i how to make outputChatBox(playerName His Level is Up! and his level is ".. level) #2 when i restart my gamemode all players level and exp turn to 0 #3 if player level == 1 then givePlayerWeapon(playerName.. "Has Got .. For Rising his Level to ..) exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") function win(ammo, killer, weapon, bodypart) local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) if killer and killer ~= source then setElementData(killer, "ExP", tonumber(H)+1) if tonumber(H) == 50 then setElementData(killer, "Level", "Lvl 1 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 65 then setElementData(killer, "Level", "Lvl 2 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 75 then setElementData(killer, "Level", "Lvl 3 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 95 then setElementData(killer, "Level", "Lvl 4 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 120 then setElementData(killer, "Level", "Lvl 5 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 250 then setElementData(killer, "Level", "Lvl 6 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 370 then setElementData(killer, "Level", "Lvl 7 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 420 then setElementData(killer, "Level", "Lvl 8 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 560 then setElementData(killer, "Level", "Lvl 9 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 1000 then triggerClientEvent ( killer, "playSound" , killer ) setElementData(killer, "Level", "Lvl 10 !") outputChatBox(noob.. "Has Level is Up !".. S,getRootElement(), 255,255,0) end outputChatBox(killer1 .. " Killed " .. noob .. " and gained +1 ExP ", getRootElement(), 255, 255, 0, false) end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "Level 0 !") setElementData(source, "ExP", getAccountData(account, "exp") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function onQuit() local account = getPlayerAccount(source) if not account then return end if not isGuestAccount(account) then setAccountData (account, "lvl", getElementData(source, "Level")) setAccountData (account, "exp", getElementData(source, "ExP")) end end addEventHandler ("onPlayerQuit", root, onQuit) Link to comment
Castillo Posted March 28, 2012 Share Posted March 28, 2012 1: You already output the new level, I think. 2: You may have something setting the element data each time the resource starts. 3: You could make a table of weapons, if the level is on the table, give the weapon. Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 how to make the weapon tabel iam not good in tables Link to comment
Castillo Posted March 28, 2012 Share Posted March 28, 2012 -- Level = Weapon, Ammo. local weapons = { [ 1 ] = { 22, 500 }, [ 2 ] = { 24, 300 } } Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 To get data from table: weapons [ levelID ] [ data id ] Example: outputChatBox ( weapons [ 1 ] [ 2 ] ) --> 500 Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 i have made the table how to give weapons now ? its 12 level i konw local weapons = { [ 1 ] = { 22, 13 }, [ 2 ] = { 12, 13 }, [ 3] = {14 , 13 }, [ 4 ] = { 22, 13 }, [ 5 ] = { 12, 13 }, [ 6] = {14 , 13 }, [ 7 ] = { 22, 13 }, [ 8 ] = { 12, 13 }, [ 9] = {14 , 13 }, [ 10 ] = { 22, 13 }, [ 11 ] = { 12, 13 }, [ 12] = {14 , 13 }, Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 giveWeapon ( player, weapons [ level ] [ 1 ], weapons [ level ] [ 2 ] ); You need change it. Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 i cant use like this If source == 'Level 1' then giveWeapon.. its hard What Darken post and you post iam not that Epx .. Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 What you're using for levels? Element Data? SQL? Account data? It's easy: giveWeapon -> give the weapon player -> The player you want to give the weapon weapons [ 1 ] [ 2 ] -> weapons // table - [ 1 ] // index ( level id ) - [ 2 ] // data 2 in table of index [ 1 ] etc You can simply use like Solidsnake said: giveWeapon ( player, unpack ( weapons [ level ] ) Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 iam using getElementData and setElementData can i use this if source == ('Level 1') then giveWeapon outputChatBox('You Got ..') elseif ... Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 No. giveWeapon ( player, weapons [ getElementData ( player, 'Level' ) ] [ 1 ], weapons [ getElementData ( player, 'Level' ) ] [ 2 ] ) outputChatBox ( 'You got...' ); Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 Darken can i use triggerServerEvent For Client ? Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 addEvent ( "Levelup", true ) addEventHandler( "Levelup", root, function() getElementData(source,"theLevel") if source == 'Level1') then --i want his name like this [Level 1] [Darken] if he write in chat any thing and every level like this eath leve he got he write in chat like this [Level] and [His NameHere] just skip the giveWeapon Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 Oh. addEvent ( 'levelUp', true ); addEventHandler ( 'levelUp', root, function ( ) if ( getElementData ( source, 'theLevel' ) == 'Level1' ) then outputChatBox ( 'dafuq', source, 255, 255, 255, false ); end end ) Link to comment
X-SHADOW Posted March 28, 2012 Author Share Posted March 28, 2012 no like this if getElementData triggerServerEvent and give weapon ServerSide --- addEvent ( 'levelUpWeapon', true ); addEventHandler ( 'levelUpWeapon', root, exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") function win(ammo, killer, weapon, bodypart) local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) if killer and killer ~= source then setElementData(killer, "ExP", tonumber(H)+1) if tonumber(H) == 50 then setElementData(killer, "Level", "Lvl 1 !") outputChatBox(noob.. "Has Level is Up !".. S "And Now Got Weapon "..weaponName..",getRootElement(), 255,255,0) triggerClientEvent ( killer, "playSound" , killer ) giveWeapon ( source, 31, 15 ) ClientSide--- function ( ) if ( getElementData ( source, 'theLevel' ) == 'Level1' ) then triggerServerEvent ( killer,"levelUpWeapon", killer) end end ) 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