Morlad
Mega USER
No ...
can some1 make it so i use it like /rainbow on (or off) instead of time because i want it as a staff-only command
Write, /rain ;D
I use TFS 0.3.6pl1 for 8.6 client. In luascript.cpp is code:its till bugged
int32_t LuaScriptInterface::luaSetCreatureOutfit(lua_State* L)
{
//doSetCreatureOutfit(cid, outfit, time)
int32_t time = (int32_t)popNumber(L);
Outfit_t outfit = popOutfit(L);
ScriptEnviroment* env = getEnv();
if(Creature* creature = env->getCreatureByUID(popNumber(L)))
lua_pushboolean(L, Spell::CreateIllusion(creature, outfit, time) == RET_NOERROR);
else
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
I use TFS 0.3.6pl1 for 8.6 client. In luascript.cpp is code:
Spell::CreateIllusion(creature, outfit, time) - it create condition, so after relog player still has modified outfit, but only for time. With my script default config it's 0.2 second.PHP:int32_t LuaScriptInterface::luaSetCreatureOutfit(lua_State* L) { //doSetCreatureOutfit(cid, outfit, time) int32_t time = (int32_t)popNumber(L); Outfit_t outfit = popOutfit(L); ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushboolean(L, Spell::CreateIllusion(creature, outfit, time) == RET_NOERROR); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; }
Check in your sources how this function works. In my opinion function named doSetCreatureOutfit should set permament outfit :huh: , but there is no other function to set temportary outfit, so I used this function.
I use sources that you gave me
Here is link to sources that I use on xant.hopto.org:
http://everlutions.hopto.org/files/source-0.3.6pl1-8.60-warsystem.zip
(for unknown reason this link sometimes doesn't work in Google Chrome)
I set white outfit, said /rain and relog and my outfit is white. I think everything is OK.
Can this be made for onUse? with an item?
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
-- end of config
local frequency = 1000 / fr
local rainbowEvents = {}
function rainbowOutfit(cid, count)
if(isPlayer(cid)) then
local newOutfit = getCreatureOutfit(cid)
newOutfit.lookHead = math.random(133)
newOutfit.lookBody = math.random(133)
newOutfit.lookLegs = math.random(133)
newOutfit.lookFeet = math.random(133)
doSetCreatureOutfit(cid, newOutfit, frequency + 5)
if(count >= 1) then
rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
end
end
end
function onUse(cid, item)
if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
stopEvent(rainbowEvents[getPlayerGUID(cid)])
end
rainbowOutfit(cid, default_time * fr)
return true
end
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
-- end of config
local frequency = 1000 / fr
local rainbowEvents = {}
function rainbowOutfit(cid, count)
if(isPlayer(cid)) then
local newOutfit = getCreatureOutfit(cid)
newOutfit.lookHead = math.random(133)
newOutfit.lookBody = math.random(133)
newOutfit.lookLegs = math.random(133)
newOutfit.lookFeet = math.random(133)
doSetCreatureOutfit(cid, newOutfit, frequency + 5)
if(count >= 1) then
rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
end
end
end
function onUse(cid, item)
if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
stopEvent(rainbowEvents[getPlayerGUID(cid)])
rainbowEvents[getPlayerGUID(cid)] = nil
return true
end
rainbowOutfit(cid, default_time * fr)
return true
end