Evil-Cod3r Posted February 9, 2012 Posted February 9, 2012 Hi all i have Made This but the Problem when i restart the Script Level and Exp will be set 0 and all what i have been gained wll gone even if it login or logout 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) triggerClientEvent ( killer, "playSound" , killer ) if tonumber(H) == 30 then setElementData(killer, "Level", "Lvl 1 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 55 then setElementData(killer, "Level", "Lvl 2 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 75 then setElementData(killer, "Level", "Lvl 3 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 85 then setElementData(killer, "Level", "Lvl 4 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 95 then setElementData(killer, "Level", "Lvl 5 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 120 then setElementData(killer, "Level", "Lvl 6 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 150 then setElementData(killer, "Level", "Lvl 7 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 230 then setElementData(killer, "Level", "Lvl 8 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 350 then setElementData(killer, "Level", "Lvl 9 !") triggerClientEvent ( killer, "playSound" , killer ) elseif tonumber(H) == 500 then triggerClientEvent ( killer, "playSound" , killer ) setElementData(killer, "Level", "Lvl 10 !") 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 in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Castillo Posted February 9, 2012 Posted February 9, 2012 Try this: exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[30] = 1, [55] = 2, [75] = 3, [85] = 4, [95] = 5, [120] = 6, [150] = 7, [230] = 8, [350] = 9, [500] = 10} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "EXP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "EXP", tonumber(H)+1) triggerClientEvent ( killer, "playSound" , killer ) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. levels[tonumber(H)] .." !") triggerClientEvent ( killer, "playSound" , killer ) 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 saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "EXP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Evil-Cod3r Posted February 9, 2012 Author Posted February 9, 2012 i got problem with the the first thing It show the Leve :false ExP:false Total Exp :Fale why ? and the sound for level up is it Play for level or every time i got +1Exp ?? function levelup () local Exp = getElementData(localPlayer,"ExP") local Level = getElementData(localPlayer,"Level") if isElement(expLabel) then destroyElement(expLabel) end expLabel = guiCreateLabel(0.777,0.22,0.1708,0.0963,"ExP gained: ??\nTotal ExP: ".. tostring(Exp) .."\nLevel: ".. tostring(Level),true) guiLabelSetColor(expLabel,0,255,0) guiLabelSetVerticalAlign(expLabel,"top") guiLabelSetHorizontalAlign(expLabel,"left",false) guiSetFont(expLabel,"clear-normal") end setTimer ( levelup, 2000, 1) exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[30] = 1, [55] = 2, [75] = 3, [85] = 4, [95] = 5, [120] = 6, [150] = 7, [230] = 8, [350] = 9, [500] = 10} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "ExP", tonumber(H)+1) triggerClientEvent ( killer, "playSound" , killer ) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. levels[tonumber(H)] .." !") triggerClientEvent ( killer, "playSound" , killer ) 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 saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Evil-Cod3r Posted February 9, 2012 Author Posted February 9, 2012 Please small help to finsh my gameMode My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Castillo Posted February 9, 2012 Posted February 9, 2012 -- client side: function levelup () local Exp = getElementData(localPlayer,"ExP") local Level = getElementData(localPlayer,"Level") if isElement(expLabel) then destroyElement(expLabel) end expLabel = guiCreateLabel(0.777,0.22,0.1708,0.0963,"ExP gained: ??\nTotal ExP: ".. tostring(Exp) .."\nLevel: ".. tostring(Level),true) guiLabelSetColor(expLabel,0,255,0) guiLabelSetVerticalAlign(expLabel,"top") guiLabelSetHorizontalAlign(expLabel,"left",false) guiSetFont(expLabel,"clear-normal") setTimer ( levelup, 2000, 1) end setTimer ( levelup, 2000, 1) -- server side: exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[30] = 1, [55] = 2, [75] = 3, [85] = 4, [95] = 5, [120] = 6, [150] = 7, [230] = 8, [350] = 9, [500] = 10} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "ExP", tonumber(H)+1) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." !") triggerClientEvent ( killer, "playSound", killer ) 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 saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted June 24, 2013 Posted June 24, 2013 And if i want to get player level or exp ? If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted June 24, 2013 Posted June 24, 2013 Just use getElementData. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted June 24, 2013 Posted June 24, 2013 ok If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted June 25, 2013 Posted June 25, 2013 function getRep ( source, commandName, playerName ) if ( playerName ) then thePlayer = getPlayerFromName ( playerName ) if ( thePlayer ) then local ExP = getElementData(localPlayer,"ExP" ) outputChatBox ( getPlayerName ( thePlayer ).." Reputation is "..ExP" !", source ) else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) end end addCommandHandler ( "getrep", getRep ) Like that ? i want this only for exp If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted June 25, 2013 Posted June 25, 2013 function getRep ( source, commandName, playerName ) if ( playerName ) then local thePlayer = getPlayerFromName ( playerName ) if ( thePlayer ) then local ExP = getElementData ( thePlayer, "ExP" ) outputChatBox ( getPlayerName ( thePlayer ) .." Reputation is ".. ExP "!", source ) else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) end end end addCommandHandler ( "getrep", getRep ) You had a missing 'end' and used 'localPlayer' instead of 'thePlayer' at getElementData. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted June 25, 2013 Posted June 25, 2013 Ok thanks If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted June 25, 2013 Posted June 25, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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