Alright, I want a script that everytime a character logs in, server checks "onLogin" if Account is Vip, and it had ended, then it teleports player to town X and set it as its new town.
First, the script I'm using:
I registered it in creaturescripts
But if an Accout is already VIP player can Log In perfectly but console returns this error:
When I try to log with a non vip character it might not log in and console returns this message:
----
The point with the script is to:
First check on login, if character is VIP and has storage X, if player is not VIP and has already the storage, script ends.
Second, if character is not VIP but has the storage of a VIP then it will teleport and send message, change storage to normal value.
Third: Check if there is no VIP value and then set a normal/common storage value, cuz' I use account VIP system, and I need a condition to don't make people to teleport everytime they login. So I set a storage as condition. (If account have VIP time and storage value is the right one, (9999, 3) then it will not teleport character.) Cuz' as I dont want to make any item to set storage, I want it all to be automatic when each chracter login, I need all characters that log in, have theirs storage values set to (xxxxx, 1).
TFS Ver.: The Forgotten Server, version 0.3.6 (Crying Damson) (8.54)
I'm really having trouble with it, I tried to changed script in a couple of ways, but it just wont work.
Thanks a lot in advance!!
First, the script I'm using:
PHP:
function onLogin(cid)
local freeTownId = 5
local templePos = {x = 834, y = 185, z = 6}
accountName = getPlayerAccount(cid)
if(isVip(accountName))then
time = getAccountVipTime(accountName)
if (GetPlayerStorageValue(cid, 99999,1)) and (time == 0) then
end
if (GetPlayerStorageValue(cid, 99999,3)) and (time == 0) then
doTeleportThing(cid, #templePos)
doPlayerSetTown(cid, #freeTownId)
doPlayerSendTextMessage(cid, 22, "Your VIP has been expired!")
setPlayerStorageValue(cid, 99999, 1)
elseif (GetPlayerStorageValue(cid, 99999, -1)) and (time > 0) then
setPlayerStorageValue(cid, 99999, 3)
elseif (GetPlayerStorageValue(cid, 99999,-1)) and (time == 0) then
setPlayerStorageValue(cid, 99999, 1)
end
return TRUE
end
end
I registered it in creaturescripts
Code:
<event type="login" name="VipLogin" event="script" value="viplogin.lua"/>
But if an Accout is already VIP player can Log In perfectly but console returns this error:
Code:
[06/02/2011 12:01:27] [Error - CreatureScript Interface]
[06/02/2011 12:01:27] data/creaturescripts/scripts/viplogin.lua:onLogin
[06/02/2011 12:01:27] Description:
[06/02/2011 12:01:27] (luaGetCreatureStorage) Creature not found
When I try to log with a non vip character it might not log in and console returns this message:
Code:
[06/02/2011 12:01:27] [Error - CreatureScript Interface]
[06/02/2011 12:01:27] data/creaturescripts/scripts/viplogin.lua:onLogin
[06/02/2011 12:01:27] Description:
[06/02/2011 12:01:27] (luaGetCreatureStorage) Creature not found
[06/02/2011 12:03:11] Teste has logged in.
[06/02/2011 12:03:11] Teste has logged out.
----
The point with the script is to:
First check on login, if character is VIP and has storage X, if player is not VIP and has already the storage, script ends.
Second, if character is not VIP but has the storage of a VIP then it will teleport and send message, change storage to normal value.
Third: Check if there is no VIP value and then set a normal/common storage value, cuz' I use account VIP system, and I need a condition to don't make people to teleport everytime they login. So I set a storage as condition. (If account have VIP time and storage value is the right one, (9999, 3) then it will not teleport character.) Cuz' as I dont want to make any item to set storage, I want it all to be automatic when each chracter login, I need all characters that log in, have theirs storage values set to (xxxxx, 1).
TFS Ver.: The Forgotten Server, version 0.3.6 (Crying Damson) (8.54)
I'm really having trouble with it, I tried to changed script in a couple of ways, but it just wont work.
Thanks a lot in advance!!