SAM!! Posted July 1, 2018 Share Posted July 1, 2018 xAddToGroupFunction_ = function ( Group,Price,Level ) local account = getAccountName(getPlayerAccount(source)); if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("#You must register first",source,255,0,0,true); end if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("#You have this rank, please choose another class",source,0,255,255,true); end ----------------------time--------------------------- local sValue = getElementData( source,'PlayTime' ) if not sValue then sValue = '0:0:0' end local data = split(sValue,':') local hour = tonumber( data[1] ) if hour == nil or not tonumber(hour) then hour = 0 end if ( hour >= tonumber(Price)) then ------------------------------------------------- ----------------------level--------------------------- local sValue = getElementData( source,'Level' ) if not sValue then sValue = 'Level' end local data = split(sValue,':') local Level = tonumber( data[1] ) if Level == nil or not tonumber(Level) then Level = 0 end if ( Level >= tonumber(Level)) then ------------------------------------------------- aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account); outputChatBox("#Rank has been added successfully "..Name,source,255,0,0,true); else outputChatBox("#You do not have enough hours",source,0,255,255,true); end end addEvent("Accept:the:request",true) addEventHandler("Accept:the:request",root,xAddToGroupFunction_) ذي شرا رتب بالساعات واللفلات تقريبا الفلات خربانة يرجي التصحيح Link to comment
SAM!! Posted July 1, 2018 Author Share Posted July 1, 2018 @Rakan# لو مشان الداتا فالداتا حق اللفل ابيها Level Link to comment
Rakan# Posted July 1, 2018 Share Posted July 1, 2018 لآ ... هل هو جدول او لا الداتا حقت اللفل اظن مو جدول لذا جرب كذا xAddToGroupFunction_ = function ( Group,Price,Level ) local account = getAccountName(getPlayerAccount(source)); if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("#You must register first",source,255,0,0,true); end if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("#You have this rank, please choose another class",source,0,255,255,true); end ----------------------time--------------------------- local sValue = getElementData( source,'PlayTime' ) if not sValue then sValue = '0:0:0' end local data = split(sValue,':') local hour = tonumber( data[1] ) if hour == nil or not tonumber(hour) then hour = 0 end if ( hour >= tonumber(Price)) then ------------------------------------------------- ----------------------level--------------------------- local sValue = getElementData( source,'Level' ) if not sValue then sValue = '0' end -- local data = split(sValue,':') local Level = tonumber( sValue ) if Level == nil or not tonumber(Level) then Level = 0 end if ( Level >= tonumber(Level)) then ------------------------------------------------- aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account); outputChatBox("#Rank has been added successfully "..Name,source,255,0,0,true); else outputChatBox("#You do not have enough hours",source,0,255,255,true); end end addEvent("Accept:the:request",true) addEventHandler("Accept:the:request",root,xAddToGroupFunction_) Link to comment
SAM!! Posted July 1, 2018 Author Share Posted July 1, 2018 Rakan# لم تظبط ووالمود صار مايضيف اي شئ بالاسل اكواد سيرفر مود اللفل setTimer (function(player) local account = getPlayerAccount (player) if not (isGuestAccount (account)) then local accountData = getAccountData (account, "Level") if (accountData)then setElementData(player,"Money",accountData+99000) end end end,0,500) addEventHandler("onResourceStart", resourceRoot, function() DataBase = dbConnect("sqlite", "save.db") dbExec(DataBase, "CREATE TABLE IF NOT EXISTS LevelSystem1 (AccName, Level, XP)") for i, v in ipairs(getElementsByType("player")) do --[[if not ( isGuestAccount ( getPlayerAccount ( v ) ) ) then local SqlTable = dbPoll(dbQuery(DataBase, "SELECT * FROM LevelSystem1 WHERE AccName = ?", getAccountName(getPlayerAccount(v))), -1) if SqlTable and type(SqlTable) == "table" and #SqlTable > 0 then setElementData(v, "Level", SqlTable[1]["Level"]) setElementData(v, "xp", SqlTable[1]["XP"]) local account = getPlayerAccount(v) setAccountData(account, "Level", SqlTable[1]["Level"]) setAccountData(account, "xp", SqlTable[1]["XP"]) else setElementData(v, "Level", 1) setElementData(v, "xp", 0) local account = getPlayerAccount(v) setAccountData(account, "Level", 0) setAccountData(account, "xp", 0) end end]] local account = getPlayerAccount (v) if not (isGuestAccount (account)) then local accountData = getAccountData (account, "Level") local accountData2 = getAccountData (account, "xp") if (accountData) and (accountData2) then local playerLevel = getAccountData(account, "Level") local playerxp = getAccountData(account, "xp") setElementData(v,"Level",tonumber(playerLevel)) setElementData(v,"xp",tonumber(playerxp)) else setElementData(v,"Level",1) setElementData(v,"xp",0) end end end end ) addEventHandler("onResourceStop", resourceRoot, function() for i, v in ipairs(getElementsByType("player")) do if not ( isGuestAccount ( getPlayerAccount ( v ) ) ) then local SqlTable = dbPoll(dbQuery(DataBase, "SELECT * FROM LevelSystem1 WHERE AccName = ?", getAccountName(getPlayerAccount(v))), -1) if SqlTable and type(SqlTable) == "table" and #SqlTable > 0 then dbExec(DataBase, "UPDATE LevelSystem1 SET Level = ?, XP = ? WHERE AccName = ?",( getElementData( v, 'Level') or 0 ) ,( getElementData( v, 'xp') or 0 ), getAccountName(getPlayerAccount(v))) else dbExec(DataBase, "INSERT INTO LevelSystem1 ( Level,XP,AccName ) VALUES(?,?,?)", 1, 0, getAccountName(getPlayerAccount(v))) end end local account = getPlayerAccount (v) if not (isGuestAccount (account)) then local playerLevel = getElementData(v, "Level") or 0 local playerxp = getElementData(v, "xp") or 0 if playerLevel and playerxp then setAccountData(account,"Level",tonumber(playerLevel)) setAccountData(account,"xp",tonumber(playerxp)) end end end end ) addEventHandler( 'onPlayerLogin', root, function( _, acc ) --[[local SqlTable = dbPoll(dbQuery(DataBase, "SELECT * FROM LevelSystem1 WHERE AccName = ?", getAccountName(getPlayerAccount(source))), -1) if SqlTable and type(SqlTable) == "table" and #SqlTable > 0 then setElementData(source, "Level", SqlTable[1]["Level"]) setElementData(source, "xp", SqlTable[1]["XP"]) setAccountData(getPlayerAccount(source), "Level", SqlTable[1]["Level"]) setAccountData(getPlayerAccount(source), "xp", SqlTable[1]["XP"]) else setElementData(source, "Level", 1) setElementData(source, "xp", 0) setAccountData(getPlayerAccount(source), "Level", 1) setAccountData(getPlayerAccount(source), "xp", 0) end]] local account = getPlayerAccount (source) if not (isGuestAccount (account)) then local accountData = getAccountData (account, "Level") local accountData2 = getAccountData (account, "xp") if (accountData) and (accountData2) then local playerLevel = getAccountData(account, "Level") local playerxp = getAccountData(account, "xp") setElementData(source,"Level",tonumber(playerLevel)) setElementData(source,"xp",tonumber(playerxp)) else setElementData(source,"Level",1) setElementData(source,"xp",0) end end end ) addEventHandler('onPlayerQuit',root, function() if not ( isGuestAccount ( getPlayerAccount ( source ) ) ) then local SqlTable = dbPoll(dbQuery(DataBase, "SELECT * FROM LevelSystem1 WHERE AccName = ?", getAccountName(getPlayerAccount(source))), -1) if SqlTable and type(SqlTable) == "table" and #SqlTable > 0 then dbExec(DataBase, "UPDATE LevelSystem1 SET Level = ?, XP = ? WHERE AccName = ?",( getElementData( source, 'Level') or 0 ) ,( getElementData( source, 'xp') or 0 ), getAccountName(getPlayerAccount(source))) else dbExec(DataBase, "INSERT INTO LevelSystem1 ( Level,XP,AccName ) VALUES(?,?,?)", 1, 0, getAccountName(getPlayerAccount(source))) end --setAccountData(getPlayerAccount(source), "Level", ( getElementData( source, 'Level') or 0 )) --setAccountData(getPlayerAccount(source), "xp", ( getElementData( source, 'xp') or 0 )) end local account = getPlayerAccount (source) if not (isGuestAccount (account)) then local playerLevel = getElementData(source, "Level") or 0 local playerxp = getElementData(source, "xp") or 0 if playerLevel and playerxp then setAccountData(account,"Level",tonumber(playerLevel)) setAccountData(account,"xp",tonumber(playerxp)) end end end ) addEventHandler('onPlayerLogout',root, function() if not ( isGuestAccount ( getPlayerAccount ( source ) ) ) then local SqlTable = dbPoll(dbQuery(DataBase, "SELECT * FROM LevelSystem1 WHERE AccName = ?", getAccountName(getPlayerAccount(source))), -1) if SqlTable and type(SqlTable) == "table" and #SqlTable > 0 then dbExec(DataBase, "UPDATE LevelSystem1 SET Level = ?, XP = ? WHERE AccName = ?",( getElementData( source, 'Level') or 0 ) ,( getElementData( source, 'xp') or 0 ), getAccountName(getPlayerAccount(source))) else dbExec(DataBase, "INSERT INTO LevelSystem1 ( Level,XP,AccName ) VALUES(?,?,?)", 1, 0, getAccountName(getPlayerAccount(source))) end --setAccountData(getPlayerAccount(source), "Level", ( getElementData( source, 'Level') or 0 )) --setAccountData(getPlayerAccount(source), "xp", ( getElementData( source, 'xp') or 0 )) end local account = getPlayerAccount (source) if not (isGuestAccount (account)) then local playerLevel = getElementData(source, "Level") or 0 local playerxp = getElementData(source, "xp") or 0 if playerLevel and playerxp then setAccountData(account,"Level",tonumber(playerLevel)) setAccountData(account,"xp",tonumber(playerxp)) end end end ) addEventHandler("onPlayerWasted",root, function (_,killer) --[[if killer and killer ~= source and getElementType(killer) == "player" then setElementData(killer, "xp", (getElementData(killer, "xp") or 0) +1) setElementData(source, "xp", (getElementData(source, "xp") or 0) -1) setPlayerXp ( killer , (getPlayerXp ( killer ) + 9) ) isPlayerNextLevel ( player ) end]] local account = getPlayerAccount (source) if not (isGuestAccount (account)) then local playerLevel = getElementData(source, "Level") or 0 local playerxp = getElementData(source, "xp") or 0 if playerLevel and playerxp then setAccountData(account,"Level",tonumber(playerLevel)) setAccountData(account,"xp",tonumber(playerxp)) end end end) Marker = { } Timer = { } function showPlayerMarker (player) if Marker[player] then destroyElement(Marker[player]) Marker[player] = nil end local x, y, z = getElementPosition ( player ) Marker[player] = createMarker ( x , y , z -1, "cylinder", 1, math.random(255),math.random(255),math.random(255), 150 ) attachElements(Marker[player],player ,0,0,-1) Timer[player] = setTimer(function( pla ) setMarkerColor(Marker[pla],math.random(255),math.random(255),math.random(255),150) _, time,_ = getTimerDetails(Timer[player]) if time <= 1 then killTimer(Timer[player]) destroyElement(Marker[player]) Marker[player] = nil end end , 100,100 ,player) end addCommandHandler ( "xp", function (thePlayer,_,xp ) local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then if tonumber(xp) <= 100 then for i, player in ipairs(getElementsByType("player")) do --setPlayerXp ( player , (getPlayerXp ( player ) + xp) ) setElementData( player, "xp", (getElementData( player, "xp") or 0 ) + xp) end else exports["guimessages"]:outputServer(thePlayer, "You can't send more than 100 XP", 255,100,100) end playSoundFrontEnd(root, 5) exports["guimessages"]:outputServer(root, "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Give All Players #15FF00[ #66AA0D".. xp .." #15FF00xp ]", 255,105,180) outputChatBox ( "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Give All Players #15FF00[ #66AA0D".. xp .." #15FF00xp ]", root, 255,105,180, true ) end end ) addCommandHandler ( "ADDXP", function (thePlayer,_,xp,namee ) local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then if tonumber(xp) <= 100 then local playerFromName = getPlayerFromName(namee) if playerFromName then setElementData( playerFromName, "xp", (getElementData( playerFromName, "xp") or 0 ) + xp) playSoundFrontEnd(playerFromName, 5) exports["guimessages"]:outputServer(playerFromName, "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Give You #15FF00[ #66AA0D".. xp .." #15FF00xp ]", 255,105,180) outputChatBox ( "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Give You #15FF00[ #66AA0D".. xp .." #15FF00xp ]", playerFromName, 255,105,180, true ) exports["guimessages"]:outputServer(thePlayer, "You sent ".. xp .." to " .. namee .. "", 0,255,0) end else exports["guimessages"]:outputServer(thePlayer, "You can't send more than 100 XP", 255,100,100) end end end ) addCommandHandler ( "SETXP", function (thePlayer,_,xp,namee ) local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then local playerFromName = getPlayerFromName(namee) if playerFromName then setElementData( playerFromName, "xp", xp) playSoundFrontEnd(playerFromName, 5) exports["guimessages"]:outputServer(playerFromName, "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Set Your Xp to #15FF00[ #66AA0D".. xp .." #15FF00xp ]", 255,105,180) outputChatBox ( "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Set Your Xp to #15FF00[ #66AA0D".. xp .." #15FF00xp ]", playerFromName, 255,105,180, true ) exports["guimessages"]:outputServer(thePlayer, "You Changed Xp for player " .. namee .. " to ".. xp .."", 0,255,0) end end end ) addCommandHandler ( "SETLEVEL", function (thePlayer,_,Level,n ) local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then local playerName = getPlayerFromName(n) if playerName then setElementData( playerName, "Level", Level) playSoundFrontEnd(playerName, 5) exports["guimessages"]:outputServer(playerName, "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Set Your Level to #15FF00[ #66AA0D".. Level .." #15FF00 ]", 255,105,180) outputChatBox ( "#65E3FCThe Manager #FFF700" .. name .. "#65E3FC Has Set Your Level to #15FF00[ #66AA0D".. Level .." #15FF00 ]", playerName, 255,105,180, true ) exports["guimessages"]:outputServer(thePlayer, "You Changed Level for player " .. n .. " to ".. Level .."", 0,255,0) end end end ) addEventHandler("onElementDataChange",root, function (dataName, oldValue ) if dataName == "xp" then local account = getPlayerAccount (source) if account then isPlayerNextLevel ( source ) end end end) ------------------------------------------------------------------------------------------------- function setPlayerLevel ( player , Level ) setElementData( player, "Level", Level ) setAccountData(getPlayerAccount(player), "Level", Level) end function setPlayerXp ( player , xp ) setElementData( player, "xp", xp ) setAccountData(getPlayerAccount(player), "xp", xp) end function getPlayerLevel ( player ) return ( getElementData( player, "Level" ) or 0 ) end function getPlayerXp ( player ) return ( getElementData( player, "xp" ) or 0 ) end function isPlayerNextLevel ( player ) local xp = getPlayerXp ( player ) local Level = getPlayerLevel ( player ) if tonumber(Level) and tonumber(xp) and tonumber( xp ) >= tonumber( (Level*150) ) then setPlayerLevel ( player , (Level + 1) ) showPlayerMarker (player) local newLevel = Level+1 outputChatBox ( " [ "..getPlayerName ( player ).." ] Level up to [ Level "..newLevel.." ]",root, 0, 255, 0, true ) local TEAM = getPlayerTeam(player) if TEAM then OnServerSendMessage(player, "Level up "..newLevel.."", 0, 255, 0, 10000) end setTimer(function() setPlayerXp ( player , ( xp - (Level*150) ) ) end,500,1) end end ----------textAction-------------- function OnServerSendMessage(uPlayer, msg, r, g, b) if isElement(uPlayer) then triggerClientEvent(uPlayer, "OnSendMessage", uPlayer, msg, r, g, b) end end ---------------------------------- addCommandHandler ( "SCR", function (thePlayer,_, msg , r, g, b) local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then local veve = { msg } local message = table.concat ( veve, " " ) triggerClientEvent(root, "OnSendMessage", root, message, r, g, b) end end ) Link to comment
Rakan# Posted July 1, 2018 Share Posted July 1, 2018 xAddToGroupFunction_ = function ( Group,Price,Level ) local account = getAccountName(getPlayerAccount(source)); if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("#You must register first",source,255,0,0,true); end if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("#You have this rank, please choose another class",source,0,255,255,true); end ----------------------time--------------------------- local sValue = getElementData( source,'PlayTime' ) if not sValue then sValue = '0:0:0' end local data = split(sValue,':') local hour = tonumber( data[1] ) if hour == nil or not tonumber(hour) then hour = 0 end if ( hour >= tonumber(Price)) then ------------------------------------------------- ----------------------level--------------------------- local sValue = getElementData( source,'Level' ) if not sValue then sValue = '0' end -- local data = split(sValue,':') local aLevel = tonumber( sValue ) if aLevel == nil or not tonumber(aLevel) then aLevel = 0 end if ( aLevel >= tonumber(Level)) then ------------------------------------------------- aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account); outputChatBox("#Rank has been added successfully "..Name,source,255,0,0,true); else outputChatBox("#You do not have enough level",source,0,255,255,true) end else outputChatBox("#You do not have enough hours",source,0,255,255,true); end end addEvent("Accept:the:request",true) addEventHandler("Accept:the:request",root,xAddToGroupFunction_) اذا مانفع اطرح اكواد الكلنت والسيرفر او تواصل معي خاص واكثر من مره استعمل @Rakan# استعمالك مايجيني اي تنبيه 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