AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to set file exist rules (https://forums.alliedmods.net/showthread.php?t=25150)

ltcjohnson 03-08-2006 18:11

How to set file exist rules
 
Okay. I got this plugin that changes models. How ever if I change the model it doesnt ownload the new one. what would i have to put in the plugin to make it verify the file and if it isnt the same to download the new one?

Heres the code
Code:
public new_round(id) {     if( get_cvar_num("cia_AdminModels") ){             new sSteamIDTemp[18]         get_user_authid(id,sSteamIDTemp,18)         for (new i=0; i<=200; i++){             //if if id matches steamid at index i in the array.             if ( equal(sSteamIDTemp,sSteamID[i]) ) {             //if T                 if ( cs_get_user_team(id) == 1 ) {                     cs_set_user_model(id, sTModel[i])             }             //if CT and not vip             if ( (cs_get_user_team(id) == 2) && (cs_get_user_vip(id) != 1) ){                 cs_set_user_model(id, sCTModel[i])             }                 }         }     }     //this forces users to precache the models so they HAVE to see the models people have. //later versions will include an element in the ini file which will let you choose if it does or not. public plugin_precache() {     if(file_exists("addons/amxmodx/configs/cia_adminmodels.cfg") == 1) {         new line, stxtsize         new data[18]         new iCurrentPos = 0         while( ((line=read_file("addons/amxmodx/configs/cia_adminmodels.cfg",line,data,17,stxtsize))!=0) && (iCurrentPos != 200) )         {         new sModelLoc[80]             if ( (data[0] == ';') ) continue         sSteamID[iCurrentPos] = data                     if ( (line=read_file("addons/amxmodx/configs/cia_adminmodels.cfg",line,data,17,stxtsize))!=0 ){             add(sModelLoc,80,"models/player/",0)         add(sModelLoc,80,data,0)         add(sModelLoc,80,"/",0)         add(sModelLoc,80,data,0)         add(sModelLoc,80,".mdl",0)         precache_model( sModelLoc )         sTModel[iCurrentPos] = data                 }         if ( (line=read_file("addons/amxmodx/configs/cia_adminmodels.cfg",line,data,17,stxtsize))!=0 ){             sModelLoc = ""         add(sModelLoc,80,"models/player/",0)         add(sModelLoc,80,data,0)         add(sModelLoc,80,"/",0)         add(sModelLoc,80,data,0)         add(sModelLoc,80,".mdl",0)         precache_model( sModelLoc )         sCTModel[iCurrentPos] = data         }         iCurrentPos = iCurrentPos + 1         }     }

Kraugh 03-12-2006 15:43

try this:

Code:
public plugin_precache() {    force_unmodified(force_exactfile,{0,0,0},{0,0,0},"models/modelname.mdl"); }

this will stop the users from connecting if they don't have the same model as the server. however, they will still manually have to delete their old model so that they can download the new one.


All times are GMT -4. The time now is 20:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.