04.12.2017, 07:17
Is there a way to validate models before using them with the pawn functions?
Yes but doesn't it seem necessary to know whether a model is valid or not with the server? Like... If I had a command that created objects, I would want to know if models are valid within the script to know whether or not the players should be able to create the model they requested.
|
#define MAX_CUSTOM_MODEL_SLOTS 29001 // -1000 to -30000 #define CUSTOM_MODEL_OFFSET_FROM_ZERO 1000 new bool:iscmodelvalid[MAX_CUSTOM_MODEL_SLOTS]; public OnGameModeInit() { AddSimpleModel(0, 10000, -1001, "name1.dff", "name1.txd"); iscmodelvalid[-1001 + MAX_CUSTOM_MODEL_SLOTS + CUSTOM_MODEL_OFFSET_FROM_ZERO] = true; AddSimpleModel(0, 10000, -30000, "name2.dff", "name2.txd"); iscmodelvalid[-30000 + MAX_CUSTOM_MODEL_SLOTS + CUSTOM_MODEL_OFFSET_FROM_ZERO] = true; } IsValidCustomObjectModel(modelid) { if (modelid < -30000 || modelid > -1000) return false; return iscmodelvalid[modelid + MAX_CUSTOM_MODEL_SLOTS + CUSTOM_MODEL_OFFSET_FROM_ZERO]; }