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

Solved Special Description error

Boza

New Member
Joined
Feb 16, 2010
Messages
184
Reaction score
0
Code:
function onUse(cid, item)
    local mode = getPlayerPVPMode(cid)
    if mode == 1 then
        setMode = 0
    else
        setMode = 1
    end
    if isPlayerPzLocked(cid) == FALSE and getCreatureSkullType(cid) == SKULL_NONE then
        setPlayerPVPMode(cid, setMode)
        if setMode == 1 then
            doPlayerSendTextMessage(cid, 25, "You are now Pvp-Enabled!")
			[COLOR="Red"]doPlayerSetSpecialDescription(cid, Pvp Enabled)[/COLOR]
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_STUN)
        else
            doPlayerSendTextMessage(cid, 25, "You are now Pvp-Disabled!")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_STUN)
        end
    else
        doPlayerSendCancel(cid, "You cannot change pvp when Skulled.")
    end
	
	doRemoveItem(cid, item.uid, 1)
    return TRUE
end

Code:
 [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/pvpmode.lua:12: ')' expected near 'Enabled'
 [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/pvpmode.lua)
 data/actions/scripts/other/pvpmode.lua:12: ')' expected near 'Enabled'

Lua: demo

No Idea why this isn't working.
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mode = getPlayerPVPMode(cid)
	local setMode = mode == 1 and 0 or 1
	if not isPlayerPzLocked(cid) and getCreatureSkullType(cid) == SKULL_NONE then
		setPlayerPVPMode(cid, setMode)
		if setMode == 1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now PvP-Enabled!")
			doPlayerSetSpecialDescription(cid, "Pvp Enabled")
			doSendMagicEffect(getThingPos(cid), CONST_ME_STUN)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now PvP-Disabled!")
			doSendMagicEffect(getThingPos(cid), CONST_ME_STUN)
		end
	else
		return doPlayerSendCancel(cid, "You cannot change PvP when Skulled.")
	end
	return doRemoveItem(cid, item.uid, 1)
end
 
Last edited:
Works perfectly, Also thanks for making the script cleaner.

Edit: Is it possible to make it save the description. Something like maybe in creature scrips. onLogin get player pvp mode. etc etc
 
Last edited:
oops, I made a mistake with header (you can remove it)

about saving, you could save it in a storage value (if they support strings[?])
 
Yeah it should

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mode = getPlayerPVPMode(cid)
	local setMode = mode == 1 and 0 or 1
	if not isPlayerPzLocked(cid) and getCreatureSkullType(cid) == SKULL_NONE then
		setPlayerPVPMode(cid, setMode)
		if setMode == 1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now PvP-Enabled!")
			doPlayerSetSpecialDescription(cid, ". Pvp Enabled")
			doCreatureSetStorage(cid, 1500, 1)
			doSendMagicEffect(getThingPos(cid), CONST_ME_STUN)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now PvP-Disabled!")
			doPlayerSetSpecialDescription(cid, ". Pvp Disabled")
			doCreatureSetStorage(cid, 1500, 0)
			doSendMagicEffect(getThingPos(cid), CONST_ME_STUN)
		end
	else
		return doPlayerSendCancel(cid, "You cannot change PvP when Skulled.")
	end
	return doRemoveItem(cid, item.uid, 1)
end

Working on the creature script
 
Last edited:
Code:
function onlogin(cid)

local storage = 1500

	if getCreatureStorage(cid, 1500, 1) then
		doPlayerSetSpecialDescription(cid, ". Pvp Enabled")
	end	
end

This isnt working, but yall get the idea.
 
Okay, since your descriptions are static you can use just integers in storage.

Add this in your login.lua:
Code:
	doPlayerSetSpecialDescription(cid, ". Pvp " .. (getPlayerStorageValue(cid, 1500) == 0 and "Dis" or "Ena") .. "bled")
 
Thank you sir.
I have a lot to learn, That problem was solved much easier then I thought it could be. Rep++ as usual
 
Back
Top