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

[PROBLEM] Ever since I made a script, terminate something??

Nirer

New Member
Joined
Aug 23, 2007
Messages
91
Reaction score
0
Location
Israel, How Unfortunate
Well, I made a pretty simple script, nothing unusuall and ever since then my Distro sends me some peculiar messages, look at this one (while trying to preform the script):

2jzcbp.png


Any idea whats wrong?

Here is the script btw:
PHP:
function onUse(cid, item, frompos, item2, topos)
    ---Made By Nirer/Kakashi~Sensei/Naruto---
	local outfit_to_change={lookType=130 , lookBody=71 , lookHead=19 , lookLegs=128 ,lookFeet=128 , lookAddons=1}
	local level_needed=2 -- Change this to level needed to make the rune work properly with no errors
	    if(item.itemid==2263) then
	        if(isPlayer(item2.uid)==1) then
			     if(getPlayerLevel(cid)>=level_needed) then
		             doSetMonsterOutfit(item2.uid, outfit_to_change, -1)
				       doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
				   elseif(getPlayerLevel(cid)<level_needed) then
                           doPlayerSendCancel(cid, "You don't have enough level to use this outfit rune...") 	
                             doSendMagicEffect(frompos, CONST_ME_POFF)						   
                 end						   
		    elseif(isPlayer(item2.uid)==FALSE) then
			    doPlayerSendCancel(cid, "It is not a player...")
				  doSendMagicEffect(frompos, CONST_ME_POFF)
		   end	
       end
	return 1					
end
 
Read comments:
PHP:
function onUse(cid, item, frompos, item2, topos)
    ---Made By Nirer/Kakashi~Sensei/Naruto---
    local outfit_to_change={lookType=130 , lookBody=71 , lookHead=19 , lookLegs=128 ,lookFeet=128 , lookAddons=1}
    local level_needed=2 -- Change this to level needed to make the rune work properly with no errors
    if(item.itemid==2263) then
        if(isPlayer(item2.uid)==TRUE) then --# isPlayer
            if(getPlayerLevel(cid)>=level_needed) then
                doSetMonsterOutfit(item2.uid, outfit_to_change, -1) --# doSetMonsterOutfit?
                doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
            else
                doPlayerSendCancel(cid, "You don't have enough level to use this outfit rune...")
                doSendMagicEffect(frompos, CONST_ME_POFF)                    
            end
        else
            doPlayerSendCancel(cid, "It is not a player...")
            doSendMagicEffect(frompos, CONST_ME_POFF)
        end
    end
    return TRUE                 
end

See? First you check if it's a player, second you use doSetMonsterOutfit. Try doSetCreatureOutfit :p


Btw, wrong place to post! :p This is for finished scripts ;)
 
Last edited:
Thx colandus! you rule.. all though it fixed my problem, I've never seen an error like the one I've recieved... I would like to check it out, and:
"isPlayer(item2.uid)==1" is correct since in config lua:
"TRUE=1"
so...


PROBLEM SOLVED, PLEASE CLOSE THE THREAD!
 
You could also receive the same error by giving for example doPlayerSendTextMessage non string values for the text... :p


Edit: Oh! Now I know :p doSetMonsterOutfit requires a string not a table xD
doSetMonsterOutfit(item2.uid, "monster name", -1)

lawl, I thought it was weird first... Why have 2 functions when doSetCreatureOutfit does the same? :p
 
Last edited:
Back
Top