local config =
{
timestorage = 8758, --time storage value used
repstorage = 4357, --rep storage value used
compareTime = 1 * 24 * 60 * 60, -- This is 1 day, in seconds. Time between rep.
target = getPlayerByName(param), -- gets target CID by their name
currentTime = getPlayerStorageValue(cid, config.timestorage),
currentRep = getPlayerStorageValue(target, config.repstorage),
level = 50 -- Required level to give rep (0 for no requirement)
}
function onSay(cid, words, param, channel) --starts function when person says certain words
if config.currentTime == -1 then --checks if the current time value is nil
config.currentTime = os.time() --sets the time value to os.time
return TRUE --returns function true
end --ends function
if(param == "") then --if talkaction param is blank then
doPlayerSendCancel(cid,"You have to put a Players Name.")--sends player cancel message
return TRUE--returns function true
end--ends function
if getPlayerIp(cid) == getPlayerIp(param) then--compares player ip with target ip address
doPlayerSendCancel(cid,"You may not Rep yourself or your same IP.")--sends cancel message
return TRUE--returns function true
end--ends function
if (os.time() - config.currentTime) < config.compareTime then--checks if player repped within time allowed
doPlayerSendCancel(cid, "You may Rep only once a day.")--sends player cancel
return TRUE--returns function true
end--ends function
if getPlayerLevel(cid) < config.level then--checks if player is lower than allowed level
doPlayerSendCancel(cid,"Level 50 and above required.")--sends player cancel
return TRUE--returns function true
end--ends function
if isPlayer(config.target) then --checks if the target is a player
setPlayerStorageValue(cid, config.timestorage, os.time())--sets current time to os.time
setPlayerStorageValue(config.target,config.currentRep,config.currentRep+1)-- updates current Rep with point
doPlayerSendTextMessage(cid,22,"You just gave " .. config.target .." 1 Rep point.")--sends repper text
doPlayerSendTextMessage(target,22,getCreatureName(cid) .. " just gave you a Rep Point.")--sends target text
setPlayerSpecialDescription(target,"Has ".. getPlayerStorageValue(config.currentRep).." Reputation")--sets targets desc.
end--ends function
return TRUE--returns function true
end--ends whole function