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

Yellow Skull

Erevius

It Was A Good Day
Joined
Feb 12, 2010
Messages
157
Reaction score
7
Location
Poland/Olsztyn
Jak inaczej zapisać funkcję
Code:
if getCreatureSkullType(cid) == SKULL_YELLOW then
...
<albo>
if getPlayerSkullType(cid) == SKULL_YELLOW then
...
Bo TFS 0.3.6 mi tego nie czyta... ;/ To samo gdy zamiast "skull_yellow" wstawie "1"
 
Last edited:
W ogóle nie wyskakuje, poprostu nie czyta...
Oto mój skrypt na protection system:
Code:
local config = {
maxDiff = 30
}

function onCombat(cid, target)
	if isPlayer(cid) ~= true or isPlayer(target) ~= true then
		return true
	end
	if isSkulled(target) == true or isInParty(cid) == true or getCreatureSkullType(cid) == 1 then
		return true
	end
 
	if isSkulled(target) ~= true and isInParty(cid) ~= true then
		if getPlayerLevel(cid) <= 50 then
			local levels = {getPlayerLevel(cid), getPlayerLevel(target)}
			table.sort(levels)
			if (((levels[2] - levels[1]) * 100) / levels[1]) > config.maxDiff then
				doPlayerSendDefaultCancel(cid, "You may not attack this player.")
				return false
			end
		else
			if getPlayerLevel(target) <= 50 then
				doPlayerSendDefaultCancel(cid, "You may not attack this player.")
				return false
			end
		end
	else
		return true
	end
	return true
end
polega on na tym, że kazdy moze lac RS'ów z nieważne jakim lvlem... Chciałem też zrobić, aby RS mógł "fightback'ować" nawet jezeli atakuje go wiekszy lub mniejszy lvl.
 
Może nie zarejestrowałeś zdarzenia? Ewentualnie, któryś z twoich warunków, a co z tym idzie pominięcie danego fragmentu kodu. Może spróbuj przerobić ten skrypt tak, aby nadawał się idealnie do testu, czy ta funkcja działa ci prawidłowo, czy nie. Wydaje mi się że takie coś powinno zadziałać:
return (getCreatureSkullType(cid) == SKULL_YELLOW and print("True") or print("False"))

Jeśli jednak nie masz tej funkcji, lub masz a działa nie prawidłowo to błąd jest w źródłach, albo stworzonych przez ciebie aliasie (czyli ponownym zarejestrowaniu funkcji o takowej nazwie). Lub może wgrałeś jakiś skrypt który poszerza działanie twojej funkcji, czyli przykładowo stawia jakiś warunek - wygląda to mniej więcej tak:
getCreatureSkullType = _getCreatureSkullType
function getCreatureSkullType(cid)
if (isPlayer(cid) and getPlayerLevel(cid) > 100) then
return _getCreatureSkullType(cid)
end
return SKULL_YELLOW
end

Jeśli masz coś w tym stylu to łatwo idzie to wyszukać, wystarczy tylko użyć rozszerzonego notatnika (przykładowo Notepad++). Jednak jeśli chodzi o pliki źródłowe to sugeruje szukania tego albo w luascript.cpp, lub w player.cpp =).

_________________________________________________

Ogólnie nie wydaje się to trudne, ale jeśli sam tego nie umiesz zrobić, chętnie pomogę odpłatnie.​
 
Last edited:
Z LUA_FUNCTIONS :
Code:
getCreatureSkullType(cid)
				Info
					This function checks creature current skull.

				Returns
					Creature skull.
					For example:
						SKULL_NONE (0) - means, no SKULL_GREEN
						SKULL_YELLOW (1)
						SKULL_GREEN (2)
						SKULL_WHITE (3)
						SKULL_RED (4)
						SKULL_BLACK (5)

Jak nie działa to poprostu szukaj funkcji...
Jeśli nie wiesz czy funkcja wypisuje numer skulla czy nazwe, to wbij sobie charem załóżmy rs'a napisz movement onstepin i żeby w broadcascie/princie była funkcja umieszczona np.
print('Twoj skull to ' .. getCreatureSkullType(cid) .. '.') i będziesz wiedział
 
Back
Top