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

is this script correct?

stonger

New Member
Joined
Oct 27, 2009
Messages
32
Reaction score
0
first of all, i must say that i know allmost nothing of scripting.
this script consist in removing someones vip vocation when his vip days finishes. the npc that gives vip promotions will be in the vip area.
heres the script:

PHP:
function onThink(cid, item, fromPosition, toPosition)

	for _, name in ipairs(getOnlinePlayers()) do
		local player = getPlayerByName(name)
		if getPlayerStorageValue(player,11551) == 1 then
			StdModule.demotePlayer
		end
	end
end

i just copied one script and replace some things.
instead of: StdModule.promotePlayer
i putted: StdModule.demotePlayer
i think its wrong. please help. if ur gonna coment that i am a noob please dont comment =P.
 
It won't work, but what did you exactly mean with demote? Maybe setting promotion level to 0?
...
Code:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getOnlinePlayers()) do
		if(getPlayerStorageValue(cid, 11551) == 1) then
			doPlayerSetPromotionLevel(cid, 0)
		end
	end
end
 
Global event.

Code:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getPlayersOnline()) do
		if (getPlayerStorageValue(cid, 11551) == 1) then
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) - 1)
		end
	end
	return true
end
 
@Cykotitan
with demote, i was meaning to remove his promotion

@chojrak
thanks =D testing it.
---------------------------
rep +
for both =D
 
If you have more than 1 promotion level on your server, use Chojrak's script. Otherwise you can use mine instead.
 
It won't work, but what did you exactly mean with demote? Maybe setting promotion level to 0?
...
PHP:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getOnlinePlayers()) do
		if(getPlayerStorageValue(cid, 11551) == 1) then
			doPlayerSetPromotionLevel(cid, 0)
		end
	end
end

I have more than one promotion, but if i change:

PHP:
doPlayerSetPromotionLevel(cid, 0)

for this:

PHP:
doPlayerSetPromotionLevel(cid, 1)

from vip knight, it will become elite knight
isnt it?
 
Global event.

Code:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getPlayersOnline()) do
		if (getPlayerStorageValue(cid, 11551) == 1) then
			doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) - 1)
		end
	end
	return true
end

@Up,
Yes, use this script & it will work.
 
Back
Top Bottom