Validating models
#1

Is there a way to validate models before using them with the pawn functions?
Reply
#2

I believe they're validated internally. I could be wrong.

Quote:
Originally Posted by Kalcor
View Post
SA-MP 0.3.8 RC3-3 Client update

- More dff/txd validation.
Reply
#3

Quote:
Originally Posted by BeckzyBoi
View Post
I believe they're validated internally. I could be wrong.
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.
Reply
#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
#5

Yeah and what about if they are added with artconfig.txt? We would need a native function to see if the model is added. That's the only way unless someone hooked up a plugin to detect the models added.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)