• 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 Message player at first login!

ghettobird

LUA newbie
Joined
Aug 17, 2013
Messages
679
Reaction score
132
Location
OTland
Hello guys, some people have told me highexp ( a known highexp server) has this script that says Hello ghettobird (example) go kill some monsters until level 450 etc... so i decided to make one just like them :)

PS: edit the doPlayerSendTextMessage line from the 3rd part, "go kill some ~~" and also edit "YOURSERVERNAME" :)

go to creaturescripts/scripts and make a file called firstmessage.lua

Lua:
function onLogin(cid)
 local storage = 2522
 if getPlayerStorageValue(cid, storage) == -1 then
         doPlayerSendTextMessage(cid, 22, "Hello "..getPlayerName(cid).." this is your first visit to YOURSERVNAME. go kill some rotworms until level 20 then go to cyclops!")
   setPlayerStorageValue(cid, storage, 1)
    else
    doPlayerSendTextMessage(cid, 22, "Welcome back "..getPlayerName(cid).."!")
 end
return true
end

then go to creaturescripts.xml and post this
Lua:
 <event type="login" name="firstmessage" script="firstmessage.lua"/>

now we need to register it to login.lua
go to creaturescripts/scripts/login,lua and put this
Lua:
 registerCreatureEvent(cid, "firstmessage")


I hope this helps :), tested and works on tfs 0.4
 
Instead of storage you could check for this:
Lua:
if (getPlayerLastLogin(cid) < 1) then
	--executescript
else
	--executescript
end
 
thanks printer :peace:, but storage is kind of easier for me (i'm still a beginner xD)
 
Back
Top