August 2, 201114 yr comment_63159 yop, Alors voilà j'ai une erreur dans le bloc suivant: #define MAX_FILE_LEN 256 #define MODELS_PER_TEAM 8 // Custom Models new String:g_Models_CT[MODELS_PER_TEAM][MAX_FILE_LEN]; new String:g_Models_Count_CT; new String:g_Models_Name_CT[MODELS_PER_TEAM][MAX_FILE_LEN]; new String:g_Models_T[MODELS_PER_TEAM][MAX_FILE_LEN]; new String:g_Models_Count_T; new String:g_Models_Name_T[MODELS_PER_TEAM][MAX_FILE_LEN]; new String:g_Models_TVIP[MODELS_PER_TEAM][MAX_FILE_LEN]; new String:g_Models_Count_TVIP; new String:g_Models_Name_TVIP[MODELS_PER_TEAM][MAX_FILE_LEN]; public OnMapStart() { g_Models_Count_CT = 0; g_Models_Count_T = 0; g_Models_Count_TVIP = 0; g_Models_Count_CT = LoadModels(g_Models_CT, "configs/models_ct.ini"); g_Models_Count_T = LoadModels(g_Models_T, "configs/models_t.ini"); g_Models_Count_TVIP = LoadModels(g_Models_TVIP, "configs/models_tvip.ini"); NameModels(g_Models_Name_CT,g_Models_CT,g_Models_Count_CT); NameModels(g_Models_Name_T,g_Models_T,g_Models_Count_T); NameModels(g_Models_Name_TVIP,g_Models_TVIP,g_Models_Count_TVIP); if (g_Models_Count_CT == 0) SetFailState("[sM] Skin SE Error: No Custom CT Models found by plugin"); if (g_Models_Count_T == 0) SetFailState("[sM] Skin SE Error: No Custom T Models found by plugin"); if (g_Models_Count_TVIP == 0) SetFailState("[sM] Skin SE Error: No Custom T vip Models found by plugin"); } //Récupère le nom des models et le stock dans un tableau public NameModels(String:models_name[][], String:models[][], models_count) { for (new i = 0; i<models_count; i++) { new start; new String:buffer[MAX_FILE_LEN]; for (new j = strlen(models[i])-1 ; j > 0 ; j--) { if (StrEqual(models[i][j],"/") || StrEqual(models[i][j],"\")) //line 134 { start = j; break; } } for (new k = 0 ; k + start < strlen(models[i]) ; k++) { buffer[k] = models[i][start + k]; } models_name[i] = buffer; //line 144 } } //Lit les .ini charge les models et les fait DL //Retourne le nombre de model par équipe. stock LoadModels(String:models[][], String:ini_file[]) { decl String:buffer[MAX_FILE_LEN]; decl String:file[MAX_FILE_LEN]; new models_count; BuildPath(Path_SM, file, MAX_FILE_LEN, ini_file); //open precache file and add everything to download table new Handle:fileh = OpenFile(file, "r"); while (ReadFileLine(fileh, buffer, MAX_FILE_LEN)) { // Strip leading and trailing whitespace TrimString(buffer); // Skip non existing files (and Comments) if (FileExists(buffer)) { // Tell Clients to download files AddFileToDownloadsTable(buffer); // Tell Clients to cache model if (StrEqual(buffer[strlen(buffer)-4], ".mdl", false) && (models_count<MODELS_PER_TEAM)) { strcopy(models[models_count++], strlen(buffer)+1, buffer); PrecacheModel(buffer, true); } } } return models_count; }/home/groups/sourcemod/upload_tmp/phpbC8sCW.sp(134) : error 037: invalid string (possibly non-terminated string)/home/groups/sourcemod/upload_tmp/phpbC8sCW.sp(144) : error 046: unknown array size (variable "models_name")/home/groups/sourcemod/upload_tmp/phpbC8sCW.sp(144) : warning 215: expression has no effect fonctionnent de la méthode NamesModel: J'ai un tableau de string (ex: g_models_T) il contient tous les chemins de models contenu dans le fichier .iniJe veux choper le nom du model, je fais donc une recherche dans le string vers la gauche pour trouver le premier "\" ou "/" puis je relis par la droite le string et l'enregistre dans le tableau g_models_name_ Je n'ai pas trouvé de doc sur les deux erreurs, avez vous des idées? Report
August 2, 201114 yr comment_63162 J'ai pas trop regardé. Essaye de voir si le / et l'\ ne sont pas des caractère spéciaux (et donc autre formulation). Comme en PHP par exemple.Et sinon, ou as tu définit models_name ? Peux-tu copier/coller la ligne ? Report
August 2, 201114 yr Author comment_63166 models_name est un argument de la methode:public NameModels(String:models_name[][], String:models[][], models_count) Report
August 2, 201114 yr comment_63168 Oui, tu viens de mettre le tout.model_name est un tableau a 2 dimensions. Là, tu ne lui en a précisé qu'une . Report
August 2, 201114 yr Author comment_63170 model_name est un tableau de string, si j'ai bien compris sur sourcemod un string est de base un tableau. je vais faire des tests Report
August 2, 201114 yr comment_63171 Ok. Mais sous Sourcemod, tu n'injectes pas un string dans une variable avec un simple = ^^. Report
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.