• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Premium have bigger exp...

Marcinek123

Badboy
Joined
Jan 21, 2008
Messages
49
Reaction score
0
Location
Poland
This script tested in [TFS0.3beta3]
Create new file login2.lua in data/creaturescripts/scripts:
Code:
function onLogin(cid)
	if isPremium(cid) == TRUE and getPlayerStorageValue(cid, 12345) == 0 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)+15)
	setPlayerStorageValue(cid, 12345, 1)
	
	elseif isPremium(cid) == FALSE and getPlayerStorageValue(cid, 12345) == 1 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)-15)
	setPlayerStorageValue(cid, 12345, 0)
	end
	
	return TRUE
end
end
and edit creaturscripts.xml and paste:
Code:
	<event type="login" name="exprate" script="login2.lua"/>

Function: If player have premium then he have extra exp rate.
If his premium is end... his exp coming back to the state without premium
 
Last edited:
oh, I think there is a Problem in your Skript:
I think on EVERY LOGIN with premium the Player gets +15, even if the StorageValue 12345 is 1! So, if you get Premium, loggin 2 times and loose Premium you still have +15. And if you logg in 101 times you have +150! If this is true, you should add " and getPlayerStorageValue(cid, 12345) == 0" after "if isPremium(cid) == TRUE"
 
And also, if the person doesnt have premium, it wont "Subtract" 15 will it?
 
Hmm... i will try create script...
@knightgod if tfs 0.2 have function set/getPlayerExtraExpRate then is posible... try...

[edit]
Function : If promote is 2 then player have extra exp rate...

Code:
function onLogin(cid)
	if getPlayerPromotionLevel(cid) == 2 and getPlayerStorageValue(cid, 12345) == 0 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)+15)
	setPlayerStorageValue(cid, 12345, 1)
	
	elseif getPlayerPromotionLevel(cid) <> 2 and getPlayerStorageValue(cid, 12345) == 1 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)-15)
	setPlayerStorageValue(cid, 12345, 0)
	end
	
	return TRUE
end
end
 
Last edited:
And also, if the person doesnt have premium, it wont "Subtract" 15 will it?

If player don't buy premium dont loss 15 "extraexp" but if buy premium and premium is end then extra exp rate is change to facc exp rate...;)
 
Last edited:
Instead of else if make elseif and remove a end:p

like.
PHP:
function onLogin(cid)
	if isPremium(cid) == TRUE and getPlayerStorageValue(cid, 12345) == 0 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)+15)
	setPlayerStorageValue(cid, 12345, 1)
	
	elseif isPremium(cid) == FALSE and getPlayerStorageValue(cid, 12345) == 1 then
	setPlayerExtraExpRate(cid, getPlayerExtraExpRate(cid)-15)
	setPlayerStorageValue(cid, 12345, 0)
	end
	
	return TRUE
end
 

Similar threads

Back
Top