Raised This Month: $ Target: $400
 0% 

How to set file exist rules


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ltcjohnson
Junior Member
Join Date: Nov 2004
Old 03-08-2006 , 18:11   How to set file exist rules
Reply With Quote #1

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         }     }
ltcjohnson is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-12-2006 , 15:43  
Reply With Quote #2

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.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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