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

!delete Comand

Andrekkzie

New Member
Joined
Sep 12, 2010
Messages
64
Reaction score
2
I need a command for deleting ppl but when i deleted a person i want to say Name has been deleted for breaking the rules!
 
I should work:
data/talkactions/scripts/delete.lua
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local pid = getPlayerByNameWildcard(param)
	if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
		return true
	end

	doBroadcastMessage("" .. getCreatureName(pid) .." has been deleted for breaking the rules!")
	doRemoveCreature(pid, true)
	db.executeQuery("DELETE from `players` WHERE `name` = " .. getCreatureName(pid) .. " LIMIT 1")
	return true
end
 
If you're using 0.4 change

Lua:
db.executeQuery("DELETE from `players` WHERE `name` = " .. getCreatureName(pid) .. " LIMIT 1")

to

Lua:
db.query("DELETE from `players` WHERE `name` = " .. getCreatureName(pid) .. " LIMIT 1")

Any error messages?
 
Last edited:
15:50 Kyle has been deleted for breaking the rules!

But anyway when im going to put my acc again in the character lits still appears the character and i login with the deleted character and nothing happens :/
 
Didn't work because you're not using db.escapeString or ''
Try this
Lua:
function onSay(cid, words, param, channel)
	if(param == "") then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
	end

	local c = db.executeQuery
	if not c then
		c = db.query
	end
 
	local pid = getPlayerByNameWildcard(param)
	if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
	end

	doRemoveCreature(pid)
	local query = c("delete from players where name = " .. db.escapeString(getCreatureName(pid)) .. ";")
	if not query then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. getCreatureName(pid) .. " cannot be deleted.")
	end

	return doBroadcastMessage(getCreatureName(pid) .." has been deleted for breaking the rules!")
end
 
Back
Top