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:
parent
ad65cf91d8
commit
4e23d3ff88
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user