0 Üye ve 1 Ziyaretçi konuyu incelemekte.
local donatorTeam = createTeam("Premium players",255,255,0)function premiumCommand(thePlayer,command,action,theSearchedPlayer,daysToAdd) if isPlayerLogged(thePlayer) then local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) if action == "add" then if theSearchedPlayer then local theSearchedPlayer = findPlayerByName(theSearchedPlayer) if theSearchedPlayer then if isObjectInACLGroup("user."..accountName,aclGetGroup("Everyone")) then if daysToAdd then local daysToAdd = tonumber(daysToAdd) if daysToAdd then if not isPlayerLogged(theSearchedPlayer) then return outputChatBox("[PREMIUM] #ffffffPlayer is not logged.",thePlayer,255,255,255,true) end local nowTime = getRealTime() local timeForPlayer = nowTime.timestamp+86400*daysToAdd setPlayerData(theSearchedPlayer,'donatorTime',timeForPlayer) setPlayerData(theSearchedPlayer,'donatorEnabled',1) refreshScoreboard(theSearchedPlayer) premiumPlayerLogin(theSearchedPlayer) checkAchievements(theSearchedPlayer,25) outputChatBox("[PREMIUM] #ffffffYou successfully set a premium state for player: "..getPlayerName(theSearchedPlayer),thePlayer,255,255,255,true) else outputChatBox("[PREMIUM] #ffffffBad arguments: /premium [add/remove] player [days]",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffBad arguments: /premium [add/remove] player [days]",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffYou cant do that!",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffCan't find a player!",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffBad arguments: /premium [add/remove] player [days]",thePlayer,255,255,255,true) end elseif action == "remove" then if theSearchedPlayer then local theSearchedPlayer = findPlayerByName(theSearchedPlayer) if theSearchedPlayer then if isObjectInACLGroup("user."..accountName,aclGetGroup("Admin")) then setPlayerData(theSearchedPlayer,'donatorTime',0) setPlayerData(theSearchedPlayer,'donatorEnabled',0) premiumPlayerLogin(theSearchedPlayer) outputChatBox("[PREMIUM] #ffffffYour premium state has been removed.",theSearchedPlayer,255,255,255,true) outputChatBox("[PREMIUM] #ffffffYou successfully removed a premium state for player: "..getPlayerName(theSearchedPlayer),thePlayer,255,255,255,true) else outputChatBox("[PREMIUM] #ffffffYou cant do that!",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffCan't find a player!",thePlayer,255,255,255,true) end else outputChatBox("[PREMIUM] #ffffffBad arguments: /premium [add/remove] player [days]",thePlayer,255,255,255,true) end else local donatorState = getPlayerData(thePlayer,'donatorEnabled') if donatorState == 1 then local timeNow = getRealTime() local donatorTime = getPlayerData(thePlayer,'donatorTime') local donatorTime = (donatorTime - timeNow.timestamp)*1000 outputChatBox("[PREMIUM] #ffffffPremium #00ff00Active! #ffffffExpire in: "..msToTimeString(donatorTime),thePlayer,255,255,255,true) else outputChatBox("[PREMIUM] #ffffffYou arent a PREMIUM!",thePlayer,255,255,255,true) end end endendaddCommandHandler("premium",premiumCommand)function premiumPlayerLogin(thePlayer) if isPlayerLogged(thePlayer) then local donatorTime = getPlayerData(thePlayer,'donatorTime') local donatorEnabled = getPlayerData(thePlayer,'donatorEnabled') local timeNow = getRealTime() local donatorState = {false,"Expired!"} if donatorEnabled == 1 then if timeNow.timestamp < donatorTime then local donatorTime = (donatorTime - timeNow.timestamp) if donatorTime < 86400 then donatorState[2] = "Less than one day" else donatorState[2] = math.ceil(donatorTime/86400).." days" end donatorState[1] = true displayNotification(thePlayer,"Premium","You are premium! Thanks for your support!",150,100,255) else setPlayerData(thePlayer,'donatorTime',0) setPlayerData(thePlayer,'donatorEnabled',0) displayNotification(thePlayer,"Premium","Your premium time expired! Thanks for your support!",150,100,255) end end addPlayerToPremium(thePlayer,donatorState[1]) callClientFunction(thePlayer,"updateDonatorData",donatorState) endendfunction addPlayerToPremium(thePlayer,state) if state then if not getPlayerTeam(thePlayer) then setPlayerTeam(thePlayer,donatorTeam) end else setPlayerTeam(thePlayer,nil) endend