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

Need a little fix.

Onizuka

Member
Joined
Jul 5, 2008
Messages
2,291
Reaction score
14
Code:
local welcome = {
                  ON = true,
                  Access = 0,
                  Nr_text = MESSAGE_INFO_DESCR,
                  Nr_text_2 = MESSAGE_EVENT_ORANGE,
                  Storage = 9928
                }
local Login_number = true
function onLogin(cid)
local names = getCreatureName(cid)
local welcome_2 = {
                  [0] = "Welcome my friend "..names,
                  [1] = "I greet you "..names..". My Lord !",
                  [2] = "Reminding you about server rules, Do not cheat "..names
                  }
if welcome.ON == true then
 local sex = getPlayerSex(cid)
 local char_storage = getPlayerStorageValue(cid, welcome.Storage)
     if char_storage == -1 then
       doPlayerSetStorageValue(cid, welcome.Storage, 1)
     else
       char_storage = char_storage + 1
       doPlayerSetStorageValue(cid, welcome.Storage, char_storage)
     end
 if getPlayerAccess(cid) <= welcome.Access then
   doPlayerSendTextMessage(cid, welcome.Nr_text, welcome_2[sex])
   if Login_number == true then
      doPlayerSendTextMessage(cid, welcome.Nr_text_2, "This is you "..char_storage.." login")
   end
 end

I added it to creaturescripts but it crashes the server when trying to log in.

Error:

Code:
To Close 'if' at line 16. '<eof>'


Any ideas.?

Regards,
Anco.
 
such errors happen, if you don't tab your scripts.
If you would tab your script correctly then you could find it easily yourself.

LUA:
function onLogin(cid)
local welcome = {
	ON = true,
	Access = 0,
	Nr_text = MESSAGE_INFO_DESCR,
	Nr_text_2 = MESSAGE_EVENT_ORANGE,
	Storage = 9928
}
local Login_number = true
local names = getCreatureName(cid)
local sex = getPlayerSex(cid)
local char_storage = getPlayerStorageValue(cid, welcome.Storage)
local welcome_2 = {
	[0] = "Welcome my friend "..names,
	[1] = "I greet you "..names..". My Lord !",
	[2] = "Reminding you about server rules, Do not cheat "..names
}
	if welcome.ON == true then
		if char_storage == -1 then
			doPlayerSetStorageValue(cid, welcome.Storage, 1)
		else
			char_storage = char_storage + 1
			doPlayerSetStorageValue(cid, welcome.Storage, char_storage)
		end
		if getPlayerAccess(cid) <= welcome.Access then
			doPlayerSendTextMessage(cid, welcome.Nr_text, welcome_2[sex])
		end
		if Login_number == true then
			doPlayerSendTextMessage(cid, welcome.Nr_text_2, "This is you "..char_storage.." login")
		end
	end
	return true
 end
 
Thank's for the help Evil.

There's 1 small tiny problem and i guess that's my fault here with registering the line in .xml file

Can there be 2 like this?

LUA:
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
	<event type="login" name="PlayerLogin" event="script" value="login2.lua"/>

The number 2 is for that script above and i guess that's what crashes the server after me reloging.

Regards and thank you alot again,
Anco.
 
Back
Top