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

[MOD] Mock's Classic Snake remade to MOD!

Pheenix

Mr.Plain Awesome
Joined
Mar 28, 2011
Messages
152
Reaction score
14
Location
Sweden
Releasing my Classic Snake mod
Snake originally written by mock @otland.net

Talkactions:
Access: 5 /rsnakegvalue -- Set global storage to 0 (if snake is bugging)
Access: 5 /rsnakehighscore -- Reset Snake server highscore
Access: 0 /resetsnake -- Reset your own highscore

Examples:
/rsnakegvalue yes
/rsnakehighscore yes
/resetsnake yes
----------------------------------------------------------------------------------------------------------------------------

  • *Rewritten to mod
  • *Added configurations
  • *Added SQL Highscore System
  • *Added Talkactions
by Pheenix @otland.net

snakedifficulties.png

centerpos.png



SQL Queries for highscore system:


Query 1:
Code:
ALTER TABLE `accounts` ADD
`snakehigh` bigint(20) NOT NULL DEFAULT 0;

Query 2:
Code:
CREATE TABLE IF NOT EXISTS `game_highscores` (
`id` int(11) NOT NULL auto_increment,
`snake` bigint(20) NOT NULL,
`snakename` int(11) NOT NULL,
PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Query 3: - Make sure you have a character with ID 1, otherwise enter another random Character ID (id in players table of database) in the (NULL,0,IDHERE); it doesnt matter who that character is.
Code:
INSERT INTO `game_highscores` VALUES (NULL,0,1);


Mod file code:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="snake" version="1.0" author="Pheenix" contact="otland.net" enabled="true">
	<description><![CDATA[
 ______   _         _                                                               ______                _               
(_____ \ | |       (_)            /\                                               / _____)              (_)              
 _____) )| |  ____  _  ____      /  \   _ _ _   ____   ___   ___   ____    ____   | /  ___   ____  ____   _  ____    ____ 
|  ____/ | | / _  || ||  _ \    / /\ \ | | | | / _  ) /___) / _ \ |    \  / _  )  | | (___) / _  ||    \ | ||  _ \  / _  |
| |      | |( ( | || || | | |  | |__| || | | |( (/ / |___ || |_| || | | |( (/ /   | \____/|( ( | || | | || || | | |( ( | |
|_|      |_| \_||_||_||_| |_|  |______| \____| \____)(___/  \___/ |_|_|_| \____)   \_____/  \_||_||_|_|_||_||_| |_| \_|| |
                               ______                                                                              (_____|
                              (_____ \                                    _                                               
                               _____) )  ____   ____   ___   ____  ____  | |_    ___  _                                   
                              |  ____/  / ___) / _  ) /___) / _  )|  _ \ |  _)  /___)(_)                                  
                              | |      | |    ( (/ / |___ |( (/ / | | | || |__ |___ | _                                   
                              |_|      |_|     \____)(___/  \____)|_| |_| \___)(___/ (_)                                  
                    ______  _                     _              _                   _                                    
                   / _____)| |                   (_)            | |                 | |                                   
                  | /      | |  ____   ___   ___  _   ____       \ \   ____    ____ | |  _   ____                         
                  | |      | | / _  | /___) /___)| | / ___)       \ \ |  _ \  / _  || | / ) / _  )                        
                  | \_____ | |( ( | ||___ ||___ || |( (___    _____) )| | | |( ( | || |< ( ( (/ /                         
                   \______)|_| \_||_|(___/ (___/ |_| \____)  (______/ |_| |_| \_||_||_| \_) \____)                        
                                                                                                                          
					Snake originally written by mock @otland.net
----------------------------------------------------------------------------------------------------------------------------
	Access:	Talkactions:									Example:
	5		/rsnakegvalue -- Set global storage to 0 (if snake is bugging)		/rsnakegvalue yes
	5		/rsnakehighscore -- Reset Snake server highscore				/rsnakehighscore yes
	0		/resetsnake -- Reset your own highscore					/resetsnake yes
----------------------------------------------------------------------------------------------------------------------------

							*Rewritten to mod
							*Added configurations
							*Added SQL Highscore System
							*Added Talkactions
							 by Pheenix @otland.net

----------------------------------------------------------------------------------------------------------------------------

					SQL Querys for highscores:

					Query 1:
					ALTER TABLE `accounts` ADD
					`snakehigh` bigint(20) NOT NULL DEFAULT 0;  

					Query 2:
					CREATE TABLE IF NOT EXISTS `game_highscores` (
             				`id` int(11) NOT NULL auto_increment,
              			`snake` bigint(20) NOT NULL,
              			`snakename` int(11) NOT NULL,
              			PRIMARY KEY  (`id`)
            				) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;  
		
					Query 3:
					INSERT INTO `game_highscores` VALUES (NULL,0,1);

----------------------------------------------------------------------------------------------------------------------------

	]]></description>
<config name="snake-Conf"><![CDATA[
sConf = {
							-- Configuration --
----------------------------------------------------------------------------------------------------------------------------
    itemid=11756, -- Snake
    freeglobalstorage=28107, -- If you dont know what it does, dont touch it!
    itemFood=10000, -- Food item
    controlpos={x=30732,y=31535,z=6}, -- Control position (center position one level above the playing area)
    exitpos = {x=30731,y=31524,z=7}, -- Where to go when the game has ended.
    centerpos={x=30731,y=31534,z=7} -- Center Position of the playing area (9 squares high and 13 squares wide, the border around is not included in this)
----------------------------------------------------------------------------------------------------------------------------
						      -- Configuration End --
		}
]]></config>
<lib name="snake-lib"><![CDATA[
domodlib('snake-Conf')

function getServerSnakeHigh()
local random = db.getResult("SELECT `snake` FROM `game_highscores` WHERE `id` = 1 LIMIT 1")
       if random:getID() ~= LUA_ERROR then
        	local snake=random:getDataInt("snake")
        	random:free()
        	return snake
    	end
     	return LUA_ERROR
end

function getServerSnakeHname()
local sHname = db.getResult("SELECT `snakename` FROM `game_highscores` WHERE `id` = 1 LIMIT 1")
       if sHname:getID() ~= LUA_ERROR then
        	local snakename=sHname:getDataInt("snakename")
        	sHname:free()
        	return snakename
    	end
     	return LUA_ERROR
end

function getPlayerSnakeHigh(cid)
	local Info = db.getResult("SELECT `snakehigh` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        	local snakehigh=Info:getDataInt("snakehigh")
        	Info:free()
        	return snakehigh
    		end
     		return LUA_ERROR
end



SNAKE = {
	timer = function(cid,n,pos_,time)
		local pos_ = pos_ or {{sConf.centerpos}}
		setGlobalStorageValue(sConf.freeglobalstorage,cid)
		if not isPlayer(cid) then
			SNAKE.clean()
			return
		end
			for i,pos in pairs(pos_) do
				SNAKE.find_and_delete(pos[1])
				if i == 1 then
					pos[2] = SNAKE.copypos(pos[1])
					pos[1] = getPosByDir({x=pos[1].x,y=pos[1].y,z=pos[1].z,stackpos=255},getCreatureLookDir(cid))
				else
					pos[2] = SNAKE.copypos(pos[1])
					pos[1] = pos_[i-1][2]
				end
				local ret,p,walk = SNAKE.check(pos[1])
				if ret == 1 or ret == 3 then
					addEvent(doTeleportThing,1000,cid,sConf.exitpos)
					addEvent(doCreatureSay,1100,cid,'I got '..(#pos_-1)..' points.',34)
					
					local sHigh = getServerSnakeHigh()
					local sHname = getPlayerNameByGUID(getServerSnakeHname())
					local score = tonumber(#pos_-1)
					local snakehigh = getPlayerSnakeHigh(cid)
					local shit = 1

					if snakehigh == 0 then
							if score > sHigh then 
									if sHigh == 0 then
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has set the first highscore in Classic Snake and it is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									else
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has beaten "..sHname.."s server highscore of "..sHigh.." in Classic Snake. The server highscore is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									end
								db.executeQuery("UPDATE `game_highscores` SET `snake` = '"..score.."',`snakename` = '"..getPlayerGUID(cid).."' WHERE `id` ="..shit..";")
							end
						 doPlayerPopupFYI(cid, "Your highscore is now "..score.."!")
						 doPlayerSendTextMessage(cid,4, "[Classic Snake]: Your highscore is now "..score.."!")
						 db.query("UPDATE `accounts` SET `snakehigh` = "..score.." WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
						SNAKE.clean()
						setGlobalStorageValue(sConf.freeglobalstorage,0)
					return
						
					elseif (snakehigh > score) or (snakehigh == score) or (snakehigh == nil) then
							if score > sHigh then 
									if sHigh == 0 then
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has set the first highscore in Classic Snake and it is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									else
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has beaten "..sHname.."s server highscore of "..sHigh.." in Classic Snake. The server highscore is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									end
								db.executeQuery("UPDATE `game_highscores` SET `snake` = '"..score.."',`snakename` = '"..getPlayerGUID(cid).."' WHERE `id` ="..shit..";")
							end
						SNAKE.clean()
						setGlobalStorageValue(sConf.freeglobalstorage,0)
					return
					elseif snakehigh < score then
							if score > sHigh then 
									if sHigh == 0 then
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has set the first highscore in Classic Snake and it is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									else
										doBroadcastMessage("[Classic Snake]: "..getPlayerName(cid).." has beaten "..sHname.."s server highscore of "..sHigh.." in Classic Snake. The server highscore is now "..score.."!", MESSAGE_EVENT_ADVANCE)				
									end
								db.executeQuery("UPDATE `game_highscores` SET `snake` = '"..score.."',`snakename` = '"..getPlayerGUID(cid).."' WHERE `id` ="..shit..";")
							end
						 doPlayerPopupFYI(cid, "You beat your old highscore of "..snakehigh..". \nYour new highscore is now "..score.."!")
						 doPlayerSendTextMessage(cid,4, "[Classic Snake]: You beat your old highscore of "..snakehigh..". \nYour new highscore is now "..score.."!")
						 db.executeQuery("UPDATE `accounts` SET `snakehigh` = '"..score.."' WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
						SNAKE.clean()
						setGlobalStorageValue(sConf.freeglobalstorage,0)
					return
					end
				end
				if ret == 2 then
					doRemoveItem(p.uid,-1)
					if p.itemid == sConf.itemFood then
						pos_[#pos_+1] = {pos[2],pos[2]}
						for i=1,5 do
							addEvent(doSendMagicEffect,100*i,pos[1],29)
						end
						SNAKE.generateFood()
					end
				end
				doCreateItem(sConf.itemid,1,pos[1])
 
			end
			local plpos = getCreaturePosition(cid)
			local generated = {}
			for i=0,3 do
				generated[i] = getPosByDir({x=sConf.controlpos.x,y=sConf.controlpos.y,z=sConf.controlpos.z},i)
			end
			for i,pos in pairs(generated) do
				if SNAKE.samepos(plpos,pos) then
 
					doTeleportThing(cid,sConf.controlpos,false)
				end
				addEvent(doSendMagicEffect,100,pos,56,cid)
			end
		addEvent(SNAKE.timer,time,cid,n,pos_,time)
	end,
	copypos = function(p)
		return {x=p.x,y=p.y,z=p.z,stackpos=p.stackpos}
	end,
	samepos = function(p1,p2)
		if p1.x == p2.x and p2.y == p2.y then
			return true
		end
		return false
	end,
	generateFood = function()
		local pp = {x=sConf.centerpos.x+math.random(-6,6),y=sConf.centerpos.y+math.random(-4,4),z=sConf.centerpos.z}
		for i=1,5 do
			addEvent(doSendMagicEffect,100*i,pp,30)
		end
		doCreateItem(sConf.itemFood,1,pp)
	end,
	clean = function()
		for y=-4,4 do
			for x=-6,6 do
				local pp = {x=sConf.centerpos.x+x,y=sConf.centerpos.y+y,z=sConf.centerpos.z}
				for i=250,255 do
					pp.stackpos = i
					local p = getThingFromPos(pp)
					if p.itemid ~= 0 then
						doRemoveItem(p.uid,-1)
						doSendMagicEffect(pp,15)
					end
				end
			end
		end
	end,
	check = function(pos)
		for i=1,10 do
			pos.stackpos = i
			local p = getThingFromPos(pos)
			if p.itemid == sConf.itemid then
				return 1,p,true
			elseif not SNAKE.isWalkable(pos) then
				return 3,p,false
			elseif p.itemid ~= 0 then
				return 2,p
			end
		end
		return false
	end,
	find_and_delete = function(pos)
		for i=0,255 do
			pos.stackpos = 255-i
			local p = getThingFromPos(pos)
			if p.itemid == sConf.itemid then
				return doRemoveItem(p.uid,1)
			end
		end
	end,
	isWalkable = function(pos, creature, proj, pz)-- by Nord
			if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then 
			return false 
			end
			if getTopCreature(pos).uid > 0 and creature then 
			return false 
			end
			if getTileInfo(pos).protection and pz then 
			return false, true 
			end
			local n = not proj and 3 or 2
			for i = 0, 255 do
			pos.stackpos = i
			local tile = getTileThingByPos(pos)
			if tile.itemid ~= 0 and not isCreature(tile.uid) then
				if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
					return false
				end
			end
		end
		return true
	end,
}





]]></lib>

<action uniqueid="9000" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onUse(cid, item, frompos, item2, topos)
	if not isPlayer(getGlobalStorageValue(sConf.freeglobalstorage)) then
		doTeleportThing(cid,sConf.controlpos)
		SNAKE.timer(cid,1,nil,item.actionid == 0 and 500 or item.actionid)
		doPlayerSendTextMessage(cid,17,'[Classic Snake]: Hold key CTRL and use the arrows to control snake.')
		SNAKE.generateFood()
	else
		doPlayerSendTextMessage(cid,17,'Please wait.')
	end
end
]]></action>
<action uniqueid="9001" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onUse(cid, item, frompos, item2, topos)
	if not isPlayer(getGlobalStorageValue(sConf.freeglobalstorage)) then
		doTeleportThing(cid,sConf.controlpos)
		SNAKE.timer(cid,1,nil,item.actionid == 0 and 500 or item.actionid)
		doPlayerSendTextMessage(cid,25,'Hold key CTRL and use the arrows to control snake.')
		SNAKE.generateFood()
	else
		doPlayerSendTextMessage(cid,25,'Please wait.')
	end
end
]]></action>
<action uniqueid="9002" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onUse(cid, item, frompos, item2, topos)
	if not isPlayer(getGlobalStorageValue(sConf.freeglobalstorage)) then
		doTeleportThing(cid,sConf.controlpos)
		SNAKE.timer(cid,1,nil,item.actionid == 0 and 500 or item.actionid)
		doPlayerSendTextMessage(cid,25,'Hold key CTRL and use the arrows to control snake.')
		SNAKE.generateFood()
	else
		doPlayerSendTextMessage(cid,25,'Please wait.')
	end
end
]]></action>
<talkaction log="yes" words="/rsnakegvalue;!rsnakegvalue" access="5" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onSay(cid, words, param, channel)
	if param == "" then
		doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset the global storage value of snake write: /rsnakegvalue yes")
		return true
	end
	if param == "yes" then
		setGlobalStorageValue(sConf.freeglobalstorage,0)
		doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted the global storage for Classic Snake.")
		return true
	end
end
]]></talkaction>

<talkaction log="yes" words="/resetsnake;!resetsnake" access="0" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onSay(cid, words, param, channel)
	if param == "" then
		doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset your highscore for Classic Snake write: /resetsnake yes")
		return true
	end
	if param == "yes" then
		doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted your highscore for Classic Snake.")
		db.executeQuery("UPDATE `accounts` SET `snakehigh` = '0' WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
		return true
	end
end
]]></talkaction>

<talkaction log="yes" words="/rsnakehighscore;!rsnakehighscore" access="5" event="script"><![CDATA[
domodlib('snake-Conf')
domodlib('snake-lib')
function onSay(cid, words, param, channel)
	if param == "" then
		doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset the server highscore for Classic Snake write: /rsnakehighscore yes")
		return true
	end

	if (param == "yes" and (getPlayerGuildName(cid) == 'PAG Crew')) then
		db.query("UPDATE `game_highscores` SET `snake` = 0 AND 'snakename' = "..getPlayerGUID(cid).." WHERE `id` = 1;")
		doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted the server highscore for Classic Snake.")
		return true
	end
end
]]></talkaction>
</mod>

- - - Updated - - -

If a moderator would be so kind and remove the ' in the title.. it's not Mock is, it's Mocks >_<
 
Last edited:
sorry what is that about querys? where should i paste that?

- - - Updated - - -

When i loose in the game this happens and it kick me with a debug exclamation:

Lua:
[11/01/2013 15:39:04] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such table: game_highscores (SELECT "snake" FROM "game_highscores" WHERE "id" = 1 LIMIT 1)

[11/01/2013 15:39:04] [Error - Action Interface] 
[11/01/2013 15:39:04] In a timer event called from: 
[11/01/2013 15:39:04] buffer:onUse
[11/01/2013 15:39:04] Description: 
[11/01/2013 15:39:04] data/lib/004-database.lua:60: [Result:getDataInt] Result not set!
[11/01/2013 15:39:04] stack traceback:
[11/01/2013 15:39:04] 	[C]: in function 'error'
[11/01/2013 15:39:04] 	data/lib/004-database.lua:60: in function 'getDataInt'
[11/01/2013 15:39:04] 	[string "domodlib('snake-Conf')..."]:6: in function 'getServerSnakeHigh'
[11/01/2013 15:39:04] 	[string "domodlib('snake-Conf')..."]:57: in function <[string "domodlib('snake-Conf')..."]:36>
 
You are using sqlite.. i suggest compiling with MySQL or changing to a MySQL database and run the queries in phpmyadmin.. if you however want to stay with sqlite you can use a sqlite manager of some kind and run the queries (may be refered to as questions) in the forgottenserver.s3db file in your server folder.
 
sorry i changed to mysql, now i have this error with debug:

Lua:
[12/01/2013 09:10:29] mysql_real_query(): SELECT `snake` FROM `game_highscores` WHERE `id` = 1 LIMIT 1 - MYSQL ERROR: Table 'theforgottenserver.game_highscores' doesn't exist (1146)

[12/01/2013 09:10:29] [Error - Action Interface] 
[12/01/2013 09:10:29] In a timer event called from: 
[12/01/2013 09:10:29] buffer:onUse
[12/01/2013 09:10:29] Description: 
[12/01/2013 09:10:29] data/lib/004-database.lua:60: [Result:getDataInt] Result not set!
[12/01/2013 09:10:29] stack traceback:
[12/01/2013 09:10:29] 	[C]: in function 'error'
[12/01/2013 09:10:29] 	data/lib/004-database.lua:60: in function 'getDataInt'
[12/01/2013 09:10:29] 	[string "domodlib('snake-Conf')..."]:6: in function 'getServerSnakeHigh'
[12/01/2013 09:10:29] 	[string "domodlib('snake-Conf')..."]:57: in function <[string "domodlib('snake-Conf')..."]:36>

that's when i loose in the game
 
Last edited:
ooh, and do i have to do that everytime? everyday? or just once?
 
Code:
Description:
(luaGetPlayerNameByGUID) Player not found
Lua:
local sHname = getPlayerNameByGUID(getServerSnakeHname())
Lua:
function getServerSnakeHname()
local sHname = db.getResult("SELECT `snakename` FROM `game_highscores` WHERE `id` = 1 LIMIT 1")
       if sHname:getID() ~= LUA_ERROR then
        	local snakename=sHname:getDataInt("snakename")
        	sHname:free()
        	return snakename
    	end
     	return LUA_ERROR
end

TFS 3777
 
Code:
Description:
(luaGetPlayerNameByGUID) Player not found
Lua:
local sHname = getPlayerNameByGUID(getServerSnakeHname())
Lua:
function getServerSnakeHname()
local sHname = db.getResult("SELECT `snakename` FROM `game_highscores` WHERE `id` = 1 LIMIT 1")
       if sHname:getID() ~= LUA_ERROR then
        	local snakename=sHname:getDataInt("snakename")
        	sHname:free()
        	return snakename
    	end
     	return LUA_ERROR
end

TFS 3777



Go into your mysql database, -> game_gamehighscores -> alter the Id 1 and replace 0 with 1 in the snakename field and make sure you have a character with GUID 1, else enter any other GUID (id in players table)
must be on ID 1 in game_highscores


Fixed in main post now,
Code:
INSERT INTO `game_highscores` VALUES (NULL,0,0);
Should be:
Code:
INSERT INTO `game_highscores` VALUES (NULL,0,1);
but dont run it again.. it will make a new ID if you do.
 
Last edited:
Go into your mysql database, -> game_gamehighscores -> alter the Id 1 and replace 0 with 1 in the snakename field and make sure you have a character with GUID 1, else enter any other GUID (id in players table)
must be on ID 1 in game_highscores


Fixed in main post now,
Code:
INSERT INTO `game_highscores` VALUES (NULL,0,0);
Should be:
Code:
INSERT INTO `game_highscores` VALUES (NULL,0,1);
but dont run it again.. it will make a new ID if you do.

Thanks, now working :)

@Dvse:
you had same problem as me.
SQL:
UPDATE `game_highscores` SET `snakename` = '1';
 
If a moderator would be so kind and remove the ' in the title.. it's not Mock is, it's Mocks >_<
I'm not sure you understand the English language... Mock's is gramatically correct, it means it belongs to Mock, so "Mock's Classic Snake" is the same as "Classic Snake that belongs to Mock". "Mocks" alone without the ' doesn't imply possession in any way.
 
I'm not sure you understand the English language... Mock's is gramatically correct, it means it belongs to Mock, so "Mock's Classic Snake" is the same as "Classic Snake that belongs to Mock". "Mocks" alone without the ' doesn't imply possession in any way.
im not sure i understand either.. i just dont like how it looks
 
Hey! Ive done exactly like I should (I guess) but somehow when I click on one of the crystals I just get tped out, is there anybody that would like to take a look at my code or atlest try to help me in any way? Send me a PM! Thank you!
 
Code:
[16:30:06.186] Description:
[16:30:06.186] [string "sConf = {..."]:8: '}' expected (to close '{' at line 1) near '874'

[16:30:06.186] [Error - TalkAction Interface]
[16:30:06.186] domodlib('snake-Conf')
[16:30:06.186] domodlib('snake-lib')
[16:30:06.186] function onSay(cid, words, param, channel)
[16:30:06.186] if param == "" then
[16:30:06.186] doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset your highscore for Classic Snake write: /resetsnake yes")
[16:30:06.187] return true
[16:30:06.187] end
[16:30:06.187] if param == "yes" then
[16:30:06.187] doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted your highscore for Classic Snake.")
[16:30:06.187] db.executeQuery("UPDATE `accounts` SET `snakehigh` = '0' WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
[16:30:06.187] return true
[16:30:06.187] end
[16:30:06.187] end

[16:30:06.187] Description:
[16:30:06.187] [string "sConf = {..."]:8: '}' expected (to close '{' at line 1) near '874'

[16:30:06.187] [Error - TalkAction Interface]
[16:30:06.187] domodlib('snake-Conf')
[16:30:06.187] domodlib('snake-lib')
[16:30:06.187] function onSay(cid, words, param, channel)
[16:30:06.187] if param == "" then
[16:30:06.187] doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset the server highscore for Classic Snake write: /rsnakehighscore yes")
[16:30:06.187] return true
[16:30:06.187] end

[16:30:06.187] if (param == "yes" and (getPlayerGuildName(cid) == 'PAG Crew')) then
[16:30:06.187] db.query("UPDATE `game_highscores` SET `snake` = 0 AND 'snakename' = "..getPlayerGUID(cid).." WHERE `id` = 1;")
[16:30:06.187] doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted the server highscore for Classic Snake.")
[16:30:06.187] return true
[16:30:06.187] end
[16:30:06.187] end

[16:30:06.187] Description:
[16:30:06.187] [string "sConf = {..."]:8: '}' expected (to close '{' at line 1) near '874'

[16:30:06.187] [Error - TalkAction Interface]
[16:30:06.187] domodlib('snake-Conf')
[16:30:06.187] domodlib('snake-lib')
[16:30:06.187] function onSay(cid, words, param, channel)
[16:30:06.187] if param == "" then
[16:30:06.187] doPlayerSendTextMessage(cid,35, "[Classic Snake]: If you really want to reset the server highscore for Classic Snake write: /rsnakehighscore yes")
[16:30:06.187] return true
[16:30:06.187] end

[16:30:06.187] if (param == "yes" and (getPlayerGuildName(cid) == 'PAG Crew')) then
[16:30:06.187] db.query("UPDATE `game_highscores` SET `snake` = 0 AND 'snakename' = "..getPlayerGUID(cid).." WHERE `id` = 1;")
[16:30:06.187] doPlayerSendTextMessage(cid,4, "[Classic Snake]: You have reseted the server highscore for Classic Snake.")
[16:30:06.187] return true
[16:30:06.187] end
[16:30:06.187] end

[16:30:06.187] Description:
[16:30:06.187] [string "sConf = {..."]:8: '}' expected (to close '{' at line 1) near '874'
This error from it.
 
Last edited:
Back
Top