TalkAction [0.3.5] Rep System

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
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:

Evan

A splendid one to behold
Premium User
Joined
May 6, 2009
Messages
7,017
Best answers
1
Reaction score
942
Location
United States
12:32 XXXXXX: I BUY REP! 50k!

Such a bad idea...
But good that you made it anyways for some people who need it.
 

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
In < 0.3.5 there is doPlayerSetNameDescription, dunno if its the same.
Also, horrible tabbing :X.
 
OP
Sync

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
The tabbing Rox. Ok.
 

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,840
Best answers
0
Reaction score
201
Location
Texas
tabbing got fucked up when i pasted on pastebin.com :( it was uberrox
 

slawkens

Developer
Premium User
Joined
Aug 27, 2007
Messages
2,874
Best answers
61
Reaction score
390
Location
Germany
from my validations it will no work. few errors - getPlayerIp(param), config storage & level & exaust & target not used : D
 

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
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
 
Joined
Apr 17, 2008
Messages
1,922
Best answers
0
Reaction score
181
Location
Venezuela
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.
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
Thanks for releasing it and good job becuase u worked on it!
 

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,840
Best answers
0
Reaction score
201
Location
Texas
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
 

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
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
 
OP
Sync

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,876
Best answers
0
Reaction score
19
Location
Canada
It was a Base code for people to get idea's and make something great out of it.
 

Pitufo™

InfinityOT.com
Joined
Feb 14, 2008
Messages
1,438
Best answers
0
Reaction score
7
Location
Mexico, Cuernavaca
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 -.-!
 

Serginov

Onkonkoronkonk
Joined
Jun 28, 2008
Messages
1,322
Best answers
0
Reaction score
18
Location
Sweden - Dalarna
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
 
Top