Quote:
Originally Posted by Johnny got his gun
Without having checked how this really works, you could skip the need of ini file altogether by making a dedicated folder inside cstrike/models/ , maybe like cstrike/models/customs/ and then precache all files ending with ".mdl" in there.
Code:
new const PATH[] = "models/objectivesconverterhostages"
new modelsprecached = 0
public plugin_precache() {
new pos = 0, filename[128], length
new completepath[128]
do {
pos = read_dir(PATH, pos, filename, 127, length)
if (length < 5 || containi(filename, ".mdl") != length - 4)
continue
format(completepath, 127, "%s/%s", PATH, filename)
//server_print("[%s] DEBUG - Precaching %s", PLUGINNAME, completepath)
precache_model(completepath)
format(filename, 127, "%s%d", VAULTKEYMODELS, modelsprecached + 1)
set_vaultdata(filename, completepath)
modelsprecached++
}
while (pos)
server_print("[%s] DEBUG - Precached %d custom hostage models", PLUGINNAME, modelsprecached)
}
Thats how I did just that with my Objectives converter. It precaches any models inside a subfolder and uses those models as hostages on any maps... the model paths are also stored in vault so that the plugin knows what models are precached later when its gonna set the models.
|
thanks for the tip, however, it wont work, and ill explain why.
cs_set_user_model() takes 2 arguments, id and a string for the model name. This string is not a path but rather the name of the model. The proc automatically figures out the relative path by using a start of "/models/player/" then concatenating the string for the name then concat "/" then concat name again then concat ".mdl" that leaves you with a final path of:
/models/player/name/name.mdl
the string argument used in this case would be "name":
cs_set_user_model(id, "name");
so in conclusion an ini is required. I basically cheated the engine into allowing this to happen. I dont think amxx was supposed to let you do this, but i found a workaround.
__________________