• 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

Why the F#(K you post unstested scripts?

If you dont whant to get flamed then post a bugless script -.-!

1. Didn't post it did I? So don't quote me.

2. So people work for there fucking scripts... Maybe they will learn from it and be a better scripter ^.^ Instead of having stuff handed to them, If not, they can post in support section. Chris could have just not released it. I think its a good idea even if it doesnt work fully, it can be improved, point of this forum isnt it? To share and improve?
 
lol no it shouldnt chris. lots of errors, hold on updating

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

Havent tested but it should work, and explains every bit of the code
 
Last edited:
Code:
[16/08/2009 23:08:55] Lua Script Error: [TalkAction Interface] 
[16/08/2009 23:08:55] data/talkactions/scripts/reputation.lua

[16/08/2009 23:08:55] data/talkactions/scripts/reputation.lua:7: attempt to index global 'config' (a nil value)
[16/08/2009 23:08:55] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/reputation.lua)
hmm?
 
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.

You can use string.explode to separate params. : )
 
why would we need to seperate the param...there is only 1.

!rep PLAYERNAME

1 param. They just forgot to convert the param which was just text into an id. But its done now so don't worry bout it
 
2 questions:
How should I add it in talkactions?
Like "!rep"?

How do you see how much reputation you have? -.^
 
why would we need to seperate the param...there is only 1.

!rep PLAYERNAME

1 param. They just forgot to convert the param which was just text into an id. But its done now so don't worry bout it

Aeww, I forget to write that the system could be upgradet so we could add positive and negative reputation points to a player. F.e. !reputation Teckman, positive. That's why I write about separators. :)
 
I did as u said but look now...


21:10 Mom: /addrep "Momo

Code:
17/08/2009 21:10:00] data/talkactions/scripts/reputation.lua:27: attempt to perform arithmetic on field 'currentTime' (a boolean value)
[17/08/2009 21:10:00] stack traceback:
[17/08/2009 21:10:00] 	data/talkactions/scripts/reputation.lua:27: in function <data/talkactions/scripts/reputation.lua:11>
 
lolbillies.gif

let's see if I can use this
 
Back
Top