Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe5d17e

Browse files
committed
Simplified setElementSyncer() arguments. Fixed getElementSyncer()
1 parent 47392c8 commit fe5d17e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

MTA10_Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,13 @@ CElement* CStaticFunctionDefinitions::GetElementSyncer ( CElement* pElement )
779779
case CElement::PED:
780780
{
781781
CPed* pPed = static_cast < CPed* > ( pElement );
782-
return static_cast < CElement* > ( pPed->GetSyncer() );
782+
return pPed->IsSyncable () ? static_cast < CElement* > ( pPed->GetSyncer() ) : NULL;
783783
break;
784784
}
785785
case CElement::VEHICLE:
786786
{
787787
CVehicle* pVehicle = static_cast < CVehicle* > ( pElement );
788-
return static_cast < CElement* > ( pVehicle->GetSyncer() );
788+
return pVehicle->IsUnoccupiedSyncable () ? static_cast < CElement* > ( pVehicle->GetSyncer() ) : NULL;
789789
break;
790790
}
791791
}

MTA10_Server/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,18 +1674,20 @@ int CLuaElementDefs::setElementModel ( lua_State* luaVM )
16741674
int CLuaElementDefs::setElementSyncer ( lua_State* luaVM )
16751675
{
16761676
int iArgument2 = lua_type ( luaVM, 2 );
1677-
if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA && ( iArgument2 == LUA_TLIGHTUSERDATA || iArgument2 == LUA_TNIL ) )
1677+
if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA && ( iArgument2 == LUA_TLIGHTUSERDATA || iArgument2 == LUA_TBOOLEAN ) )
16781678
{
16791679
CElement* pElement = lua_toelement ( luaVM, 1 );
1680-
CPlayer* pPlayer = lua_toplayer ( luaVM, 2 );
1680+
CPlayer* pPlayer = NULL;
16811681
bool bEnable = true;
16821682

1683-
if ( lua_type ( luaVM, 3 ) == LUA_TBOOLEAN )
1684-
bEnable = lua_toboolean ( luaVM, 3 ) ? true : false;
1683+
if ( iArgument2 == LUA_TLIGHTUSERDATA )
1684+
pPlayer = lua_toplayer ( luaVM, 2 );
1685+
if ( iArgument2 == LUA_TBOOLEAN )
1686+
bEnable = lua_toboolean ( luaVM, 2 ) ? true : false;
16851687

16861688
if ( pElement )
16871689
{
1688-
if ( pPlayer || iArgument2 == LUA_TNIL )
1690+
if ( pPlayer || iArgument2 == LUA_TBOOLEAN )
16891691
{
16901692
lua_pushboolean ( luaVM, CStaticFunctionDefinitions::SetElementSyncer ( pElement, pPlayer, bEnable ) );
16911693
return 1;

0 commit comments

Comments
 (0)