X-SHADOW Posted March 28, 2012 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) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
Castillo Posted March 28, 2012 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
X-SHADOW Posted March 28, 2012 Author Posted March 28, 2012 how to make the weapon tabel iam not good in tables My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
Castillo Posted March 28, 2012 Posted March 28, 2012 -- Level = Weapon, Ammo. local weapons = { [ 1 ] = { 22, 500 }, [ 2 ] = { 24, 300 } } San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted March 28, 2012 Posted March 28, 2012 To get data from table: weapons [ levelID ] [ data id ] Example: outputChatBox ( weapons [ 1 ] [ 2 ] ) --> 500 EPT Team Server Development: 0% Learning C++ | C++ is amazing
X-SHADOW Posted March 28, 2012 Author 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 }, My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted March 28, 2012 Posted March 28, 2012 giveWeapon ( player, weapons [ level ] [ 1 ], weapons [ level ] [ 2 ] ); You need change it. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted March 28, 2012 Posted March 28, 2012 You can also use: unpack San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
X-SHADOW Posted March 28, 2012 Author 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 .. My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted March 28, 2012 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 ] ) EPT Team Server Development: 0% Learning C++ | C++ is amazing
X-SHADOW Posted March 28, 2012 Author Posted March 28, 2012 iam using getElementData and setElementData can i use this if source == ('Level 1') then giveWeapon outputChatBox('You Got ..') elseif ... My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted March 28, 2012 Posted March 28, 2012 No. giveWeapon ( player, weapons [ getElementData ( player, 'Level' ) ] [ 1 ], weapons [ getElementData ( player, 'Level' ) ] [ 2 ] ) outputChatBox ( 'You got...' ); EPT Team Server Development: 0% Learning C++ | C++ is amazing
X-SHADOW Posted March 28, 2012 Author Posted March 28, 2012 Darken can i use triggerServerEvent For Client ? My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted March 28, 2012 Posted March 28, 2012 Maybe. Show a example. EPT Team Server Development: 0% Learning C++ | C++ is amazing
X-SHADOW Posted March 28, 2012 Author 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 My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted March 28, 2012 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 ) EPT Team Server Development: 0% Learning C++ | C++ is amazing
X-SHADOW Posted March 28, 2012 Author 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 ) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
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