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

!changename

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
Hi there...
I would like to make a command that for 2,000 premium points it changes your name? How, giving you the namelock ban... How it works?

I don't know if the function exist or not, but it should execute this query on table bans:
id = namelock id (should be with a ++)
type = 2
value = player id
param = 2
active = 1
expires = -1
added = os.time?
admin id = 1
comment = !changename command
action = 1

So if the player account has 2000 or more premium points AND the player is in protection zone, then it kick the player, removes 2000 premium points and then execute this query.
If the player account doesnt have 2000 premium points or less, then it gives the following error "It costs 2,000 premium points".
 
Code:
local config = {
	points = 2000
}

function onSay(cid, words, param, channel)
	local guid = getPlayerGUID(cid)
	local check = db.getResult("SELECT `premium_points` FROM `players` WHERE `id` = " .. guid .. ";")
	if check:getID() ~= -1 then
		if check:getDataInt("premium_points") < config.points then
			doPlayerSendTextMessage(cid, 27, "You dont have enough points.")
			return
		end
		check:free()
		doRemoveCreature(cid)
		db.executeQuery("UPDATE `players` SET `name` = " .. param .. " WHERE `id` = " .. guid .. ";")
	end
	return true
end
 
Code:
local config = {
    points = 2000
}

function onSay(cid, words, param, channel)
    local guid = getPlayerGUID(cid)
    local check = db.getResult("SELECT [B][COLOR=Red]`premium_points` FROM `players`[/COLOR][/B] WHERE `id` = " .. guid .. ";")
    if check:getID() ~= -1 then
        if check:getDataInt("premium_points") < config.points then
            doPlayerSendTextMessage(cid, 27, "You dont have enough points.")
            return
        end
        check:free()
        doRemoveCreature(cid)
        db.executeQuery("UPDATE `players` [B][COLOR=Red]SET `name` = " .. param .. "[/COLOR][/B] WHERE `id` = " .. guid .. ";")
    end
    return true
end

- i tought premium points was on accounts table :/
- set name = param will give error, you should use db.escapeString
- and you should check if name exist
- remove points (?)
 
Back
Top