diff --git a/dlls/BB/bb.cpp b/dlls/BB/bb.cpp index bdfd5918..94e1d828 100644 --- a/dlls/BB/bb.cpp +++ b/dlls/BB/bb.cpp @@ -31,6 +31,11 @@ static cell AMX_NATIVE_CALL get_user_level(AMX *amx,cell *params) static cell AMX_NATIVE_CALL set_user_level(AMX *amx,cell *params) { + if(GetUserLevel(params[0]) > params[2]) + { + MF_LogError(amx,AMX_ERR_NATIVE,"Must set to a level higher than current one!"); + return 0; + } SetUserLevel(params[1], params[2] ); return 1; } diff --git a/dlls/BB/bb.ncb b/dlls/BB/bb.ncb index 60e55f56..b1106abd 100644 Binary files a/dlls/BB/bb.ncb and b/dlls/BB/bb.ncb differ diff --git a/dlls/BB/pdata.h b/dlls/BB/pdata.h index c8698b98..54aaa9fc 100644 --- a/dlls/BB/pdata.h +++ b/dlls/BB/pdata.h @@ -11,10 +11,20 @@ #define EXTRAOFFSET 0 // no change in Windows builds #endif // defined __linux__ +inline edict_t* MF_GetEntityEdict( long& EntID ) +{ + if( (EntID > 0) && (EntID <= (gpGlobals->maxClients) ) ) + return MF_GetPlayerEdict( EntID ); + + return NULL; +} + template inline void SetPData( long& targetid, long offset, ValueType value, bool reset = false ) { - edict_t* target = MF_GetPlayerEdict( targetid ); + edict_t* target = MF_GetEntityEdict( targetid ); + if(target == NULL) return; + *((ValueType *)target->pvPrivateData + offset + EXTRAOFFSET) = value; if(reset) UpdateBBHud( targetid ); }; @@ -22,7 +32,8 @@ inline void SetPData( long& targetid, long offset, ValueType value, bool reset = template inline ValueType GetPData( long& targetid, long offset, ValueType value ) { - edict_t* target = MF_GetPlayerEdict( targetid ); + edict_t* target = MF_GetEntityEdict( targetid ); + if(target == NULL) return NULL; return *((ValueType *)target->pvPrivateData + offset + EXTRAOFFSET); }