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

any kind of globalStorageValue?

Blood BlvD Ot

Member
Joined
Jun 12, 2010
Messages
243
Reaction score
7
like say u run the script once n it goes like this

damage = 0
if smthin then
damage = damage+1

next time the script runs its

damage = 1
if smthin then
damage = damage+1

could someone tell me how to go about creating something like this?
 
If you're looking some type of storage thing, this might work:
LUA:
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid,storage)+1)
 
LUA:
doSetStorage(1000, math.max(1, getStorage(1000) + 1))
You should only use global storage if you want it accessible in other scripts, otherwise you can use a Lua variable since it's much faster (declare it as a local variable before the function)
 
I want it accessable in multiple scripts, I just don't know how to make the global thing save, and to be able to be edited everytime a script runs.. ya know?
 
Cyko if u see this again this is what I'm tryin to make :) plz help me with my idea? :D
Code:
function onKill(cid, target)
local zombieSpawns = {
[1] = {x = 1071, y = 1098, z = 7},
[2] = {x = 1072, y = 1098, z = 7},
[3] = {x = 1070, y = 1107, z = 7},
[4] = {x = 1073, y = 1110, z = 7},
[5] = {x = 1074, y = 1104, z = 7},
[6] = {x = 1073, y = 1119, z = 7},
[7] = {x = 1008, y = 1005, z = 7},
[8] = {x = 1080, y = 1122, z = 7},
[9] = {x = 1089, y = 1116, z = 7},
[10] = {x = 1091, y = 1118, z = 7},
[11] = {x = 1094, y = 1102, z = 7},
[12] = {x = 1096, y = 1093, z = 7},
[13] = {x = 1099, y = 1096, z = 7},
[14] = {x = 1099, y = 1099, z = 7},
[15] = {x = 1086, y = 1093, z = 7} --- BOSS SPAWN POS
}
local zombieBoss = {
[1] = "Zombie Boss One",
[2] = "Zombie Boss Two",
[3] = "Zombie Boss Three"
}
local zombieUnlockPoints = 10259 --- Zombie Game Unlock Points Player Storage
local zombieEventPoints = 10258 --- Zombie Event Item Points :D
zombiesKilled = 0
if isMonster(target) then
	if string.find(getCreatureName(target):lower(), ("Zombie"):lower()) ~= nil then
		zombiesKilled = (zombiesKilled+1)
		doPlayerSay(cid,"".. zombiesKilled .."")
		setPlayerStorageValue(cid,zombieUnlockPoints,(getplayerStorageValue(cid,zombieUnlickPoints)+1))
			if zombiesKilled == 14 then
				doCreateMonster("Zombie Boss One",zombieSpawns[15])
			elseif string.find(getCreatureName(target):lower(), ("Zombie Boss One"):lower()) ~= nil then
				setPlayerStorageValue(cid,zombieEventPoints,(getplayerStorageValue(cid,zombieEventPoints)+1))
				zombieDifficulty = (zombieDifficulty+1)
				doCreateMonster("Zombie",zombieSpawns[#])
			elseif zombiesKilled == 28 then 
				doCreateMonster("Zombie Boss Two",zombieSpawns[15])
			elseif string.find(getCreatureName(target):lower(), ("Zombie Boss Two"):lower()) ~= nil then
				setPlayerStorageValue(cid,zombieEventPoints,(getplayerStorageValue(cid,zombieEventPoints)+2))
				zombieDifficulty = (zombieDifficulty+1)
				doCreateMonster("Zombie",zombieSpawn[#])
			elseif zombiesKilled == 42 then 
				doCreateMonster("Zombie Boss Three",zombieSpawns[15])
			elseif string.find(getCreatureName(target):lower(), ("Zombie Boss Three"):lower()) ~= nil then
				setPlayerStorageValue(cid,zombieEventPoints,(getplayerStorageValue(cid,zombieEventPoints)+3))
				doRemoveCreature(cid) --- need all players in area to be kicked
			end
		end
	end
end
return true 
end
 
LUA:
local zombieSpawns = {
	[1]={x=1071, y=1098, z=7},
	[2]={x=1072, y=1098, z=7},
	[3]={x=1070, y=1107, z=7},
	[4]={x=1073, y=1110, z=7},
	[5]={x=1074, y=1104, z=7},
	[6]={x=1073, y=1119, z=7},
	[7]={x=1008, y=1005, z=7},
	[8]={x=1080, y=1122, z=7},
	[9]={x=1089, y=1116, z=7},
	[10]={x=1091, y=1118, z=7},
	[11]={x=1094, y=1102, z=7},
	[12]={x=1096, y=1093, z=7},
	[13]={x=1099, y=1096, z=7},
	[14]={x=1099, y=1099, z=7},
	[15]={x=1086, y=1093, z=7} --- BOSS SPAWN POS
}
local zombieBoss={
	[1]='zombie boss one',
	[2]='zombie boss two',
	[3]='zombie boss three'
}

local zombieUnlockPoints = 10259 --- Zombie Game Unlock Points Player Storage
local zombieEventPoints = 10258 --- Zombie Event Item Points :D
local killStorage = 1001
local difficultyStorage = 1002

function onKill(cid, target, lastHit)
	if lastHit and isMonster(target) then
		local v = getCreatureName(target):lower()
		if v:find('zombie') then
			local zombiesKilled = math.max(1, getStorage(killStorage) + 1)
			doSetStorage(killStorage, zombiesKilled)
			doCreatureSay(cid, zombiesKilled)
			doCreatureSetStorage(cid, zombieUnlockPoints, getCreatureStorage(cid,zombieUnlockPoints) + 1)
			if zombiesKilled == 14 then
				doCreateMonster(zombieBoss[1], zombieSpawns[15])
			elseif v == zombieBoss[1] then
				doCreatureSetStorage(cid,zombieEventPoints, math.max(0, getCreatureStorage(cid, zombieEventPoints)) + 1)
				doSetStorage(difficultyStorage, math.max(1, getStorage(difficultyStorage) + 1))
				doCreateMonster('Zombie', zombieSpawns[15])
			elseif zombiesKilled == 28 then 
				doCreateMonster(zombieBoss[2], zombieSpawns[15])
			elseif v == zombieBoss[2] then
				doCreatureSetStorage(cid,zombieEventPoints, math.max(0, getCreatureStorage(cid, zombieEventPoints)) + 2)
				doSetStorage(difficultyStorage, getStorage(difficultyStorage) + 1)
				doCreateMonster('Zombie', zombieSpawns[15])
			elseif zombiesKilled == 42 then 
				doCreateMonster(zombieBoss[3], zombieSpawns[15])
			elseif v == zombieBoss[3] then
				doCreatureSetStorage(cid,zombieEventPoints, math.max(0, getCreatureStorage(cid, zombieEventPoints)) + 3)
				for x = 100, 200 do
					for y = 100, 200 do
						for z = 7, 7 do
							local k = getTopCreature({x=x, y=y, z=z}).uid
							if k ~= 0 and isPlayer(k) then
								doRemoveCreature(k)
							end
						end
					end
				end
			end
		end
	end
	return true 
end
 
Back
Top