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

Show frag onLogin + logout block

Sorbal

Member
Joined
Jul 23, 2010
Messages
406
Reaction score
11
Location
Poland
Hello Otlanders, i appeal to You to ask for help. I tried to write my own script (TFS 0.3.6) that would operate on the principle of: a player loggins in to the game, it displays the message "welcome!" (this part works in my script), in the first 2 seconds he cannot logout (pz block + not working), and the console shows him the current number of all frags (not working). I tried different ways but nothing works like I want to. Here's my script and console errors (after trying to log on to the game character). Can You explain to me what I was doing wrong?:

PHP:
function onLogin(cid)
    setCombatCondition(combat, condition)
	doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_WHITE)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (getPlayerFrags(cid)), "Amount of Your frags.")
	return TRUE
end

Errors:
Code:
[04/10/2011 19:02:41] Administrator has logged in.

[04/10/2011 19:02:41] [Error - CreatureScript Interface] 
[04/10/2011 19:02:41] data/creaturescripts/scripts/battleonlogin.lua:onLogin
[04/10/2011 19:02:41] Description: 
[04/10/2011 19:02:41] (luaSetCombatCondition) This function can only be used while loading the script.

[04/10/2011 19:02:42] [Error - CreatureScript Interface] 
[04/10/2011 19:02:42] data/creaturescripts/scripts/battleonlogin.lua:onLogin
[04/10/2011 19:02:42] Description: 
[04/10/2011 19:02:42] data/creaturescripts/scripts/battleonlogin.lua:4: attempt to call global 'getPlayerFrags' (a nil value)
[04/10/2011 19:02:42] stack traceback:
[04/10/2011 19:02:42] 	data/creaturescripts/scripts/battleonlogin.lua:4: in function <data/creaturescripts/scripts/battleonlogin.lua:1>
[04/10/2011 19:02:42] Administrator has logged out.
+ I have register in login.lua
 
you store frags in database right, not in storage key? shouldn't be too hard to find a getPlayerFrags function if you only used search
 
Yes, in database.
Im tried this one, but its don't work too..
PHP:
function onLogin(cid)
	return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have: ".. getPlayerFrags(cid) ..".")
end
 
Any errors?

Code:
[07/10/2011 18:45:55] Administrator has logged in.
[07/10/2011 18:45:55] [Error - CreatureScript Interface] 
[07/10/2011 18:45:55] data/creaturescripts/scripts/battleonlogin.lua:onLogin
[07/10/2011 18:45:55] Description: 
[07/10/2011 18:45:55] data/creaturescripts/scripts/battleonlogin.lua:2: attempt to call global 'getPlayerFrags' (a nil value)
[07/10/2011 18:45:55] stack traceback:
[07/10/2011 18:45:55] 	data/creaturescripts/scripts/battleonlogin.lua:2: in function <data/creaturescripts/scripts/battleonlogin.lua:1>
[07/10/2011 18:45:55] Administrator has logged out.
While trying to login to the game.
 
Ok, i've found it! Thanks for You both, naturally i Rep+ You. :)
So frags on login are SOLVED but what about the 2 secounds logout block after login game? Can you help me?
 
Last edited:
LUA:
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2000)

function onLogin(cid)
	doAddCondition(cid, condition)
	doSendAnimatedText(getThingPos(cid), 'Welcome!', TEXTCOLOR_WHITE)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have ".. getPlayerFrags(cid) .. " frags.")
	return true
end
 
Back
Top