-
Posts
451 -
Joined
-
Last visited
ZeyadGTX's Achievements
Hustler (26/54)
0
Reputation
-
TorNix~|nR started following ZeyadGTX
-
Stolen From Grafuroam's Client Files. Delete : https://community.multitheftauto.com/in ... ls&id=9391 https://community.multitheftauto.com/in ... ls&id=9710 DONE
-
if you mean yes the player LV data doesn't return false the problem isn't from the code because its work fine for me setElementData(root,'EXP',50) setElementData(root,'LV',3) levelUpTable = { -- required experience to level up,e.g if someone is level 1 he would need 500 xp to level up [0] = "100", [1] = "500", [2] = "1000", [3] = "2000" } function levelRequired() local XP = getElementData(localPlayer,"EXP") local LV = getElementData(localPlayer,"LV") dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV], 0, 0, sWidth, sHeight, tocolor(255, 0, 0, 255), (0.8/720)*sHeight, "bankgothic", "center", "center", false, false, true, true, false) end addEventHandler("onClientRender",root,levelRequired) try it to be sure that the problem not from ur code ( i just add 2 lines to test it ) The player XP sets to 50 and his level is 3 when the player joins that means that it works but what's wrong !!
-
Server side function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "EXP") or 0 local S = getElementData(killer, "LV") or 0 local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local experience = math.random(25, 100) setElementData(killer, "EXP", tonumber(H)+experience) local H = tonumber(H) + experience triggerClientEvent(killer, "onTestExp", killer, experience) if (tonumber(H) >= 100 and tonumber(H) <=400) then setElementData(killer, "LV", 1) setElementData(killer, "experience.rank", "Private") elseif (tonumber(H) >= 401 and tonumber(H) <=600) then setElementData(killer, "LV", 2) elseif (tonumber(H) >= 601 and tonumber(H) <=800) then setElementData(killer, "LV", 3) elseif (tonumber(H) >= 801 and tonumber(H) <=1000) then setElementData(killer, "LV", 4) end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "LV", getAccountData(account, "LV") or "0") setElementData(source, "EXP", getAccountData(account, "EEXP") or "0") setElementData(source, "player.key", getAccountData(account, "player.key") or "Guest") setElementData(source, "experience.rank", getAccountData(account, "experience.rank") or "Guest") end addEventHandler ("onPlayerLogin", root, onLogin) function onLogout (_,account) setElementData(source, "LV", 0) setElementData(source, "EXP", 0) setElementData(source, "experience.rank", "Newbie") setElementData(source, "player.key", "Guest") end addEventHandler ("onPlayerLogout", root, onLogout) function saveData(thePlayer, theAccount) local theAccount = getPlayerAccount(source) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "LV")) setAccountData (theAccount, "EEXP", getElementData(thePlayer, "EXP")) setAccountData (theAccount, "experience.rank", getElementData(thePlayer, "experience.rank")) setAccountData (theAccount, "player.key", getElementData(thePlayer, "player.key")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function () saveData(source, getPlayerAccount(source)) end) --addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) addCommandHandler ( "setxp", function ( thePlayer, _, who, EXP ) if getElementData(thePlayer, "player.key") == "Zeyad" then if ( who ) then local EXP = tonumber (EXP) or 0 local ThePlayer = getPlayerFromParticalName ( who ) if ( ThePlayer ) then setElementData( ThePlayer,"EXP",EXP ) outputChatBox("Your XP has been set to "..EXP, ThePlayer, 255, 0, 0, true) else outputChatBox("Couldn't find '"..who.."'", thePlayer, 255, 0, 0, true) end else outputChatBox("Couldn't find '"..who.."'", thePlayer, 255, 0, 0, true) end end end ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "experience.rank" and oldValue then local newValue = getElementData(source,dataName) outputChatBox("Congratulations ! Your rank is #FFFFFF'"..tostring(newValue).."'",source, 255, 0, 0, true) triggerClientEvent(source, "onClientRankUp", source) end end addEventHandler("onElementDataChange",getRootElement(),outputChange) addEventHandler("onPlayerLogin", root, function(_, account) if not getAccountData(account, "player.key") then setElementData(source, "player.key", getAccountName(account)) setAccountData(account, "player.key", getElementData(source, "player.key")) else end end) addEvent("addToTeam", true) addEventHandler("addToTeam", root, function (playername, teamname) local player = getPlayerFromName(playername or "") local team = getTeamFromName(teamname or "") if player and team then local r, g, b = getTeamColor ( team ) setPlayerTeam(player, team) setPlayerNametagColor ( player, r, g, b ) outputChatBox("You've been added to #FFFFFF"..getTeamName(team).."#006400", player, 255, 0, 0, true) end end) addEvent("kickFromTeam", true) addEventHandler("kickFromTeam", root, function (playername, teamname) local player = getPlayerFromName(playername or "") local team = getTeamFromName(teamname or "") if player and team then local red, green, blue = math.random (50, 255), math.random (50, 255), math.random (50, 255) setPlayerTeam(player, nil) setPlayerNametagColor(player, red, green, blue) outputChatBox("You've been kicked from #FFFFFF"..getTeamName(team).."#FF0000.", player, 255, 0, 0, true) end end) addEvent("promotePlayer",true) addEventHandler("promotePlayer",root, function(playername, rank) local player = getPlayerFromName(playername or "") if player then if rank then setElementData(player, "clan.rank", rank) outputChatBox("You Have Been promoted To A #FFFFFF"..tostring(rank), player, 255, 0, 0, true) end end end) addEvent("DemotePlayer",true) addEventHandler("DemotePlayer",root, function(playername, rank) local player = getPlayerFromName(playername or "") if player then if rank then setElementData(player, "clan.rank", rank) outputChatBox("You Have Been Demoted To A #FFFFFF"..tostring(rank), player, 255, 0, 0, true) end end end) function loopFix( thePlayer, _, who, lossp ) if getElementData(thePlayer, "player.key") == "Zeyad" then if ( who ) then local LossC = tonumber (lossp) or 0 local ThePlayer = getPlayerFromParticalName ( who ) if ( ThePlayer ) then setElementData( ThePlayer,"EXP",LossC ) end end end end addCommandHandler ( "fixbug", loopFix) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end
-
He is using the bugged version that i have made along time ago I edited it and made it like Groam once There is no Errors in debug
-
ahh same problem not working anyway fuck this idea i started to get bored levelUpTable = { -- required experience to level up,e.g if someone is level 1 he would need 500 xp to level up [0] = "100", [1] = "500", [2] = "1000", [3] = "2000" } function levelRequired() local XP = getElementData(localPlayer,"EXP") local LV = getElementData(localPlayer,"LV") dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV], sWidth*(400/1280), sHeight*(500/720), sWidth*(621/1280), sHeight*(715/720), tocolor(255, 0, 0, 255), (0.8/720)*sHeight, "bankgothic", "left", "top", false, false, true, true, false) end addEventHandler("onClientRender",root,levelRequired)
-
dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV], sWidth*(400/1280), sHeight*(500/720), sWidth*(621/1280), sHeight*(715/720), tocolor(255, 0, 0, 255), (0.8/1280)*sWidth,(0.8/720)*sHeight,"left", "top", false, false, true, true, false)
-
You mean like this : dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV], sWidth*(400/1280), sHeight*(500/720), sWidth*(621/1280), sHeight*(715/720), tocolor(0, 0, 0, 255), (0.8/1280)*sWidth,(0.8/720)*sHeight,"bankgothic", "left", "top", false, false, true, true, false)
-
btw i use this Function to draw my texts in my hud and it works
-
See levelUpTable = { [0] = "100", [1] = "200", [2] = "800", [3] = "1600" } function levelRequired() local XP = getElementData(localPlayer, "EXP") local LV = getElementData(localPlayer, "LV") dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV], sWidth*(900/1280), sHeight*(689/720), sWidth*(621/1280), sHeight*(715/720), tocolor(255, 255, 255, 255), (0.8/1280)*sWidth,(0.8/720)*sHeight,"bankgothic", "left", "top", false, false, true, true, false) end addEventHandler("onClientRender",root,levelRequired)
-
Cl.lua : 12 Attempt to concatenate Field "?" a nil value Debug Says
-
I made client File and Server file in my experience file both didn't work what shall i do ? local sw,sh = guiGetScreenSize() levelUpTable = { [1] = "200", [2] = "800", [3] = "1600" } function levelRequired() local XP = getElementData(localPlayer, "EXP") or 0 local LV = getElementData(localPlayer, "LV") or 0 dxDrawText("LV: "..LV.." XP: "..XP.."/"..levelUpTable[LV],sw/2,sh/2,sw,sh,tocolor(255,255,255)) end addEventHandler("onClientRender",root,levelRequired)