legolas23
New Member
- Joined
- Jan 8, 2009
- Messages
- 537
- Reaction score
- 3
Hello
I've made an ingame reputation system for tfs. It is simple and easy to use. Also I will include website ranks for most reputed in 1-2 days.
@edit
Small patch. I replaced storage values to sql database table and fixed bug with neverending ability to do not reput player after logout ;p
How to make it work?
First in talkactions.xml add
Then in talkactions/scripts create file reput.lua and paste inside
Then in talkactions/scripts create file rep.lua and paste inside
In your ots SQL database do
That's all. Now you can give someone a reputation ingame by writing !addrep nick and check someones reputation by typing !rep nick.
Credits to (Me)Legolas23 and Chojrak =]
Do not forget to give me and Chojrak some reputation by clicking
these links!
Add rep++ to Legolas23 >click<.
Add rep++ to Chojrak >click< .
I've made an ingame reputation system for tfs. It is simple and easy to use. Also I will include website ranks for most reputed in 1-2 days.
@edit
Small patch. I replaced storage values to sql database table and fixed bug with neverending ability to do not reput player after logout ;p
How to make it work?
First in talkactions.xml add
Code:
<talkaction words="!addrep" event="script" value="reput.lua"/>
<talkaction words="!rep" event="script" value="rep.lua"/>
Then in talkactions/scripts create file reput.lua and paste inside
Code:
local timeinhours = 5
local level = 100
local exhtime = 20400 --- Waiting time in seconds to reput someone again
function onSay(cid, words, param, channel)
if (param == "") then
doPlayerSendCancel(cid, "You have to write nick of player that you want to give a reputation point!")
return TRUE
end
if (exhaustion.get(cid, 14553) == TRUE) then
doPlayerSendCancel(cid, "You have already gave you reputation point for someone else! Try again later!")
return TRUE
end
local target = getPlayerByName(param)
if (not target) then
doPlayerSendCancel(cid, "Player not found.")
return TRUE
end
if (getPlayerLevel(cid) >= level) then
if (db.getResult("SELECT * FROM `rep` WHERE `player_id` = ".. getCreatureName(target) ..";") ~= -1) then
db.executeQuery("INSERT INTO `rep` VALUES (NULL,".. getCreatureName(target) ..",1;")
else
db.executeQuery("UPDATE rep SET rep_points = rep_points + 1 WHERE player_id =".. getCreatureName(target) .."")
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have added reputation to " .. getCreatureName(target) .. " you can give next reputation in 6 hours!")
exhaustion.set(cid, 14553, exhtime)
else
doPlayerSendCancel(cid, "Your level is too low to give someone a reputation!")
end
return TRUE
end
Then in talkactions/scripts create file rep.lua and paste inside
Code:
function onSay(cid, words, param)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end
local player = getPlayerByNameWildcard(param)
if getPlayerStorageValue(player, 17779) == -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Information about: " .. getCreatureName(player) .. ". \nHe does not have any reputation points.")
else
doPlayerPopupFYI(cid, " " .. getCreatureName(player) .. " \n\nReputation points of this player: " .. getPlayerStorageValue(player, 17779) .. ".")
end
end
In your ots SQL database do
Code:
CREATE TABLE `rep` (
`player_id` INT( 11 ) NOT NULL ,
`rep_points` INT( 11 ) NOT NULL
) ENGINE = MYISAM ;
That's all. Now you can give someone a reputation ingame by writing !addrep nick and check someones reputation by typing !rep nick.
Credits to (Me)Legolas23 and Chojrak =]
Do not forget to give me and Chojrak some reputation by clicking
these links!
Add rep++ to Legolas23 >click<.
Add rep++ to Chojrak >click< .
Last edited: