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

Drama with script :S

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
I made this script and works great, but I have one problem, when you create a new char, it receives the messge that "Your premium has expired... bla bla bla" and appear in Thais, so if you create your char in Venore, then he will appear in Thais with that message... How could I fix it?

LUA:
if not isPremium(cid) then
if getPlayerStorageValue(cid, 1234) == -1 then
doTeleportThing(cid, getTownTemplePosition(1), FALSE)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
setPlayerStorageValue(cid, 1234, 1)
doPlayerSetTown(cid, 1)
doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
end
end

if isPremium(cid) then
if getPlayerStorageValue(cid, 1234) == 1 then
setPlayerStorageValue(cid, 1234, -1)
end
end
 
make storage to check for his first login.
i think if you u didnt disable first item mod it will be 3001 check if it was > 0
 
then just make a storage like that in the login.lua
Code:
local firstlog = 
if getPlayerStorageValue(cid,firstlog) < 0 then
  setPlayerstorageValue(cid,firstlog,1)
end

now include a check for this storage in your premmy end script
 
local firstlog = ???
if getPlayerStorageValue(cid,firstlog) < 0 then
setPlayerstorageValue(cid,firstlog,1)
end

How it will check it is the first log? And also when you create a player, the storage just doesn't exist, so it will be lower than 0, or higher...
 
You should have made somthn like that before starting server but in your problem you can use in the script
LUA:
if getPlayerLastLoginSaved(cid) ~= 0

  --execute script
end
 
Last edited:
Note: a Player must have been premium before! If he doesn't have been premium before it won't teleport him and other stuff. :thumbup: Rep++
LUA:
if not isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == -1 and getPlayerStorageValue(cid, 1235) == 1 then
	doTeleportThing(cid, getTownTemplePosition(1), FALSE)
	setPlayerStorageValue(cid, 1235, -1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
	setPlayerStorageValue(cid, 1234, 1)
	doPlayerSetTown(cid, 1)
	doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
	end
end
 
if isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == 1 and getPlayerStorageValue(cid, 1235) == -1 then
	setPlayerStorageValue(cid, 1234, -1)
	setPlayerStorageValue(cid, 1235, 1)
	end
end
[full script, with return true and function onLogin(xx)]
LUA:
function onLogin(cid)
if not isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == -1 and getPlayerStorageValue(cid, 1235) == 1 then
	doTeleportThing(cid, getTownTemplePosition(1), FALSE)
	setPlayerStorageValue(cid, 1235, -1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
	setPlayerStorageValue(cid, 1234, 1)
	doPlayerSetTown(cid, 1)
	doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
	end
end
 
if isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == 1 and getPlayerStorageValue(cid, 1235) == -1 then
	setPlayerStorageValue(cid, 1234, -1)
	setPlayerStorageValue(cid, 1235, 1)
	end
end
return 1
end
 
Note: a Player must have been premium before! If he doesn't have been premium before it won't teleport him and other stuff. :thumbup: Rep++
LUA:
if not isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == -1 and getPlayerStorageValue(cid, 1235) == 1 then
	doTeleportThing(cid, getTownTemplePosition(1), FALSE)
	setPlayerStorageValue(cid, 1235, -1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
	setPlayerStorageValue(cid, 1234, 1)
	doPlayerSetTown(cid, 1)
	doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
	end
end
 
if isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == 1 and getPlayerStorageValue(cid, 1235) == -1 then
	setPlayerStorageValue(cid, 1234, -1)
	setPlayerStorageValue(cid, 1235, 1)
	end
end
[full script, with return true and function onLogin(xx)]
LUA:
function onLogin(cid)
if not isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == -1 and getPlayerStorageValue(cid, 1235) == 1 then
	doTeleportThing(cid, getTownTemplePosition(1), FALSE)
	setPlayerStorageValue(cid, 1235, -1)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
	setPlayerStorageValue(cid, 1234, 1)
	doPlayerSetTown(cid, 1)
	doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
	end
end
 
if isPremium(cid) then
	if getPlayerStorageValue(cid, 1234) == 1 and getPlayerStorageValue(cid, 1235) == -1 then
	setPlayerStorageValue(cid, 1234, -1)
	setPlayerStorageValue(cid, 1235, 1)
	end
end
return 1
end

It doesn't work, if you don't have premium, you log in normal, if you have premium, you log in normal, but if your premium expires, you keep login on the same place...
 
look go to creature script make new lua paste this :
LUA:
function onThink(cid)
for _, cid in ipairs(getPlayersOnline()) do
     if not isPremium(cid) and getPlayerStorageValue(cid, 1234) > 0 then
           setPlayerStorageValue(cid, 1234, -1)
            doTeleportThing(cid, getTownTemplePosition(1), FALSE)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
            doPlayerSetTown(cid, 1)
            doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
      elseif isPremium(cid) and getPlayerStorageValue(cid, 1234) < 0 then
            setPlayerStorageValue(cid, 1234, 1)
      end
end
return true
end

and regestilre event name in login.lua also in login.lua paste this
LUA:
     if not isPremium(cid) and getPlayerStorageValue(cid, 1234) > 0 then
            doTeleportThing(cid, getTownTemplePosition(1), FALSE)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your premium has expired and you lost some outfits, only if you are premium again, you will be able to use them!")
            setPlayerStorageValue(cid, 1234, -1)
            doPlayerSetTown(cid, 1)
            doCreatureChangeOutfit(cid, {lookType = 128, lookHead = 78, lookBody = 68, lookLegs = 39, lookFeet = 76, lookTypeEx = 0, lookAddons = 0})
      elseif isPremium(cid) and getPlayerStorageValue(cid, 1234) < 0 then
            setPlayerStorageValue(cid, 1234, 1)
      end
 
Back
Top