• 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!

TalkAction [0.3.5] Rep System

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
Well i saw a rep system like way back in the day when it was 8.0 so we decided to make a new one! Credits to me and Syntax

Theres a function in the script thats only in 0.3.5 so you can just preserve the script or change the function to something else to fit your needs

Code:
setPlayerSpecialDescription
What the script does is every 24 hours your allowed to rep a person, The player has to be above a certian level, and It cant be the person adding the rep's same IP. And it shows in the players name how many rep points they have! =P

heres the code:

Lua:
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
 
Last edited:
12:32 XXXXXX: I BUY REP! 50k!

Such a bad idea...
But good that you made it anyways for some people who need it.
 
In < 0.3.5 there is doPlayerSetNameDescription, dunno if its the same.
Also, horrible tabbing :X.
 
tabbing got fucked up when i pasted on pastebin.com :( it was uberrox
 
from my validations it will no work. few errors - getPlayerIp(param), config storage & level & exaust & target not used : D
 
from my validations it will no work. few errors - getPlayerIp(param), config storage & level & exaust & target not used : D

storage & level are actually being used ;o
 
Mmm.. i look the script and i think it isn't working..

because you can't use for example "setPlayerStorageValue(param, x, x)"...

param must be "param = getCreatureByName(param)"

Sorry if i'm writing in a bad english.
 
Thanks for releasing it and good job becuase u worked on it!
 
yeah keep in mind this hasnt been tested, it was just a quick code we wanted to release to the public...if you have to modify it a bit to get it to work dont bitch. Take it or leave it. It gives you the basic idea
 
Does this help?

Lua:
local config = 
{
	compareTime = 1 * 24 * 60 * 60, -- This is 1 day, in seconds. Time between rep.
	currentTime = getPlayerStorageValue(cid, 23232),
        storage = 5000,
        level = 50,
        exaust = 5001,
        target = getPlayerByName(param)
}
function onSay(cid, words, param, channel)
    if config.currentTime == -1 then
	config.currentTime = os.time()
    return TRUE
    end
	
    if(param == "") then
	doPlayerSendCancel(cid,"You have to put a Players Name.")
    return TRUE
    end

    if getPlayerIp(cid) == getPlayerIp(param) then
        doPlayerSendCancel(cid,"You may not Rep yourself or your same IP.")  
    return TRUE
    end

    if (os.time() - config.currentTime) < config.compareTime then
	doPlayerSendCancel(cid, "You may Rep only once a day.")
    return TRUE
    end

    if getPlayerLevel(cid) < config.level then
	doPlayerSendCancel(cid,"Level 50 and above required.")
    return TRUE
    end

	setPlayerStorageValue(cid, 23232, os.time())
	setPlayerStorageValue(param,config.storage, getPlayerStorageValue(config.storage) +1)
	doPlayerSendTextMessage(cid,22,"You just gave |TARGET| 1 Rep point.")   
	doPlayerSendTextMessage(param, 22,".. getCreatureName(cid) .. just gave you a Rep Point.")   
	setPlayerSpecialDescription(param, "Has ".. getPlayerStorageValue(config.storage).." Reputation")
    end
end
 
It was a Base code for people to get idea's and make something great out of it.
 
yeah keep in mind this hasnt been tested, it was just a quick code we wanted to release to the public...if you have to modify it a bit to get it to work dont bitch. Take it or leave it. It gives you the basic idea


Why the F#(K you post unstested scripts?

If you dont whant to get flamed then post a bugless script -.-!
 
I get this error when I test it:
Lua:
[11/07/2009 19:54:40] Lua Script Error: [TalkAction Interface] 
[11/07/2009 19:54:40] data/talkactions/scripts/rep.lua:onSay

[11/07/2009 19:54:40] luaGetPlayerStorageValue(). Player not found

[11/07/2009 19:54:40] Lua Script Error: [TalkAction Interface] 
[11/07/2009 19:54:40] data/talkactions/scripts/rep.lua:onSay

[11/07/2009 19:54:40] data/talkactions/scripts/rep.lua:39: attempt to perform arithmetic on a boolean value
[11/07/2009 19:54:40] stack traceback:
[11/07/2009 19:54:40] 	data/talkactions/scripts/rep.lua:39: in function <data/talkactions/scripts/rep.lua:1>

Line 39:
Lua:
setPlayerStorageValue(param,config.storage, getPlayerStorageValue(config.storage) +1)

EDIT; What is exaust used for? :p
 
Back
Top