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

CreatureEvent Get x Frag TO Reward x Outfit

Sirion_Mido

Experienced Member
Joined
Jul 22, 2012
Messages
579
Reaction score
43
Location
E-G-Y-P-T
This script a person requested and i made it
It could be not hard but could be helpful for some people:
How it works?
For example if player have got 10 frags i get outfit reward like warmaster

Here We Are :)
in your creaturescripts/creaturescripts.xml paste the folowing code:
XML:
	<event type="kill" name="FragsReward" event="script" value="FragsReward.lua"/>

now in your creaturescripts/scripts/login.lua
After
Lua:
	registerCreatureEvent(cid, "GuildMotd")
paste
Lua:
	registerCreatureEvent(cid, "FragsReward")

now in your creaturescripts/scripts create file name FragsReward.lua and paste the following:
Lua:
local storage = 9000 -- the storage id
local frags = 10 -- the amount of frags to reward the outfit
local female_outfit = 270 -- here the look type for male outfit
local male_outfit = 271 -- here the look type for female outfit
local a = math.max(0, getCreatureStorage(cid, storage)) + 1

function onKill(cid, target, lastHit)
	if cid ~= target and isPlayer(target) then
		doCreatureSetStorage(cid, storage, a)
end
		if a == frags and (getPlayerSex(cid) == 0) then
			doPlayerAddOutfit(cid,female_outfit)
            else
			doPlayerAddOutfit(cid,male_outfit)
	
end
	return true
end

any errors report back here
Rep++ If It Helpful For You
 
You can add the amount of time it will take for example 10 minutes?
 
I have erros, can you help me? ^^

[Error - CreatureScript Interface]
data/creaturescripts/scripts/FragsReward.lua
Description:
(luaGetCreatureStorage) Creature not found

[Error - CreatureScript Interface]
data/creaturescripts/scripts/FragsReward.lua
Description:
data/creaturescripts/scripts/FragsReward.lua:5: bad argument #2 to 'max' (number expected, got boolean)
[Warning - Event::loadscript] Cannot load script (data/creaturescripts/scripts/FragsReward.lua)
 
Back
Top