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

Poprawa skryptu

Status
Not open for further replies.

Pawcio6

Member
Joined
Sep 26, 2009
Messages
144
Solutions
4
Reaction score
15
Witam mam problem z tym skryptem(tfs 0.3.6)
PHP:
local stages = {
{ from = 1, to = 49 },
{ from = 50, to = 110 },
{ from = 111, to = 1199990 }
}

function onCombat(cid, target)
local level = getPlayerLevel(cid)
if isPlayer(target) then
local target_level = getPlayerLevel(target)
for i = 1, #stages do
if level >= stages[i].from and level <= stages[i].to then
if target_level >= stages[i].from and target_level <= stages[i].to then
return true
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nie mozesz atakowac tej postaci.")
end
end
end
end
return false
end
skrypt dziala lecz gdy jest wlaczony nie mozna zaznaczyc/atakowac potworka probowalem pozamieniac return true/false ale wtedy skrypt przestawal dzialac(mozna bylo potwory bic)
bledow zadnych w silniku nie ma
 
sprawdź to:
LUA:
local stages = {
{ from = 1, to = 49 },
{ from = 50, to = 110 },
{ from = 111, to = 1199990 }
}

function onCombat(cid, target)
local level = getPlayerLevel(cid)
	if isPlayer(target) == true then
	local target_level = getPlayerLevel(target)
		for i = 1, #stages do
			if level >= stages[i].from and level <= stages[i].to then
				if target_level >= stages[i].from and target_level <= stages[i].to then
				return true
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nie mozesz atakowac tej postaci.")
				end
			end
		end
	elseif isPlayer(target) == false then
	end
	return true
end
 
Hmm cos jest nadal zle gdy chcem kogos zaatakowac to wyskakuje "Nie mozesz ..." ale normalnie hity zadajesz z mobami jest juz dobrze
 
No to spróbuj tak:
LUA:
local stages = {
{ from = 1, to = 49 },
{ from = 50, to = 110 },
{ from = 111, to = 1199990 }
}

function onCombat(cid, target)
local level = getPlayerLevel(cid)
	if isPlayer(target) == true then
	local target_level = getPlayerLevel(target)
		for i = 1, #stages do
			if level >= stages[i].from and level <= stages[i].to then
				if target_level >= stages[i].from and target_level <= stages[i].to then
				return true
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nie mozesz atakowac tej postaci.")
					return false
				end
			end
		end
	elseif isPlayer(target) == false then
	end
	return true
end
 
Status
Not open for further replies.
Back
Top