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

SQL command... HELP

JoSePh15_

Well-Known Member
Joined
Jan 28, 2010
Messages
1,766
Reaction score
59
i want it when someone uses an item it runs this db.query

it makes skull = 0 and skulltime= 0

it should be something like that
SQL:
db.query("UPDATE `players` SET  `skull` =  '0',`skulltime` =  '0' WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")

HELP PLEASE ITS ERGENT!
 
XML:
<action itemid="1234" event="script" value="skull.lua"/>
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doRemoveItem(item.uid, 1)
    db.query('UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `players`.`id` = ' .. getPlayerGUID(cid))
    return true
end
 
PHP:
db.query("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
db.query('UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `players`.`id` = ' .. getPlayerGUID(cid))
can i make both of them in 1 command? :D

I'm using rev 3952 and the thingy u gave me CyberM it didnt work :P
 
its an action item...
before when i did ( IN REV 3942)
PHP:
  db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
it removed the skull and everything...
but now (IN REV 3952)
PHP:
  db.query("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
doesnt remove skull and everything... it only removes the frag!
 
ye thats what i want :)

So you just want a frag remover script that also removes skull?

If so, toss this into your mods folder. (if you don't have one, make one)

XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Frag Remover" version="1.1" author="Arthur" contact="otland.net" enabled="yes">
	<action itemid="xxxx" event="script"><![CDATA[
		local noRemove = {SKULL_WHITE, SKULL_YELLOW}
		local playerSkull = getPlayerSkullType(cid)
		if isInArray(noRemove, playerSkull) then
			doPlayerSendCancel(cid, "You can't remove this type of skull.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			return true
		elseif playerSkull == SKULL_NONE then
			doPlayerSendCancel(cid, "You don't have skull.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			return true
		else
			db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
			doPlayerSendTextMessage(cid, 27, "Your frags and your skull have been removed!")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
			doSendAnimatedText(getPlayerPosition(cid), "Removed !", 180)
			doCreatureSetSkullType(cid,0)
			doPlayerSetSkullEnd(cid, 0, playerSkull)
			doRemoveItem(item.uid, 1)
		end
		return true
	]]>
</action>
</mod>
 
PHP:
db.query("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
db.query('UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `players`.`id` = ' .. getPlayerGUID(cid))
can i make both of them in 1 command? :D

I'm using rev 3952 and the thingy u gave me CyberM it didnt work :P

someone do that please!
 
bump please!!
SQL:
db.query('UPDATE `players` SET `skull` = 0, `skulltime` = 0 WHERE `players`.`id` = ' .. getPlayerGUID(cid))
whats the correction for this?!
 
in same command... put them under each other!!
LUA:
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
db.executeQuery("UPDATE `players` SET `skull` = '0', `skulltime` = '0' WHERE `id` = '" .. getPlayerGUID(cid).."' ;")
 
in same command... put them under each other!!
LUA:
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
db.executeQuery("UPDATE `players` SET `skull` = '0', `skulltime` = '0' WHERE `id` = '" .. getPlayerGUID(cid).."' ;")

I guess it's changed to db.query ... I'm testing it!
 
??
LUA:
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
doCreatureSetSkullType(cid, 0)
doPlayerSetRedSkullTicks(cid, 0)
 
LUA:
local config =  {
                remove_Skulls = true;
                };

function onUse(cid, item, frompos, item2, topos)

  if config.remove_Skulls == TRUE then
     if getCreatureSkullType(cid) > SKULL_WHITE then
       doCreatureSetSkullType(cid, 0)
	   doPlayerSetRedSkullTicks(cid, 0)
     end
  end


  db.query("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
  doRemoveItem(item.uid, 1)
  doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your frags where successfully cleaned.")

  return TRUE   
end
It removes it when im ingame... when i relog i still have the rs..
INFO: Im using rev 3952
 
its changed in 3952, its db.query now..
Check the docs > > Lua_Functions > > it's written there
LUA:
	db.executeQuery = db.query
 
try
LUA:
local config = {
                remove_Skulls = true,
                skull = {4,5}
                }
 
function onUse(cid, item, frompos, item2, topos)
 
  if config.remove_Skulls == true then
     if isInArray(config.skull,getCreatureSkullType(cid))  then
       doCreatureSetSkullType(cid, 0)
	   doPlayerSetRedSkullTicks(cid, 0)
	   db.executeQuery("UPDATE `players` SET `skulltime` = '0' WHERE `id` = '" .. getPlayerGUID(cid).."';")
     end
  end
 
 
  db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
  doRemoveItem(item.uid, 1)
  doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your frags where successfully cleaned.")
 
  return TRUE   
end
 
Back
Top