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

[LUA] Player Protection

Joined
Jun 29, 2010
Messages
151
Reaction score
7
Hello!
I'm requesting script that works as follows:
  • player says in game /protect
  • script check if player is in array, if not - the player get message "You don't have permission to activate protection system.", if the player is in array script is run and the player get msg - "Your protection system was successfully activated."

If the player run the script:
  • monsters and other players can see and attack player but don't cause damage
  • player can attack and kill monsters (& players) normally
  • player can use spells normally (does damage), but it don't takes his mana (he always have full mana)
  • monsters conditions not attack the player (not paralyze, not poison, fire etc.)
  • player never gets PZ lock

Thank you guys! :)
 
Last edited:
Code:
local array = {}
function onSay(cid, words, param, channel)
	if isInArray(array, getCreatureName(cid)) then
		local v = getCreatureStrage(cid, 1234)
		doCreatureSetStorage(cid, 1234, v == -1 and 1 or -1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Your protection has been ' .. (v == -1 and 'activated' or 'disabled') .. '.')
	end
	return true
end

Code:
function onStatsChange(cid, attacker, type, combat, value)
	return (getCreatureStorage(cid, 1234) == 1 and isInArray({STATSCHANGE_HEALTHLOSS, STATSCHANGE_MANALOSS, type) and combat ~= COMBAT_HEALING) and false or true
end
 
Last edited:
Back
Top