Validating models
#4

Quote:
Originally Posted by Crayder
View Post
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.
What do you mean by valid? If you mean what I think you do, you could use an array:

Code:
#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];
}
Reply


Messages In This Thread
Validating models - by Crayder - 04.12.2017, 07:17
Re: Validating models - by BeckzyBoi - 04.12.2017, 07:46
Re: Validating models - by Crayder - 04.12.2017, 07:51
Re: Validating models - by BeckzyBoi - 04.12.2017, 08:22
Re: Validating models - by Crayder - 04.12.2017, 08:32

Forum Jump:


Users browsing this thread: 1 Guest(s)