• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Help] Script Posting 8 messages!!

Shinmaru

エロルアー Scripter!
Joined
Aug 20, 2007
Messages
1,988
Reaction score
88
Location
Puerto Rico
I made this script, it works and all, but...
Why is the script posting 8 messages at a time??
I would really appreciate the help!
Code:
local attr =  {
	stock = 2800,
	str = 2801,
	agi = 2802,
	hth = 2803,
	ene = 2804,
	mlpool = 2805
}
local v = {
	[1] = {st = 1, ag = 2, ht = 3, en = 5, mlReq = 4},
	[2] = {st = 1, ag = 2, ht = 3, en = 5, mlReq = 4},
	[3] = {st = 3, ag = 3, ht = 3, en = 3, mlReq = 6},
	[4] = {st = 5, ag = 3, ht = 4, en = 1, mlReq = 8},
	[5] = {st = 2, ag = 4, ht = 6, en = 10, mlReq = 2},
	[6] = {st = 2, ag = 4, ht = 6, en = 10, mlReq = 2},
	[7] = {st = 6, ag = 6, ht = 6, en = 6, mlReq = 3},
	[8] = {st = 10, ag = 6, ht = 8, en = 2, mlReq = 4}
}
function onSay(cid, words, param)
	local stockPoints = getPlayerStorageValue(cid, attr.stock)
	local MLpool = getPlayerStorageValue(cid, attr.mlpool)
	local weaponTypes = {1, 2, 3, 5, 6}
	local helmet = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
	local armor = getPlayerSlotItem(cid, CONST_SLOT_ARMOR)
	local legs = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
	local boots = getPlayerSlotItem(cid, CONST_SLOT_FEET)
	local rightHand = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
	local leftHand = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
	local strength = getPlayerStorageValue(cid, attr.str)
	local agility = getPlayerStorageValue(cid, attr.agi)
	local energy = getPlayerStorageValue(cid, attr.ene)
	local health = getPlayerStorageValue(cid, attr.hth)
	for voc, info in pairs(v) do   
		if isNumber(param) then
			if tonumber(param) <= stockPoints then
				plrl = "points"
						if words == "!addStr" then
							doPlayerSetStorageValue(cid, attr.str, strength+param)
							doPlayerSetStorageValue(cid, attr.stock, stockPoints-param)
							doPlayerSendTextMessage(cid, 25, "You added "..param.." "..plrl.." to Strength.")
							if getPlayerVocation(cid) == voc then
								local strength2 = getPlayerStorageValue(cid, attr.str)
								local strfrm = strength2*info.st
								if isInArray(weaponTypes, getItemWeaponType(rightHand.uid)) then
									setItemExtraAttack(rightHand.uid, strfrm)
								elseif isInArray(weaponTypes, getItemWeaponType(leftHand.uid)) then    
									setItemExtraAttack(leftHand.uid, strfrm)
								end
							end    
						end
						if words == "!addAgi" then
							doPlayerSetStorageValue(cid, attr.agi, agility+param)
							doPlayerSetStorageValue(cid, attr.stock, stockPoints-param)
							doPlayerSendTextMessage(cid, 25, "You added "..param.." "..plrl.." to Agility.")
							if getPlayerVocation(cid) == voc then
								local agility2 = getPlayerStorageValue(cid, attr.agi)
								local agifrm = agility2*info.ag
								if isInArray(weaponTypes, getItemWeaponType(rightHand.uid)) or getItemWeaponType(rightHand.uid) == 4 then
									setItemExtraDefense(rightHand.uid, agifrm)
									if getItemAttackSpeed(rightHand.uid) > 0 then
											setItemAttackSpeed(rightHand.uid, agifrm)
									end
								end    
								if isInArray(weaponTypes, getItemWeaponType(leftHand.uid)) or getItemWeaponType(leftHand.uid) == 4 then
									setItemExtraDefense(leftHand.uid, agifrm)
									if getItemAttackSpeed(leftHand.uid) > 0 then
										setItemAttackSpeed(leftHand.uid, agifrm)
									end    
								end	
							end    
						end
						if words == "!addHealth" then
							doPlayerSetStorageValue(cid, attr.hth, health+param)
							doPlayerSetStorageValue(cid, attr.stock, stockPoints-param)
							doPlayerSendTextMessage(cid, 25, "You added "..param.." "..plrl.." to Health.")
							if getPlayerVocation(cid) == voc then
								local health2 = getPlayerStorageValue(cid, attr.hth)
								local hthfrm = health2*info.ht
								setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+hthfrm)
								doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
							end    
						end
						if words == "!addEnergy" then
							doPlayerSetStorageValue(cid, attr.ene, energy+param)
							doPlayerSetStorageValue(cid, attr.stock, stockPoints-param)
							doPlayerSendTextMessage(cid, 25, "You added "..param.." "..plrl.." to Energy.")
							if getPlayerVocation(cid) == voc then
								local energy2 = getPlayerStorageValue(cid, attr.ene)
								local enefrm = energy2*info.en
								setCreatureMaxMana(cid, getCreatureMaxMana(cid)+enefrm)
								doCreatureAddMana(cid, getCreatureMaxMana(cid))
							end	
						end	
						if words == "!addML" then
							if getPlayerVocation(cid) == voc then
								if tonumber(param) == info.mlReq then
									doPlayerSetStorageValue(cid, attr.stock, stockPoints-param)
									doPlayerSetStorageValue(cid, attr.mlpool, MLpool+1)
									doPlayerAddSkill(cid, SKILL__MAGLEVEL, 1)
									doPlayerAddSpentMana(cid, 50)
									doPlayerSendTextMessage(cid, 25, "Magic Level +1.")
									doCreatureAddMana(cid, getCreatureMaxMana(cid))
								else
									doPlayerSendCancel(cid, "You need "..info.mlReq.." points to get 1 Magic Level.")
								end	
							end
						end	
			else
				doPlayerSendCancel(cid, "You don't have enough points to add.")
			end
		else
			doPlayerSendCancel(cid, "Please specify a number.")
		end
	end	
return true 		
end
 
and how should I change this to still get the info that I want and to only send one text at a time?
Edit:
will this work the same way?
local voc = v[getPlayerVocation(cid)]
 
NVM. I have already figured it out, but one question, how can do I make a
creaturescript with 'onDeath' to work that if player dies it removes storage
values???
 
Back
Top