• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Avesta] Paying for help with scripts

Veterana

Oldschool Player
Joined
May 4, 2010
Messages
194
Reaction score
7
I am looking for help to make a few scripts for my Avesta server.
The person who help me can get a payment if he wants, just PM me.


[Still needed] Script for item that removes all frags.
[Still needed] Script for item that changes name of character.
[Still needed] Script for item that gives access to a Action ID for 30 days.
[Still needed] Script for item that change the players group in the database.
[Still needed] Script for item that gives players account 30 days of premium.
[Still needed] Script for item that gives player full light during gameplay.


If you can help me with any of this, i would be very thankful and also REP you.
 
When a play got this doll and saying !removefrags all frags will be removed. You can change the ID of the item in the script. Currently ID is 2110.

Talkactions.xml:

XML:
<talkaction words="!removefrags" event="script" value="removefrags.lua"/>

data\talkactions\scripts\removefrags.lua:

LUA:
function onSay(cid, words, param) 
  
    if getPlayerItemCount(cid, 2110) >= 1 then 
    doPlayerRemoveItem(cid, 2110, 1) 
    db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")") 
     doPlayerSendTextMessage(cid,25,"Your frags have been removed.") 
    else 
    doPlayerSendCancel(cid, 'You need a doll for this.') 
    end 
end

Changename:
!changename

data/talkactions/talkactions.xml:
XML:
 <talkaction log="yes" words="!changename;/changename;!namechange;/namechange" access="0" event="script" value="changename.lua"/>

data/talkactions/changename.lua:
LUA:
local config = {
	item = {Id = 1111, count = 0},
	paramBlacklist = {"account manager", "god", "tutor", "tester"},
	kick = {enabled = true, delay = 2 * 1000},
	forceLogout = false,
	namelockCheck = true,
	vowelsCheck = true,
	maxTextLenght = 29,
	minWordLenght = 2,
	maxWordLenght = 14,
	maxWords = 3
}
 
config.kick.enabled = getBooleanFromString(config.kick.enabled)
config.forceLogout = getBooleanFromString(config.forceLogout)
config.namelockCheck = getBooleanFromString(config.namelockCheck)
config.vowelsCheck = getBooleanFromString(config.vowelsCheck)
 
function onSay(cid, words, param, channel)
	local t = string.explode(param, ",")
	local len, firstWord, wordCount, textCancel, limit = string.len(tostring(t[1])), true, 0, '', ";"
	if(getConfigValue('sqlType') == 'mysql') then
		limit = db.updateLimiter()
	end
 
	if(param == '') then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	elseif(getPlayerGUIDByName(t[1], true) ~= nil) then
		textCancel = "That name is already in use."
	elseif(getPlayerItemCount(cid, config.item.Id) < config.item.count) then
		textCancel = "You do not fulfill the requirements."
	elseif(not getTilePzInfo(getCreaturePosition(cid))) then
		textCancel = "You must be inside a protection zone to use this command."
	elseif(len > config.maxTextLenght) then
		textCancel = "A name must have at least " .. config.minWordLenght .. " but no more than " .. config.maxTextLenght .. " letters!"
	elseif(config.namelockCheck and db.getResult("SELECT * FROM `player_namelocks` WHERE `name` = " .. db.escapeString(t[1]) .. "" .. limit .. ""):getID() ~= 1) then
		textCancel = "That name is namelocked."
	elseif(string.find(t[1]:lower(), "[^%l%s]") ~= nil) then
		textCancel = "This name contains invalid letters. Please use only A-Z, a-z and space!"
	else
		paramTemp = ''
		for word in string.gmatch(t[1], "%a+") do
			len, wordCount = string.len(word), wordCount + 1
			if(isInArray(config.paramBlacklist, paramTemp:lower())) then
				textCancel = "Invalid name entry."
				break
			elseif(len < config.minWordLenght) then
				textCancel = "This name contains a word with only " .. len .. " letter" .. (len > 1 and "s" or '') .. ". Please use more than " .. len .. " letter" .. (len > 2 and "s" or '') .. " for each word!"
				break
			elseif(len > config.maxWordLenght) then
				textCancel = "This name contains a word that is too long. Please use no more than " .. config.maxWordLenght .. " letters for each word!"
				break
			elseif(wordCount > config.maxWords) then
				textCancel = "This name contains more than 3 words. Please choose another name!"
				break
			elseif(config.vowelsCheck and string.find(word:lower(), "[aeiouy]") == nil) then
				textCancel = "This name contains a word without vowels. Please choose another name!"
				break
			else
				wordTemp = ''
				for i = 1, len do
					letter = string.sub(word, i, i)
					if(i == 1) then
						if(getBooleanFromString(firstWord) and string.find(letter, "%l")) then
							letter = string.upper(letter)
						end
					else
						if(string.find(letter, "%u")) then
							letter = string.lower(letter)
						end
					end
 
					firstWord = false
					wordTemp = "" .. wordTemp .. "" .. letter .. ""
				end
			end
 
			paramTemp = "" .. paramTemp .. "" .. (paramTemp ~= '' and " " or '') .. "" .. wordTemp .. ""
		end
	end
 
	if(textCancel ~= '') then
		doPlayerSendCancel(cid, textCancel)
		return true
	end
 
	local oldName, guid = getCreatureName(cid), getPlayerGUID(cid)
	t[1] = paramTemp
	doPlayerRemoveItem(cid, config.item.Id, config.item.count)
	if(pcall(doPlayerChangeName, guid, oldName, t[1]) ~= true) then
		db.executeQuery("INSERT INTO `player_namelocks` (`player_id`, `name`, `new_name`, `date`) VALUES (" .. guid .. ", " .. db.escapeString(oldName) .. ", " .. db.escapeString(t[1]) .. ", " .. os.time() .. ");")
		db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(t[1]) .. " WHERE `id` = " .. guid .. "" .. limit .. "")
	end
 
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your name has been changed successfully." .. (config.kick.enabled and " You will be kicked in " .. config.kick.delay / 1000 .. " seconds." or " Re-enter the game to see the changes.") .. "")
	if(config.kick.enabled) then
		addEvent(function(cid, forceLogout)
			if(isPlayer(cid)) then
				doRemoveCreature(cid, forceLogout)
			end
		end, config.kick.delay, cid, config.forceLogout)
	end
 
	return true
end
 
When a play got this doll and saying !removefrags all frags will be removed. You can change the ID of the item in the script. Currently ID is 2110.

Talkactions.xml:

XML:
<talkaction words="!removefrags" event="script" value="removefrags.lua"/>

data\talkactions\scripts\removefrags.lua:

LUA:
function onSay(cid, words, param) 
  
    if getPlayerItemCount(cid, 2110) >= 1 then 
    doPlayerRemoveItem(cid, 2110, 1) 
    db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")") 
     doPlayerSendTextMessage(cid,25,"Your frags have been removed.") 
    else 
    doPlayerSendCancel(cid, 'You need a doll for this.') 
    end 
end

Changename:
!changename

data/talkactions/talkactions.xml:
XML:
 <talkaction log="yes" words="!changename;/changename;!namechange;/namechange" access="0" event="script" value="changename.lua"/>

data/talkactions/changename.lua:
LUA:
local config = {
	item = {Id = 1111, count = 0},
	paramBlacklist = {"account manager", "god", "tutor", "tester"},
	kick = {enabled = true, delay = 2 * 1000},
	forceLogout = false,
	namelockCheck = true,
	vowelsCheck = true,
	maxTextLenght = 29,
	minWordLenght = 2,
	maxWordLenght = 14,
	maxWords = 3
}
 
config.kick.enabled = getBooleanFromString(config.kick.enabled)
config.forceLogout = getBooleanFromString(config.forceLogout)
config.namelockCheck = getBooleanFromString(config.namelockCheck)
config.vowelsCheck = getBooleanFromString(config.vowelsCheck)
 
function onSay(cid, words, param, channel)
	local t = string.explode(param, ",")
	local len, firstWord, wordCount, textCancel, limit = string.len(tostring(t[1])), true, 0, '', ";"
	if(getConfigValue('sqlType') == 'mysql') then
		limit = db.updateLimiter()
	end
 
	if(param == '') then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	elseif(getPlayerGUIDByName(t[1], true) ~= nil) then
		textCancel = "That name is already in use."
	elseif(getPlayerItemCount(cid, config.item.Id) < config.item.count) then
		textCancel = "You do not fulfill the requirements."
	elseif(not getTilePzInfo(getCreaturePosition(cid))) then
		textCancel = "You must be inside a protection zone to use this command."
	elseif(len > config.maxTextLenght) then
		textCancel = "A name must have at least " .. config.minWordLenght .. " but no more than " .. config.maxTextLenght .. " letters!"
	elseif(config.namelockCheck and db.getResult("SELECT * FROM `player_namelocks` WHERE `name` = " .. db.escapeString(t[1]) .. "" .. limit .. ""):getID() ~= 1) then
		textCancel = "That name is namelocked."
	elseif(string.find(t[1]:lower(), "[^%l%s]") ~= nil) then
		textCancel = "This name contains invalid letters. Please use only A-Z, a-z and space!"
	else
		paramTemp = ''
		for word in string.gmatch(t[1], "%a+") do
			len, wordCount = string.len(word), wordCount + 1
			if(isInArray(config.paramBlacklist, paramTemp:lower())) then
				textCancel = "Invalid name entry."
				break
			elseif(len < config.minWordLenght) then
				textCancel = "This name contains a word with only " .. len .. " letter" .. (len > 1 and "s" or '') .. ". Please use more than " .. len .. " letter" .. (len > 2 and "s" or '') .. " for each word!"
				break
			elseif(len > config.maxWordLenght) then
				textCancel = "This name contains a word that is too long. Please use no more than " .. config.maxWordLenght .. " letters for each word!"
				break
			elseif(wordCount > config.maxWords) then
				textCancel = "This name contains more than 3 words. Please choose another name!"
				break
			elseif(config.vowelsCheck and string.find(word:lower(), "[aeiouy]") == nil) then
				textCancel = "This name contains a word without vowels. Please choose another name!"
				break
			else
				wordTemp = ''
				for i = 1, len do
					letter = string.sub(word, i, i)
					if(i == 1) then
						if(getBooleanFromString(firstWord) and string.find(letter, "%l")) then
							letter = string.upper(letter)
						end
					else
						if(string.find(letter, "%u")) then
							letter = string.lower(letter)
						end
					end
 
					firstWord = false
					wordTemp = "" .. wordTemp .. "" .. letter .. ""
				end
			end
 
			paramTemp = "" .. paramTemp .. "" .. (paramTemp ~= '' and " " or '') .. "" .. wordTemp .. ""
		end
	end
 
	if(textCancel ~= '') then
		doPlayerSendCancel(cid, textCancel)
		return true
	end
 
	local oldName, guid = getCreatureName(cid), getPlayerGUID(cid)
	t[1] = paramTemp
	doPlayerRemoveItem(cid, config.item.Id, config.item.count)
	if(pcall(doPlayerChangeName, guid, oldName, t[1]) ~= true) then
		db.executeQuery("INSERT INTO `player_namelocks` (`player_id`, `name`, `new_name`, `date`) VALUES (" .. guid .. ", " .. db.escapeString(oldName) .. ", " .. db.escapeString(t[1]) .. ", " .. os.time() .. ");")
		db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(t[1]) .. " WHERE `id` = " .. guid .. "" .. limit .. "")
	end
 
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your name has been changed successfully." .. (config.kick.enabled and " You will be kicked in " .. config.kick.delay / 1000 .. " seconds." or " Re-enter the game to see the changes.") .. "")
	if(config.kick.enabled) then
		addEvent(function(cid, forceLogout)
			if(isPlayer(cid)) then
				doRemoveCreature(cid, forceLogout)
			end
		end, config.kick.delay, cid, config.forceLogout)
	end
 
	return true
end


The !removefrags script doesnt remove the frags, it is saying " 'db' <a nil value " in my console.

The changename script is not working at all, no idea why and i have no idea how to use the !changename command.


Also, this script seems to be for Theforgottenserver and not Avesta?
 
The !removefrags script doesnt remove the frags, it is saying " 'db' <a nil value " in my console.

The changename script is not working at all, no idea why and i have no idea how to use the !changename command.


Also, this script seems to be for Theforgottenserver and not Avesta?

You want help but you dont know how to put a function in functions file...
Nvm
 
The !removefrags script doesnt remove the frags, it is saying " 'db' <a nil value " in my console.

The changename script is not working at all, no idea why and i have no idea how to use the !changename command.


Also, this script seems to be for Theforgottenserver and not Avesta?

You can't get some of your scripts to work without editing the source code, avesta lacks db.executeQuery and bla bla
 
@Veterana - ond is right, you expect us to help you but... Avesta is the problem
Most of Avesta Engines are corrupted or some random error always kicks out.

Also look around the forums, and check. Maybe somebody had exactly the same problem...

Kind Regards,
X_anero
 
Back
Top