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

SpiderOT

™ツʂριԃҽɾσƚ➽ ٩(•‿•)۶★彡
Joined
Sep 29, 2008
Messages
1,062
Solutions
9
Reaction score
288
Location
Egypt/cairo
Hello :)
can someone help me with script for send text only if u have storage value 5000
i will explain it more :D
i want when a player login and he have storage value 5000 he send msg (any msg) like the sign and teleport send animated text
like if i put sotorage value 5000 for access 2
when a player login and he have storage value 5000 he send msg TuT
please i rly need this
thx
Kind regard
The Hluk
 
Code:
function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
	end
	return TRUE
end
 
Code:
local func msg(cid)
	doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
	addEvent(msg, 5 * 1000, cid)
end

function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
		addEvent(msg, 5 * 1000, cid)
	end
	return TRUE
end
 
thx for help but it doesn't work i get this error in console
Code:
[17/07/2009 15:23:11] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/Text.lua)
[17/07/2009 15:23:11] data/creaturescripts/scripts/Text.lua:4: '<eof>' expected near 'end'
@TriWear you can use it to show that this player is tut or gm or a Vip Player :)
 
Thx guys it work 100%:thumbup::thumbup::thumbup:
edit
after the character who have the storage 5000 logout the console start send this error
Code:
[17/07/2009 18:20:13] Lua Script Error: [CreatureScript Interface] 
[17/07/2009 18:20:13] in a timer event called from: 
[17/07/2009 18:20:13] data/creaturescripts/scripts/vip.lua:onLogin

[17/07/2009 18:20:13] luaGetCreaturePosition(). Creature not found

[17/07/2009 18:20:13] Lua Script Error: [CreatureScript Interface] 
[17/07/2009 18:20:13] in a timer event called from: 
[17/07/2009 18:20:13] data/creaturescripts/scripts/vip.lua:onLogin

[17/07/2009 18:20:14] attempt to index a boolean value
[17/07/2009 18:20:14] stack traceback:
[17/07/2009 18:20:14] 	[C]: in function 'doSendAnimatedText'
[17/07/2009 18:20:14] 	data/creaturescripts/scripts/vip.lua:2: in function <data/creaturescripts/scripts/vip.lua:1>
 
Last edited:
PHP:
local func msg(cid)
	for _, name in ipairs(getOnlinePlayers()) do
		if cid = getPlayerByName(name) then

	doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
	addEvent(msg, 5 * 1000, cid)
end
end
end

function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
		addEvent(msg, 5 * 1000, cid)
	end
	return TRUE
end

Writting fast. not tested.
 
another error lol
Code:
[18/07/2009 05:57:16] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/vip.lua)
[18/07/2009 05:57:16] data/creaturescripts/scripts/vip.lua:3: 'then' expected near '='
Edit Fixed added another =
so the finally script will be
Code:
local function msg(cid)
    for _, name in ipairs(getOnlinePlayers()) do
        if (cid) == getPlayerByName(name) then

    doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
    addEvent(msg, 5 * 1000, cid)
end
end
end

function onLogin(cid)
    if (getPlayerStorageValue(cid, 5000) == 1) then
        doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
        addEvent(msg, 5 * 1000, cid)
    end
    return TRUE
end
thx guys very much
 
Last edited:
Try this one:
Code:
local function msg(cid)
	for _, name in ipairs(getOnlinePlayers()) do
		if (getPlayerByName(name) == cid) then
			doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
			addEvent(msg, 5 * 1000, cid)
		end
	end
end

function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
		addEvent(msg, 5 * 1000, cid)
	end
	return TRUE
end
 
Okey! it was midnight and i wasn't thought clearly...

There should be == not = in funcion "if" (always is ==, =<, =>, <, >), my fauld but it was late ;)

and yep function, not func (i just copied orginal script, i didn't look for bugs but i wanted to add bool, if player is online, and if yes then execute script. if not then break xD
 
Chojrak, why you loop over every player, it doesn't make any sense ;)

Error appeared, because there is a need to use isPlayer(cid) in your delayed function 'msg', because if player logout after 3 seconds, and function is executed after 5 seconds, then: 'luaGetCreaturePosition(). Creature not found'

Code:
if(isPlayer(cid) == FALSE) then
	return
end
 
Loop is made by Quas :p, i've only fixed error in his script

@Topic:

I think script should look like this:
Code:
local function msg(cid)
	if(isPlayer(cid) == FALSE) then
		return
	end
	doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
	addEvent(msg, 5 * 1000, cid)
end

function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
		addEvent(msg, 5 * 1000, cid)
	end
	return TRUE
end
 
Last edited:
i just didn't know how to chesk that cid is online xD so i use this loop ;P

@Chojrak. Maybe better will be:

Lua:
local function msg(cid)
	if(isPlayer(cid) == TRUE) then
	doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
	addEvent(msg, 5 * 1000, cid)
        end
end

function onLogin(cid)
	if (getPlayerStorageValue(cid, 5000) == 1) then
		doSendAnimatedText(getCreaturePosition(cid), "TuT!", TEXTCOLOR_WHITE)
		addEvent(msg, 5 * 1000, cid)
	end
	return TRUE
end
 
Back
Top