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

Script for Avesta!

Veterana

Oldschool Player
Joined
May 4, 2010
Messages
194
Reaction score
7
I need a few scripts for avesta.
If anyone can help me out i will rep+ and crown as a king :)


Promotion Item
When item is used it should add promotion to the player.

Remove Redskull Item
When item is used it should remove redskull from player.

Change Name Item
When item is used it should change name of the player.

Change Sex Item
When item is used it should change sex of the player.
 
Redskull Item - In Actions create file called remove.lua
PHP:
-- Skull remove by X_anero
function onUse(cid, item, frompos, item2, topos)
local removingitem = "yes"
local removeRedSkull = "yes"
if((getPlayerSkullType(cid) ~= SKULL_RED or removeRedSkull == "yes") or getPlayerSkullType(cid) ~= SKULL_GREEN) then
    doCreatureSetSkullType(cid, SKULL_NONE)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You don't have any skull now.")
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
    doPlayerSetRedSkullTicks(cid, 0)
else
    doPlayerSendCancel(cid,"You can't remove red or black skull.")
end
if(removingitem == "yes") then
    if(item.type > 1) then
        doChangeTypeItem(item.uid, item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
end
end

Actions.xml
PHP:
<action itemid="2271" script="skull remove.lua" />
Item ID - (Player presses on item to remove Redskull)
________________________________________________________________________________
Change Sex Item - NOT TESTED[/U]
action/scripts/changesex.lua -
PHP:
--- Written by X_anero
function onUse(cid, item, fromposition, itemex, toposition)
if( getPlayerSex(cid) == 0 )then 
 doPlayerSetSex(cid, 1)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 else
 if( getPlayerSex(cid) == 1 ) then 
 doPlayerSetSex(cid, 0)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 end 
 return true 
 end 
 end

actions.xml
PHP:
<action actionid="xxxx" event="script" value="changsex.lua"/>
________________________________________________________________________
Promotion Item - NOT TESTED
Action/script/promotionitem.lua
PHP:
--- Written by X_anero
function onUse(cid, item, frompos, item2, topos)
 if item.itemid == 2279 then
 local playerpos = getCreaturePosition(cid)
 doRemoveItem(item.uid,2279)
 doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
 doSendMagicEffect(playerpos, 12)
 doPlayerSendTextMessage(cid,22,"You just got Promoted!.")
 end
 end

Actions.xml
PHP:
<action itemid="2279" script="promotionitem.lua" />
___________________________________________________________
 
Redskull Item - In Actions create file called remove.lua
PHP:
-- Skull remove by X_anero
function onUse(cid, item, frompos, item2, topos)
local removingitem = "yes"
local removeRedSkull = "yes"
if((getPlayerSkullType(cid) ~= SKULL_RED or removeRedSkull == "yes") or getPlayerSkullType(cid) ~= SKULL_GREEN) then
    doCreatureSetSkullType(cid, SKULL_NONE)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You don't have any skull now.")
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
    doPlayerSetRedSkullTicks(cid, 0)
else
    doPlayerSendCancel(cid,"You can't remove red or black skull.")
end
if(removingitem == "yes") then
    if(item.type > 1) then
        doChangeTypeItem(item.uid, item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
end
end

Actions.xml
PHP:
<action itemid="2271" script="skull remove.lua" />
Item ID - (Player presses on item to remove Redskull)
________________________________________________________________________________
Change Sex Item - NOT TESTED[/U]
action/scripts/changesex.lua -
PHP:
--- Written by X_anero
function onUse(cid, item, fromposition, itemex, toposition)
if( getPlayerSex(cid) == 0 )then 
 doPlayerSetSex(cid, 1)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 else
 if( getPlayerSex(cid) == 1 ) then 
 doPlayerSetSex(cid, 0)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 end 
 return true 
 end 
 end

actions.xml
PHP:
<action actionid="xxxx" event="script" value="changsex.lua"/>
________________________________________________________________________
Promotion Item - NOT TESTED
Action/script/promotionitem.lua
PHP:
--- Written by X_anero
function onUse(cid, item, frompos, item2, topos)
 if item.itemid == 2279 then
 local playerpos = getCreaturePosition(cid)
 doRemoveItem(item.uid,2279)
 doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
 doSendMagicEffect(playerpos, 12)
 doPlayerSendTextMessage(cid,22,"You just got Promoted!.")
 end
 end

Actions.xml
PHP:
<action itemid="2279" script="promotionitem.lua" />
___________________________________________________________



use lua tags also try to tab your codes bro :)
 
- - - Updated - - -

Redskull Item - In Actions create file called remove.lua
PHP:
-- Skull remove by X_anero
function onUse(cid, item, frompos, item2, topos)
local removingitem = "yes"
local removeRedSkull = "yes"
if((getPlayerSkullType(cid) ~= SKULL_RED or removeRedSkull == "yes") or getPlayerSkullType(cid) ~= SKULL_GREEN) then
    doCreatureSetSkullType(cid, SKULL_NONE)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You don't have any skull now.")
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
    doPlayerSetRedSkullTicks(cid, 0)
else
    doPlayerSendCancel(cid,"You can't remove red or black skull.")
end
if(removingitem == "yes") then
    if(item.type > 1) then
        doChangeTypeItem(item.uid, item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
end
end

Actions.xml
PHP:
<action itemid="2271" script="skull remove.lua" />
Item ID - (Player presses on item to remove Redskull)
________________________________________________________________________________
Change Sex Item - NOT TESTED[/U]
action/scripts/changesex.lua -
PHP:
--- Written by X_anero
function onUse(cid, item, fromposition, itemex, toposition)
if( getPlayerSex(cid) == 0 )then 
 doPlayerSetSex(cid, 1)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 else
 if( getPlayerSex(cid) == 1 ) then 
 doPlayerSetSex(cid, 0)
 doPlayerSendTextMessage(cid,22, "You have changed your Gender")
 doSendMagicEffect(getPlayerPosition(cid), 5)
 end 
 return true 
 end 
 end

actions.xml
PHP:
<action actionid="xxxx" event="script" value="changsex.lua"/>
________________________________________________________________________
Promotion Item - NOT TESTED
Action/script/promotionitem.lua
PHP:
--- Written by X_anero
function onUse(cid, item, frompos, item2, topos)
 if item.itemid == 2279 then
 local playerpos = getCreaturePosition(cid)
 doRemoveItem(item.uid,2279)
 doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
 doSendMagicEffect(playerpos, 12)
 doPlayerSendTextMessage(cid,22,"You just got Promoted!.")
 end
 end

Actions.xml
PHP:
<action itemid="2279" script="promotionitem.lua" />
___________________________________________________________


Sex change worked.

The skull remover dont work at all, not even giving a message.

The promotion thing will keep promoting the player even after he is promotion can this be fixed maybe?
 
Last edited:
Redskull Remover :
actions/scripts - remover.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
	local playerskull = getCreatureSkullType(cid)
	local skulls = {
					SKULL_NONE,
					SKULL_YELLOW,
					SKULL_GREEN,
					SKULL_WHITE
					}
 
	if isInArray(skulls, playerskull) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't remove that skull !")
		return 0
	else
		doCreatureSetSkullType(cid, skulls[1])
		doRemoveItem(item.uid, 1)
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your Skull has been removed !")
	end
return true
en

Try this one.
 
There is no function that set a skull to a player in avesta, rip it from theforgottenserver / otserv
 

Similar threads

Replies
0
Views
276
Back
Top