@hp command crash
Forum rules
NO LONGER BEING MAINTAINED!
NO LONGER BEING MAINTAINED!
@hp command crash
using @hp without a number crashes the server
-
- Developer
- Posts: 539
- Joined: Sun Jul 22, 2012 12:17 am
Re: @hp command crash
Code: Select all
DSP_DEBUG_BREAK_IF(lua_isnil(L,-1) || !lua_isnumber(L,-1));
Those are scattered all over LUA_baseentity, which is the main connection between the core and scripts. If you pass nulls and you're compiling in debug mode instead of release mode, your server stops so that you can fix the bug.
It's a feature.
Test Server: Hanekawa | Fantasy World: Naito
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
Re: @hp command crash
DSP_DEBUG_BREAK_IF(lua_isnil(L,-1) || !lua_isnumber(L,-1));
replace
if(lua_isnil(L,-1) || !lua_isnumber(L,-1))
{
//SHOULD SEND SOME KIND OF MESSAGE TO SERVER CORE OR IN GAME TO YOUR SELF TELLING YOU YOU HAVE A BAD LUA SCRIPT
//ALSO MAYBE SEND THE MESSAGE OF WHAT LUA IT IS!
return false;
}
replace
if(lua_isnil(L,-1) || !lua_isnumber(L,-1))
{
//SHOULD SEND SOME KIND OF MESSAGE TO SERVER CORE OR IN GAME TO YOUR SELF TELLING YOU YOU HAVE A BAD LUA SCRIPT
//ALSO MAYBE SEND THE MESSAGE OF WHAT LUA IT IS!
return false;
}
-
- Developer
- Posts: 539
- Joined: Sun Jul 22, 2012 12:17 am
Re: @hp command crash
The debug breaks are actually there for a reason. They let us know when someone writes a bad script, before it can get beyond the function being called.
Circumventing one because it's inconvenient is pretty much the exact opposite of a good idea.
Circumventing one because it's inconvenient is pretty much the exact opposite of a good idea.
Test Server: Hanekawa | Fantasy World: Naito
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
Re: @hp command crash
there's not really much of a point on having a debug break on gm commands
-
- Developer
- Posts: 539
- Joined: Sun Jul 22, 2012 12:17 am
Re: @hp command crash
It's probably on addHP, delHP, or setHP (if there is one.)
Test Server: Hanekawa | Fantasy World: Naito
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
An occasionally updated list of what works
Bugs reports go here. | Project chat here.
Things I've found, but don't plan to work on.
Re: @hp command crash
really bad idea. don't try break core if you have bad scriptWiiStream wrote:DSP_DEBUG_BREAK_IF(lua_isnil(L,-1) || !lua_isnumber(L,-1));
replace
if(lua_isnil(L,-1) || !lua_isnumber(L,-1))
{
//SHOULD SEND SOME KIND OF MESSAGE TO SERVER CORE OR IN GAME TO YOUR SELF TELLING YOU YOU HAVE A BAD LUA SCRIPT
//ALSO MAYBE SEND THE MESSAGE OF WHAT LUA IT IS!
return false;
}
change hp.lua to
Code: Select all
if (type(hp) == "number") then
if(player:getHP() > 0) then
player:setHP(hp);
end
end