• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Ingame reputation system by Legolas23

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
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:
Thanks for credits! xD Nice script, but while event czasbezrep is executed and player is offline, storage will not change.
 
Don't you have to make an sql query storage instead of a regular storage value in order for a home site to catch up the values and use it in the site?
 
I am the original creator of this script. You can ask Chojrak to confirm this.
 
i hate to sound like a noob, but which distro is this for?

nice work, if i manage to test it ill give more info on it

Repd+
to both of you
 
I just helped him with some piece of code, reputation is not needed for me :P
 
Maybe better, but why you saying this? He just learning LUA and trying to write smth then post it. ;)

-.-? it's just a comment dude, no need to flame
 
Back
Top