16.02.2009, 15:41 
	
	
	
		noobs keep crashin my server cuz when they load a invalid map, the server just crashes :<
so, i need to make it show a message when a invalid map is loaded
this were taked from medit (edited a bit)
so, can i get some help here?
	
	
	
	
so, i need to make it show a message when a invalid map is loaded
this were taked from medit (edited a bit)
Код:
dcmd_loadmap(playerid, cmdtext[] = "") {
	new map_name[32],templine[128],tempobject[object_info];
	if(strlen(cmdtext) == 0 || strlen(cmdtext) >= 30) {
	  map_name = "default.map";
	} else {
	  format(map_name, 32, "%s.map",cmdtext);
	}
	new File:f,i,j;
	f = fopen(map_name,io_read);
	while(fread(f,templine,sizeof(templine),false)) {
		new index;
		tempobject[object_id] = INVALID_OBJECT_ID;
		tempobject[modelid] = strval(strtok(templine,index));
		tempobject[ox] = floatstr(strtok(templine,index));
		tempobject[oy] = floatstr(strtok(templine,index));
		tempobject[oz] = floatstr(strtok(templine,index));
		tempobject[rx] = floatstr(strtok(templine,index));
		tempobject[ry] = floatstr(strtok(templine,index));
		tempobject[rz] = floatstr(strtok(templine,index));
		for(i = j; i < MAX_OBJECTS; i++) {
	    j++;
	    if(objects[i][object_id] == INVALID_OBJECT_ID || !IsValidObject(objects[i][object_id])) {
	      tempobject[object_id] = CreateObject(tempobject[modelid],tempobject[ox],tempobject[oy],tempobject[oz],tempobject[rx],tempobject[ry],tempobject[rz]);
	      objects[i] = tempobject;
	      break;
	    }
	  }
	}
	fclose(f);
	SendClientMessage(playerid, COLOR_YELLOW, "The map has successfully been loaded.");
	return 1;
}

