1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Exported command enumerations and helper function to retrieve player instance level without an instance.

This commit is contained in:
Sandu Liviu Catalin 2015-11-08 21:12:05 +02:00
parent ad65cf91d8
commit 4e23d3ff88
2 changed files with 34 additions and 1 deletions

View File

@ -1052,6 +1052,31 @@ bool Register_Cmd(HSQUIRRELVM vm)
// Attempt to bind the namespace to the root table // Attempt to bind the namespace to the root table
Sqrat::RootTable(vm).Bind(_SC("Cmd"), cmdns); Sqrat::RootTable(vm).Bind(_SC("Cmd"), cmdns);
// Output debugging information
LogDbg("Beginning registration of <Cmd Constants> type");
// Attempt to register the argument types enumeration
Sqrat::ConstTable(vm).Enum(_SC("ECMDARG"), Sqrat::Enumeration(vm)
.Const(_SC("ANY"), CMDARG_ANY)
.Const(_SC("INTEGER"), CMDARG_INTEGER)
.Const(_SC("FLOAT"), CMDARG_FLOAT)
.Const(_SC("BOOLEAN"), CMDARG_BOOLEAN)
.Const(_SC("STRING"), CMDARG_STRING)
);
// Attempt to register the error codes enumeration
Sqrat::ConstTable(vm).Enum(_SC("ECMDERR"), Sqrat::Enumeration(vm)
.Const(_SC("UNKNOWN"), CMDERR_UNKNOWN)
.Const(_SC("SYNTAX_ERROR"), CMDERR_SYNTAX_ERROR)
.Const(_SC("UNKNOWN_COMMAND"), CMDERR_UNKNOWN_COMMAND)
.Const(_SC("MISSING_EXECUTER"), CMDERR_MISSING_EXECUTER)
.Const(_SC("INSUFFICIENT_AUTH"), CMDERR_INSUFFICIENT_AUTH)
.Const(_SC("INCOMPLETE_ARGS"), CMDERR_INCOMPLETE_ARGS)
.Const(_SC("EXTRANEOUS_ARGS"), CMDERR_EXTRANEOUS_ARGS)
.Const(_SC("UNSUPPORTED_ARG"), CMDERR_UNSUPPORTED_ARG)
.Const(_SC("EXECUTION_FAILED"), CMDERR_EXECUTION_FAILED)
);
// Output debugging information
LogDbg("Registration of <IRC Constants> type was successful");
// Registration succeeded // Registration succeeded
return true; return true;
} }

View File

@ -158,10 +158,18 @@ EVehicleCustom & GVehicleCustom()
return _Core->VehicleCustom; return _Core->VehicleCustom;
} }
// ------------------------------------------------------------------------------------------------
static SQInt32 GetPlayerLevel(SQInt32 id)
{
return Reference< CPlayer >::Get(id).Level;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Entity(HSQUIRRELVM vm) bool Register_Entity(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm); // Attempt to bind the namespace to the root table
Sqrat::RootTable(vm).Func(_SC("GetPlayerLevel"), GetPlayerLevel);
// Registration succeeded
return true; return true;
} }